-
Notifications
You must be signed in to change notification settings - Fork 26
/
.gitlab-ci.yml
101 lines (82 loc) · 2.56 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
variables:
DEV_USERNAME: deployment
QA_USERNAME: deployment
T3_USERNAME: deploymentcass
GIT_SUBMODULE_STRATEGY: recursive
image: node:16
cache:
paths:
- node_modules
stages:
- deploy
### DEPLOYMENTS
deployDev:
stage: deploy
only:
- dev
environment:
name: dev
url: https://dev.api.cassproject.org
script:
- apt-get update -y
- apt-get install openssh-client -y
- 'which ssh-agent || apt-get install openssh-client -y'
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$DEV_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- chmod 600 "$DEV_PRIVATE_KEY"
- ssh-add "$DEV_PRIVATE_KEY" > /dev/null
## Build commands
- cd $CI_PROJECT_DIR
- sed -i 's/http:\/\/localhost:8080/https:\/\/dev.api.cassproject.org/g' ./pm2.config.js
- scp -P22 -r src $DEV_USERNAME@$DEV_SERVER_IP:/srv/node
- scp -P22 -r package*.json $DEV_USERNAME@$DEV_SERVER_IP:/srv/node
- scp -P22 -r pm2.config.js $DEV_USERNAME@$DEV_SERVER_IP:/srv/node
- ssh $DEV_USERNAME@$DEV_SERVER_IP "cd /srv/node && npm install && npm run stop && npm run run"
deployQA:
stage: deploy
only:
- qa
environment:
name: qa
url: https://qa.api.cassproject.org
script:
- apt-get update -y
- apt-get install openssh-client -y
- 'which ssh-agent || apt-get install openssh-client -y'
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$QA_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- chmod 600 "$QA_PRIVATE_KEY"
- ssh-add "$QA_PRIVATE_KEY" > /dev/null
## Build commands
- cd $CI_PROJECT_DIR
- sed -i 's/http:\/\/localhost:8080/https:\/\/qa.api.cassproject.org/g' ./pm2.config.js
- scp -P22 -r src $QA_USERNAME@$QA_SERVER_IP:/srv/node
- scp -P22 -r package*.json $QA_USERNAME@$QA_SERVER_IP:/srv/node
- scp -P22 -r pm2.config.js $QA_USERNAME@$QA_SERVER_IP:/srv/node
- ssh $QA_USERNAME@$QA_SERVER_IP "cd /srv/node && npm install && npm run stop && npm run run"
deployT3:
stage: deploy
only:
- t3
environment:
name: t3
url: https://t3.api.cassproject.org
script:
- apt-get update -y
- apt-get install openssh-client -y
- 'which ssh-agent || apt-get install openssh-client -y'
- eval $(ssh-agent -s)
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo "$T3_KNOWN_HOSTS" > ~/.ssh/known_hosts
- chmod 644 ~/.ssh/known_hosts
- chmod 600 "$T3_PRIVATE_KEY"
- ssh-add "$T3_PRIVATE_KEY" > /dev/null
## Build commands
- scp -P22 -r ./target/cass.war $T3_USERNAME@$T3_SERVER_IP:/srv/deployer/