-
Notifications
You must be signed in to change notification settings - Fork 0
371 lines (300 loc) · 14.8 KB
/
mainnet-deploy.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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
name: Deploy Mainnet
on:
workflow_dispatch:
jobs:
deploy_public_bootnode:
environment: mainnet
strategy:
matrix:
include:
- node_index: 1
host_key: BOOT_NODE_1_HOST
user_key: BOOT_NODE_1_USER
priv_node_key: BOOT_NODE_1_KEY_PRIV
- node_index: 2
host_key: BOOT_NODE_2_HOST
user_key: BOOT_NODE_2_USER
priv_node_key: BOOT_NODE_2_KEY_PRIV
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install system deps
run: sudo apt-get install jq wget
- name: Set up SSH
run: |
mkdir -p ~/.ssh/
touch ~/.ssh/known_hosts
ssh-keyscan ${{ secrets[matrix.host_key] }} >> ~/.ssh/known_hosts
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
eval $(ssh-agent)
# - name: Authenticate GitHub CLI and download latest release of chainspec
# run: |
# gh auth login --with-token <<< "${{ secrets.ACCESS_TOKEN }}"
# LATEST_RELEASE=$(gh release list --repo Atleta-network/atleta --json tagName,createdAt --jq '.[] | select(.tagName | startswith("testnet-chainspec")) | .tagName' | sort -r | head -n 1)
# echo "${LATEST_RELEASE}"
# gh release download "${LATEST_RELEASE}" --repo Atleta-network/atleta --pattern "chain-spec.testnet.json" --dir chainspecs
- name: Download chainspec
run: |
mkdir chainspecs
wget -O chainspecs/chain-spec.mainnet.json https://raw.githubusercontent.com/Atleta-network/atleta/refs/heads/feature/180-update-chainspecs/chainspecs/chain-spec.mainnet.json
- name: Prepare variables
run: |
echo "BOOT_NODE_KEY_PRIV=${{ secrets[matrix.priv_node_key] }}" >> mainnet/deploy/bootnode-keys.env
echo "container_atleta=bootnode" >> mainnet/deploy/bootnode.env
- name: Substitute environment variables
env:
LOKI_DOMAIN: ${{ secrets.LOKI_DOMAIN }}
run: |
envsubst < utils/telemetry/promtail/promtail-config.yml > mainnet/deploy/promtail-config.yml
- name: Copy files to the server
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }} "mkdir -p /mnt/sportchain/atleta"
scp mainnet/deploy/deploy-bootnode.sh ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/deploy-bootnode.sh
scp chainspecs/chain-spec.mainnet.json ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/chainspec.json
scp mainnet/deploy/bootnode-keys.env ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/bootnode-keys.env
scp mainnet/deploy/bootnode.env ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/.env
ssh -o StrictHostKeyChecking=no ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }} "mkdir -p /mnt/sportchain/atleta/{promtail,process-exporter}"
scp mainnet/deploy/promtail-config.yml ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/promtail/promtail-config.yml
scp utils/telemetry/process-exporter/process-exporter.yml ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/process-exporter/process-exporter.yml
- name: Run bootnode
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets[matrix.host_key] }}
username: ${{ secrets[matrix.user_key] }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /mnt/sportchain/atleta
./deploy-bootnode.sh atletanetwork/atleta-node:stagenet-latest
deploy_validators:
needs:
- deploy_public_bootnode
runs-on: ubuntu-latest
environment: mainnet
strategy:
matrix:
include:
- node_index: 1
host_key: VALIDATOR_1_HOST
user_key: VALIDATOR_1_USER
priv_node_key: VALIDATOR_1_NODE_KEY_PRIV
- node_index: 2
host_key: VALIDATOR_2_HOST
user_key: VALIDATOR_2_USER
priv_node_key: VALIDATOR_2_NODE_KEY_PRIV
- node_index: 3
host_key: VALIDATOR_3_HOST
user_key: VALIDATOR_3_USER
priv_node_key: VALIDATOR_3_NODE_KEY_PRIV
- node_index: 4
host_key: VALIDATOR_4_HOST
user_key: VALIDATOR_4_USER
priv_node_key: VALIDATOR_4_NODE_KEY_PRIV
- node_index: 5
host_key: VALIDATOR_5_HOST
user_key: VALIDATOR_5_USER
priv_node_key: VALIDATOR_5_NODE_KEY_PRIV
- node_index: 6
host_key: VALIDATOR_6_HOST
user_key: VALIDATOR_6_USER
priv_node_key: VALIDATOR_6_NODE_KEY_PRIV
- node_index: 7
host_key: VALIDATOR_7_HOST
user_key: VALIDATOR_7_USER
priv_node_key: VALIDATOR_7_NODE_KEY_PRIV
- node_index: 8
host_key: VALIDATOR_8_HOST
user_key: VALIDATOR_8_USER
priv_node_key: VALIDATOR_8_NODE_KEY_PRIV
- node_index: 9
host_key: VALIDATOR_9_HOST
user_key: VALIDATOR_9_USER
priv_node_key: VALIDATOR_9_NODE_KEY_PRIV
- node_index: 10
host_key: VALIDATOR_10_HOST
user_key: VALIDATOR_10_USER
priv_node_key: VALIDATOR_10_NODE_KEY_PRIV
- node_index: 11
host_key: VALIDATOR_11_HOST
user_key: VALIDATOR_11_USER
priv_node_key: VALIDATOR_11_NODE_KEY_PRIV
- node_index: 12
host_key: VALIDATOR_12_HOST
user_key: VALIDATOR_12_USER
priv_node_key: VALIDATOR_12_NODE_KEY_PRIV
#- node_index: 13
# host_key: VALIDATOR_13_HOST
# user_key: VALIDATOR_13_USER
# priv_node_key: VALIDATOR_13_NODE_KEY_PRIV
- node_index: 14
host_key: VALIDATOR_14_HOST
user_key: VALIDATOR_14_USER
priv_node_key: VALIDATOR_14_NODE_KEY_PRIV
- node_index: 15
host_key: VALIDATOR_15_HOST
user_key: VALIDATOR_15_USER
priv_node_key: VALIDATOR_15_NODE_KEY_PRIV
steps:
- uses: actions/checkout@v4
- name: Install system deps
run: sudo apt-get install jq wget
- name: Set up SSH
run: |
mkdir -p ~/.ssh/
touch ~/.ssh/known_hosts
ssh-keyscan ${{ secrets[matrix.host_key] }} >> ~/.ssh/known_hosts
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
eval $(ssh-agent)
# - name: Authenticate GitHub CLI and download latest release of chainspec
# run: |
# gh auth login --with-token <<< "${{ secrets.ACCESS_TOKEN }}"
# LATEST_RELEASE=$(gh release list --repo Atleta-network/atleta --json tagName,createdAt --jq '.[] | select(.tagName | startswith("testnet")) | .tagName' | sort -r | head -n 1)
# echo "${LATEST_RELEASE}"
# gh release download "${LATEST_RELEASE}" --repo Atleta-network/atleta --pattern "chain-spec.testnet.json" --dir chainspecs
- name: Download chainspec
run: |
mkdir chainspecs
wget -O chainspecs/chain-spec.mainnet.json https://raw.githubusercontent.com/Atleta-network/atleta/refs/heads/feature/180-update-chainspecs/chainspecs/chain-spec.mainnet.json
- name: Make Keys File
run: |
echo "${{ secrets.DEV_ACCOUNTS_KEYS }}" > mainnet/deploy/mainnet.keys.env
- name: Substitute environment variables
env:
LOKI_DOMAIN: ${{ secrets.LOKI_DOMAIN }}
run: |
envsubst < utils/telemetry/promtail/promtail-config.yml > mainnet/deploy/promtail-config.yml
- name: Prepare .env files
run: |
echo "VALIDATOR_KEY=${{ secrets[matrix.priv_node_key] }}" >> mainnet/deploy/validator.env
echo "INDEX=${{ matrix.node_index }}" >> mainnet/deploy/validator.env
echo "container_atleta=validator" >> mainnet/deploy/validator.env
- name: Copy Files to Server
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }} "mkdir -p /mnt/sportchain/atleta"
scp mainnet/deploy/add-session-keys.sh ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/add-session-keys.sh
scp mainnet/deploy/deploy-validator.sh ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/deploy-validator.sh
scp mainnet/deploy/mainnet.keys.env ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/mainnet.keys.env
scp chainspecs/chain-spec.mainnet.json ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/chainspec.json
scp mainnet/deploy/validator.env ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/.env
ssh -o StrictHostKeyChecking=no ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }} "mkdir -p /mnt/sportchain/atleta/{promtail,process-exporter}"
scp mainnet/deploy/promtail-config.yml ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/promtail/promtail-config.yml
scp utils/telemetry/process-exporter/process-exporter.yml ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/process-exporter/process-exporter.yml
- name: SSH into Server and Deploy
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets[matrix.host_key] }}
username: ${{ secrets[matrix.user_key] }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /mnt/sportchain/atleta
./deploy-validator.sh mainnet.keys.env atletanetwork/atleta-node:stagenet-latest
deploy_archive_nodes:
needs:
- deploy_validators
runs-on: ubuntu-latest
environment: mainnet
strategy:
matrix:
include:
- node_index: 1
host_key: ARCH_1_HOST
user_key: ARCH_1_USER
priv_node_key: ARCH_1_NODE_KEY_PRIV
- node_index: 2
host_key: ARCH_2_HOST
user_key: ARCH_2_USER
priv_node_key: ARCH_2_NODE_KEY_PRIV
- node_index: 3
host_key: ARCH_3_HOST
user_key: ARCH_3_USER
priv_node_key: ARCH_3_NODE_KEY_PRIV
- node_index: 4
host_key: ARCH_4_HOST
user_key: ARCH_4_USER
priv_node_key: aARCH_4_NODE_KEY_PRIV
- node_index: 5
host_key: ARCH_5_HOST
user_key: ARCH_5_USER
priv_node_key: ARCH_5_NODE_KEY_PRIV
- node_index: 6
host_key: ARCH_6_HOST
user_key: ARCH_6_USER
priv_node_key: ARCH_6_NODE_KEY_PRIV
- node_index: 7
host_key: ARCH_7_HOST
user_key: ARCH_7_USER
priv_node_key: ARCH_7_NODE_KEY_PRIV
- node_index: 8
host_key: ARCH_8_HOST
user_key: ARCH_8_USER
priv_node_key: ARCH_8_NODE_KEY_PRIV
- node_index: 9
host_key: ARCH_9_HOST
user_key: ARCH_9_USER
priv_node_key: ARCH_9_NODE_KEY_PRIV
- node_index: 10
host_key: ARCH_10_HOST
user_key: ARCH_10_USER
priv_node_key: ARCH_10_NODE_KEY_PRIV
- node_index: 11
host_key: ARCH_11_HOST
user_key: ARCH_11_USER
priv_node_key: ARCH_11_NODE_KEY_PRIV
- node_index: 12
host_key: ARCH_12_HOST
user_key: ARCH_12_USER
priv_node_key: ARCH_12_NODE_KEY_PRIV
- node_index: 13
host_key: ARCH_13_HOST
user_key: ARCH_13_USER
priv_node_key: ARCH_13_NODE_KEY_PRIV
steps:
- uses: actions/checkout@v4
- name: Install system deps
run: sudo apt-get install jq wget
- name: Set up SSH
run: |
mkdir -p ~/.ssh/
touch ~/.ssh/known_hosts
ssh-keyscan ${{ secrets[matrix.host_key] }} >> ~/.ssh/known_hosts
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
eval $(ssh-agent)
# - name: Authenticate GitHub CLI and download latest release of chainspec
# run: |
# gh auth login --with-token <<< "${{ secrets.ACCESS_TOKEN }}"
# LATEST_RELEASE=$(gh release list --repo Atleta-network/atleta --json tagName,createdAt --jq '.[] | select(.tagName | startswith("testnet")) | .tagName' | sort -r | head -n 1)
# echo "${LATEST_RELEASE}"
# gh release download "${LATEST_RELEASE}" --repo Atleta-network/atleta --pattern "chain-spec.testnet.json" --dir chainspecs
- name: Download chainspec
run: |
mkdir chainspecs
wget -O chainspecs/chain-spec.mainnet.json https://raw.githubusercontent.com/Atleta-network/atleta/refs/heads/feature/180-update-chainspecs/chainspecs/chain-spec.mainnet.json
- name: Substitute environment variables
env:
LOKI_DOMAIN: ${{ secrets.LOKI_DOMAIN }}
run: |
envsubst < utils/telemetry/promtail/promtail-config.yml > mainnet/deploy/promtail-config.yml
- name: Prepare .env files
run: |
echo "INDEX=${{ matrix.node_index }}" >> mainnet/deploy/archive-node.env
echo "container_atleta=archive" >> mainnet/deploy/archive-node.env
- name: Copy Files to Server
run: |
ssh -o StrictHostKeyChecking=no ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }} "mkdir -p /mnt/sportchain/atleta"
scp mainnet/deploy/run-archive-node.sh ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/run-archive-node.sh
scp chainspecs/chain-spec.mainnet.json ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/chainspec.json
scp mainnet/deploy/archive-node.env ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/.env
ssh -o StrictHostKeyChecking=no ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }} "mkdir -p /mnt/sportchain/atleta/{promtail,process-exporter}"
scp mainnet/deploy/promtail-config.yml ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/promtail/promtail-config.yml
scp utils/telemetry/process-exporter/process-exporter.yml ${{ secrets[matrix.user_key] }}@${{ secrets[matrix.host_key] }}:/mnt/sportchain/atleta/process-exporter/process-exporter.yml
- name: SSH into Server and Deploy
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets[matrix.host_key] }}
username: ${{ secrets[matrix.user_key] }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
script: |
cd /mnt/sportchain/atleta
./run-archive-node.sh atletanetwork/atleta-node:stagenet-latest