File tree Expand file tree Collapse file tree 3 files changed +21
-25
lines changed
Expand file tree Collapse file tree 3 files changed +21
-25
lines changed Original file line number Diff line number Diff line change 2222 changed_when : false
2323 - setup :
2424
25- environment :
26- - TYPEORM_CONNECTION : " {{ lookup('env', 'TYPEORM_CONNECTION')}}"
27- - TYPEORM_ENTITIES : " {{ lookup('env', 'TYPEORM_ENTITIES')}}"
28- - TYPEORM_HOST : " {{ lookup('env', 'TYPEORM_HOST')}}"
29- - TYPEORM_PORT : 5432
30- - TYPEORM_USERNAME : " {{ lookup('env', 'TYPEORM_USERNAME')}}"
31- - TYPEORM_PASSWORD : " {{ lookup('env', 'TYPEORM_PASSWORD')}}"
32- - TYPEORM_DATABASE : " {{ lookup('env', 'TYPEORM_DATABASE')}}"
33- - TYPEORM_MIGRATIONS : " {{ lookup('env', 'TYPEORM_MIGRATIONS')}}"
34- - TYPEORM_MIGRATIONS_DIR : " {{ lookup('env', 'TYPEORM_MIGRATIONS_DIR')}}"
35-
36-
3725 roles :
3826 - configure-server
3927 - configure-prometheus-node-exporter
Original file line number Diff line number Diff line change 44 become_user : root
55 become_method : sudo
66 shell : |
7- echo TYPEORM_ENTITIES=. /backend/dist/modules/domain/**/*.entity{.ts,.js} >> /etc/environment
7+ echo TYPEORM_ENTITIES=~ /backend/dist/modules/domain/**/*.entity{.ts,.js} >> /etc/environment
88 echo TYPEORM_HOST="{{ lookup('env', 'TYPEORM_HOST') }}" >> /etc/environment
99 echo TYPEORM_PORT=5432 >> /etc/environment
1010 echo TYPEORM_USERNAME=postgres >> /etc/environment
1111 echo TYPEORM_CONNECTION="{{ lookup('env', 'TYPEORM_CONNECTION') }}" >> /etc/environment
1212 echo TYPEORM_PASSWORD="{{ lookup('env', 'TYPEORM_PASSWORD') }}" >> /etc/environment
1313 echo TYPEORM_DATABASE=glee >> /etc/environment
14- echo TYPEORM_MIGRATIONS_DIR=. /backend/dist/migrations >> /etc/environment
15- echo TYPEORM_MIGRATIONS=. /backend/dist/migrations/*.ts >> /etc/environment
14+ echo TYPEORM_MIGRATIONS_DIR=~ /backend/dist/migrations >> /etc/environment
15+ echo TYPEORM_MIGRATIONS=~ /backend/dist/migrations/*.ts >> /etc/environment
1616 echo NODE_ENV=production >> /etc/environment
1717 echo VERSION=1 >> /etc/environment
1818
3434 - name : Start the app
3535 become : true
3636 shell : |
37- cd /home/ubuntu/backend/dist
37+ cd /home/ubuntu/backend/
3838 pm2 stop default
39- pm2 start main.js
39+ pm2 start dist/main.js
40+ register : execute_node
41+
42+ - name : print message
43+ debug :
44+ msg : " {{ execute_node.stdout_lines }}"
45+
46+ - name : " Configure pm2 to start as service"
47+ shell : |
48+ sudo su -c "env PATH=$PATH:/usr/local/bin pm2 startup systemd -u ubuntu --hp /home/ubuntu"
49+ pm2 save
4050
4151
4252
Original file line number Diff line number Diff line change @@ -334,10 +334,7 @@ jobs:
334334 cp backend/artifact.tar.gz .circleci/ansible/roles/deploy/files/
335335 - run :
336336 name : Deploy backend
337- command : |
338- export TYPEORM_MIGRATIONS_DIR=./migrations
339- export TYPEORM_ENTITIES=./modules/domain/**/*.entity{.ts,.js}
340- export TYPEORM_MIGRATIONS=./migrations/*.ts
337+ command :
341338
342339 cd .circleci/ansible
343340 cat inventory.txt
@@ -367,7 +364,8 @@ jobs:
367364 echo $BACKEND_PUBLIC_IP
368365 if curl -s $API_URL/api/status | grep "ok"
369366 then
370- exit 0
367+ echo failure screenshot6
368+ exit 1
371369 else
372370 exit 1
373371 fi
@@ -446,8 +444,8 @@ workflows:
446444 requires : [run-migrations]
447445 - deploy-backend :
448446 requires : [run-migrations]
449- # - smoke-test:
450- # requires: [deploy-backend, deploy-frontend]
447+ - smoke-test :
448+ requires : [deploy-backend, deploy-frontend]
451449 - notify-on-success :
452450 requires :
453451 - build-frontend
@@ -461,7 +459,7 @@ workflows:
461459 - run-migrations
462460 - deploy-frontend
463461 - deploy-backend
464- # - smoke-test
462+ - smoke-test
465463# - cloudfront-update:
466464# requires: [smoke-test]
467465# - cleanup:
You can’t perform that action at this time.
0 commit comments