File tree Expand file tree Collapse file tree 10 files changed +200
-0
lines changed Expand file tree Collapse file tree 10 files changed +200
-0
lines changed Original file line number Diff line number Diff line change
1
+ .gitignore
2
+ .travis.yml
3
+ .gitignore
4
+ .github
5
+
6
+ # Codeship config
7
+ codeship-services.yml
8
+ codeship-steps.yml
9
+ * .aes
Original file line number Diff line number Diff line change @@ -22,3 +22,6 @@ yarn-error.log*
22
22
yarn.lock
23
23
package-lock.json
24
24
.idea
25
+
26
+ # Codeship
27
+ * .aes
Original file line number Diff line number Diff line change
1
+ FROM node:13.8.0
2
+
3
+
4
+ WORKDIR /opt/7park
5
+ COPY . /opt/7park/
6
+ RUN yarn --ignore-engines
7
+
8
+ CMD [ "yarn" , "start" ]
Original file line number Diff line number Diff line change
1
+ codeship:v2
2
+ Er3f9/R2iO/gzA20whXqRFKegw9uLAt3iQz/FOaYTHMPUcyIo0astzzg1BBUhf6KXsbfwQgkesgWu+n/8OU4IM7wEPrZ8ueGXvZGTlKzqq5Sx6qHxT90lMl2X7JdnF+dBHg8pGsS8/GSL5VUcpVrlCF5ErUIO7jEW/5u2nLT0WKc+/BGqyhbMsjafxLfbDQEoAXnpKN/j/jIe88byd2NDqnr6HrKog0l4Ok=
Original file line number Diff line number Diff line change
1
+ kepler_prod :
2
+ build :
3
+ image : 084888172679.dkr.ecr.us-east-1.amazonaws.com/kepler
4
+ dockerfile_path : ./Dockerfile
5
+ encrypted_env_file : aws.env.encrypted
6
+ environment :
7
+ - AWS_DEFAULT_REGION=us-east-1
8
+ cache : true
9
+
10
+ aws_dockercfg_prod :
11
+ image : codeship/aws-ecr-dockercfg-generator
12
+ add_docker : true
13
+ encrypted_env_file : aws.env.encrypted
14
+ cache : true
15
+
16
+ aws_deployment_prod :
17
+ image : codeship/aws-deployment
18
+ add_docker : true
19
+ encrypted_env_file : aws.env.encrypted
20
+ environment :
21
+ - AWS_DEFAULT_REGION=us-east-1
22
+ volumes :
23
+ - ./:/deploy
24
+ cache : true
Original file line number Diff line number Diff line change
1
+ - name : Build Kepler and Publish to ECR
2
+ service : kepler_prod
3
+ type : push
4
+ tag : " master"
5
+ image_name : 084888172679.dkr.ecr.us-east-1.amazonaws.com/kepler
6
+ image_tag : " {{ .Branch }}"
7
+ registry : https://084888172679.dkr.ecr.us-east-1.amazonaws.com
8
+ dockercfg_service : aws_dockercfg_prod
9
+
10
+ - name : Deploy to ECS
11
+ type : serial
12
+ steps :
13
+ - service : aws_deployment_prod
14
+ tag : " master"
15
+ command : deploy/ops/aws_deployment.sh
16
+ dockercfg_service : aws_dockercfg
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ echo " Running deployment for branch $CI_BRANCH "
4
+ source /deploy/ops/branch_to_env.sh
5
+
6
+ aws --version
7
+ pip install awscli==1.18.63
8
+ pip install jinja2-cli==0.6.0
9
+ aws --version
10
+
11
+ # for COMMAND in "api" "rq" "unicorn"
12
+
13
+ jinja2 /deploy/ops/tasks/${ENV} /task_def.json.j2 -D branch=${CI_BRANCH} -D env=${ENV} -D command=${COMMAND} > /task_def_${COMMAND} .json
14
+
15
+ cat task_def_${COMMAND} .json
16
+
17
+ # Register a new version of the task defined in json and update
18
+ # the currently running instances
19
+ aws ecs register-task-definition --cli-input-json file:///task_def_${COMMAND} .json
20
+
21
+ aws ecs update-service --cluster seven-park-${ENV} --service distro-${COMMAND} -${ENV} -service --task-definition distro-${COMMAND} -${ENV} -td
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ APP_NAME=distro
4
+ TEMP_DIR=" /opt/7park/temp_attachments/"
5
+
6
+ wait_tcp_port () {
7
+ local host=" $1 " port=" $2 "
8
+
9
+ # see http://tldp.org/LDP/abs/html/devref1.html for description of this syntax.
10
+ NEXT_WAIT_TIME=0
11
+ while ! exec 6<> /dev/tcp/$host /$port || [ $NEXT_WAIT_TIME -eq 20 ]; do
12
+ echo " $( date) - still trying to connect to $host :$port "
13
+ sleep $(( NEXT_WAIT_TIME++ ))
14
+ done
15
+ exec 6>& -
16
+ }
17
+
18
+ echo " Current env=${ENV} "
19
+
20
+ if [ -z " ${ENV} " ]; then
21
+ source branch_to_env.sh
22
+ fi
23
+
24
+ mkdir " ${TEMP_DIR} "
25
+ export TEMP_FILE_DIR=" ${TEMP_DIR} "
26
+ export ENVIRONMENT=" ${ENV} "
27
+
28
+ echo " Debug variables, ENV=${ENV} APP_NAME=${APP_NAME} "
29
+ python print_parameters.py --env=" ${ENV} " --app=" ${APP_NAME} " -d
30
+
31
+ # Load variable:qs to environment
32
+ # shellcheck disable=SC2046
33
+ eval $( python print_parameters.py --env=" ${ENV} " --app=" ${APP_NAME} " )
34
+
35
+ case " $1 " in
36
+ api)
37
+ gunicorn --chdir distrib -b 0.0.0.0:8080 wsgi:app -t 1200
38
+ exit
39
+ ;;
40
+ celery_beat)
41
+ celery -A distrib.celery_config.celery beat --loglevel info
42
+ exit
43
+ ;;
44
+ celery_worker)
45
+ if [ " ${ENV} " = ' dev' ]; then
46
+ celery -A distrib.celery_config.celery worker -B --loglevel info -Q dev_distro-workitems
47
+ else
48
+ celery -A distrib.celery_config.celery worker -B --loglevel info -Q distro-workitems
49
+ fi
50
+ exit
51
+ ;;
52
+ * )
53
+ # The command is something like bash. Just run it in the right environment.
54
+ exec " $@ "
55
+ ;;
56
+ esac
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ echo Current branch ${CI_BRANCH}
4
+
5
+ case " ${CI_BRANCH} " in
6
+ dev)
7
+ ENV=" dev"
8
+ ;;
9
+ master)
10
+ ENV=" prod"
11
+ ;;
12
+ * )
13
+ ENV=" dev"
14
+ ;;
15
+ esac
16
+
17
+ echo Running for env=${ENV}
Original file line number Diff line number Diff line change
1
+ {
2
+ "containerDefinitions": [
3
+ {
4
+ "logConfiguration": {
5
+ "logDriver": "awslogs",
6
+ "options": {
7
+ "awslogs-group": "/apps/kepler-ecs-{{env}}",
8
+ "awslogs-region": "us-east-1",
9
+ "awslogs-stream-prefix": "kepler"
10
+ }
11
+ },
12
+ "portMappings": [
13
+ {
14
+ "hostPort": 3000,
15
+ "protocol": "tcp",
16
+ "containerPort": 3000
17
+ }
18
+ ],
19
+ "cpu": 1024,
20
+ "environment": [
21
+ {
22
+ "name": "ENV",
23
+ "value": "{{env}}"
24
+ }
25
+ ],
26
+ "mountPoints": [],
27
+ "memory": 2048,
28
+ "volumesFrom": [],
29
+ "image": "084888172679.dkr.ecr.us-east-1.amazonaws.com/kepler:{{branch}}",
30
+ "essential": true,
31
+ "name": "kepler_{{env}}"
32
+ }
33
+ ],
34
+ "executionRoleArn": "arn:aws:iam::084888172679:role/7p-kepler-{{env}}-ecs",
35
+ "taskRoleArn": "arn:aws:iam::084888172679:role/7p-kepler-{{command}}-{{env}}-ecs",
36
+ "family": "kepler-{{env}}-td",
37
+ "networkMode": "awsvpc",
38
+ "placementConstraints": [],
39
+ "requiresCompatibilities": [
40
+ "FARGATE"
41
+ ],
42
+ "cpu": "1024",
43
+ "memory": "2048"
44
+ }
You can’t perform that action at this time.
0 commit comments