20
20
sudo dpkg -i google-chrome.deb
21
21
sudo sed -i 's|HERE/chrome\"|HERE/chrome\" --disable-setuid-sandbox|g' /opt/google/chrome/google-chrome
22
22
rm google-chrome.deb
23
+ # Install pm2
24
+ - run :
25
+ name : Install pm2
26
+ command : sudo npm install -g pm2
27
+ # Install full-icu
28
+ - run :
29
+ name : Install full-icu
30
+ command : |
31
+ sudo npm install --unsafe-perm -g full-icu
32
+ echo 'export NODE_ICU_DATA=/usr/local/lib/node_modules/full-icu' >> ~/.bashrc
33
+ echo 'export PATH=$NODE_ICU_DATA:$PATH' >> ~/.bashrc
34
+ source ~/.bashrc
23
35
# Log the current branch
24
36
- run :
25
37
name : Show current branch
42
54
- run :
43
55
name : Building
44
56
command : cd project/application && npm run build:ssr
57
+ # Running the Nodejs server instance
58
+ - run :
59
+ name : Running the instance Nodejs server
60
+ command : cd project/application && npm run serve:ssr
61
+ - run : sleep 15 # workaround pm2 auto restart issue
62
+ # Check the Nodejs server status
63
+ - run :
64
+ name : Check the Nodejs server status
65
+ command : bash pm2-health-check-circleci.sh
66
+ # Stop the Nodejs server
67
+ - run :
68
+ name : Stoping Nodejs server
69
+ command : cd project/application && npm run pm2:stop
45
70
# Lint the source code
46
71
- run :
47
72
name : Linting
@@ -59,17 +84,17 @@ jobs:
59
84
machine :
60
85
enabled : true
61
86
environment :
62
- FINGERPRINT : 8c:c8:d3:84:56:47:d7:28:13:2a:d8:2b:4e:53:0e:c0
63
- SSH_USER : la
64
- SSH_HOST : angular-universal.lazy-ants.com
87
+ FINGERPRINT : 8c:c8:d3:84:56:47:d7:28:13:2a:d8:2b:4e:53:0e:c0 # Replace this with actual value
88
+ SSH_USER : la # Replace this with actual value
89
+ SSH_HOST : angular-universal.lazy-ants.com # Replace this with actual value
65
90
steps :
66
91
- add_ssh_keys :
67
92
fingerprints :
68
93
- " $FINGERPRINT" # https://circleci.com/docs/2.0/add-ssh-key
69
94
- run :
70
95
name : Deploy Over SSH
71
96
command : |
72
- ssh $SSH_USER@$SSH_HOST "cd /var/www/angular-universal && bash deploy-circleci.sh"
97
+ ssh $SSH_USER@$SSH_HOST "cd /var/www/angular-universal && git status && git checkout -- . && git pull origin master && bash deploy-circleci.sh" # Replace /var/www/angular-universal path with actual value
73
98
74
99
workflows :
75
100
version : 2
0 commit comments