-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
58 lines (51 loc) · 2.06 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
image: rust:latest
variables:
MYSQL_DATABASE: wallet_service
MYSQL_USER: root
MYSQL_ROOT_PASSWORD: secret
stages:
- test
- deploy # Jobs placed in build-stage will run last after test-jobs
test:
services:
- mysql:5
stage: test
script:
- apt-get --assume-yes update
- apt-get --assume-yes upgrade
- curl -sL https://deb.nodesource.com/setup_10.x | bash -
- apt-get --assume-yes install software-properties-common
- add-apt-repository ppa:longsleep/golang-backports
- apt install --assume-yes golang-go
- apt install -y nodejs
- go get github.com/go-sql-driver/mysql
- touch .config
- echo "root:secret@tcp(mysql:3306)" > .config
- rm Cargo.lock
- cargo build
- nohup /bin/bash runservers &
- cd test && npm install && npm test
deploy:
stage: deploy
script:
- mkdir ~/.ssh
- echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- touch ~/.ssh/id_rsa
- chmod 600 ~/.ssh/id_rsa # Required permission by ssh
- echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
- touch ~/.ssh/id_rsa.pub
- chmod 600 ~/.ssh/id_rsa.pub # Required permission by ssh
- echo "$SSH_PUBLIC_KEY" > ~/.ssh/id_rsa.pub
- apt-get update
- apt-get install --assume-yes rsync
- rsync --archive --delete --exclude='.git' --exclude='.config' --exclude='node_modules' . [email protected]:two-phase-commit
- ssh [email protected] "echo $IP_ADDRESSES > two-phase-commit/addresses"
- ssh [email protected] systemctl --user restart order
- rsync --archive --delete --exclude='.git' --exclude='.config' --exclude='node_modules' . [email protected]:two-phase-commit
- ssh [email protected] "echo $IP_ADDRESSES > two-phase-commit/addresses"
- ssh [email protected] systemctl --user restart wallet
- rsync --archive --delete --exclude='.git' --exclude='.config' --exclude='node_modules' --exclude='config.json' . [email protected]:two-phase-commit
- ssh [email protected] "echo $IP_ADDRESSES > two-phase-commit/addresses"
- ssh [email protected] systemctl --user restart orc
only:
- master