-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (44 loc) · 1.75 KB
/
deploy-mainnet.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
name: Deploy to EC2 (Mainnet)
on:
workflow_dispatch:
env:
HOST: ${{ secrets.HOST_MAINNET }}
USER: ec2-user
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up SSH
run: |
echo "${{ secrets.SSH_PRIVATE_KEY }}" > private_key.pem
chmod 600 private_key.pem
mkdir -p ~/.ssh
touch ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
ssh-keyscan $HOST >> ~/.ssh/known_hosts
- name: Build Boost
run: |
sudo apt update && sudo apt install -y make
wget -q https://go.dev/dl/go1.20.2.linux-amd64.tar.gz
tar -xf go1.20.2.linux-amd64.tar.gz
sudo mv go /usr/local
export GOROOT=/usr/local/go
export PATH=$GOROOT/bin:$PATH
make
CGO_ENABLED=0 make build
- name: Deploy to EC2
run: |
ssh -i private_key.pem $USER@$HOST "sudo systemctl stop boost"
ssh -i private_key.pem $USER@$HOST "sudo systemctl stop searcher-1"
ssh -i private_key.pem $USER@$HOST "sudo systemctl stop searcher-2"
ssh -i private_key.pem $USER@$HOST "sudo systemctl stop searcher-3"
ssh -i private_key.pem $USER@$HOST "sudo systemctl daemon-reload"
ssh -i private_key.pem $USER@$HOST "mkdir -p ~/builder-boost"
scp -i private_key.pem -r ./boost $USER@$HOST:~/builder-boost
scp -i private_key.pem -r ./searcher $USER@$HOST:~/builder-boost
ssh -i private_key.pem $USER@$HOST "sudo systemctl start boost"
ssh -i private_key.pem $USER@$HOST "sudo systemctl start searcher-1"
ssh -i private_key.pem $USER@$HOST "sudo systemctl start searcher-2"
ssh -i private_key.pem $USER@$HOST "sudo systemctl start searcher-3"