-
Notifications
You must be signed in to change notification settings - Fork 3
270 lines (244 loc) · 12 KB
/
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
name: deploy
on:
push:
branches: [main, dev, chore/nano-testnet-dev]
tags: ['v*.*.*']
jobs:
init:
runs-on: ubuntu-latest
outputs:
environment: ${{ steps.setenv.outputs.environment}}
steps:
- name: Set environment
id: setenv
run: |
if [[ "${{github.ref}}" == refs/tags/v* ]]; then
echo "Setting mainnet environment"
echo "environment=mainnet" >> $GITHUB_OUTPUT
elif [[ "${{github.base_ref}}" == "main" || "${{github.ref}}" == "refs/heads/main" ]]; then
echo "Setting testnet environment"
echo "environment=testnet" >> $GITHUB_OUTPUT
elif [[ "${{github.base_ref}}" == "dev" || "${{github.ref}}" == "refs/heads/dev" ]]; then
echo "Setting dev environment"
echo "environment=dev" >> $GITHUB_OUTPUT
elif [[ "${{github.base_ref}}" == "chore/nano-testnet-dev" || "${{github.ref}}" == "refs/heads/chore/nano-testnet-dev" ]]; then
echo "Setting nano-testnet-dev environment"
echo "environment=nano-testnet-dev" >> $GITHUB_OUTPUT
fi
echo "timestamp=`date +%s`" >> $GITHUB_OUTPUT
dependencies:
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout/releases/tag/v3.5.3
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
- name: Set up Node.js 18.x
# https://github.com/actions/setup-node/releases/tag/v3.7.0
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8
with:
node-version: 18.x
- name: Cache node modules
# https://github.com/actions/cache/releases/tag/v3.3.1
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: /home/runner/work/hathor-explorer/hathor-explorer/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Npm Dependencies
run: |
npm ci
- name: Pack node modules
run: |
tar -cvf node_modules.tar ./node_modules
- name: Upload node modules
# https://github.com/actions/upload-artifact/releases/tag/v4.3.4
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b
with:
name: node_modules
path: node_modules.tar
if-no-files-found: error
retention-days: 1
deploy-dev:
needs: [init, dependencies]
if: ${{ needs.init.outputs.environment == 'dev' }}
uses: ./.github/workflows/deploy-reusable.yml
with:
aws_region: eu-central-1
aws_iam_role: arn:aws:iam::769498303037:role/ExplorerServiceGitHubActionsRole
aws_secret_arn: arn:aws:secretsmanager:eu-central-1:769498303037:secret:ExplorerService/dev-0ikehC
serverless_stage: dev
docker_image_tag: dev-${{ github.sha }}-${{ needs.init.outputs.timestamp }}
# XXX: Some env vars come from the secret https://eu-central-1.console.aws.amazon.com/secretsmanager/secret?name=ExplorerService%2Fdev®ion=eu-central-1
api_port: 3001
hathor_core_url: https://node.explorer.testnet.hathor.network
hathor_nodes: https://node1.testnet.hathor.network,https://node.explorer.testnet.hathor.network
redis_key_prefix: hathor-explorer-service-dev
redis_port: 6379
redis_db: 1
metadata_bucket: hathor-explorer-metadata-dev
cors_allowed_regex: .*
elastic_index: dev-token
elastic_tx_index: dev-tx
elastic_token_balances_index: dev-token-balance
healthcheck_hathor_core_enabled: true
healthcheck_wallet_service_db_enabled: true
healthcheck_elasticsearch_enabled: true
healthcheck_redis_enabled: true
deploy-testnet:
needs: [init, dependencies]
if: ${{ needs.init.outputs.environment == 'testnet' }}
uses: ./.github/workflows/deploy-reusable.yml
with:
aws_region: eu-central-1
aws_iam_role: arn:aws:iam::769498303037:role/ExplorerServiceGitHubActionsRole
aws_secret_arn: arn:aws:secretsmanager:eu-central-1:769498303037:secret:ExplorerService/testnet-lcBuyc
serverless_stage: testnet
docker_image_tag: testnet-${{ github.sha }}-${{ needs.init.outputs.timestamp }}
# XXX: Some env vars come from the secret https://eu-central-1.console.aws.amazon.com/secretsmanager/secret?name=ExplorerService%2Ftestnet®ion=eu-central-1
api_port: 3001
hathor_core_url: https://node.explorer.testnet.hathor.network
hathor_nodes: https://node1.testnet.hathor.network,https://node.explorer.testnet.hathor.network
redis_key_prefix: hathor-explorer-service-testnet
redis_port: 6379
redis_db: 0
metadata_bucket: hathor-explorer-metadata-testnet
cors_allowed_regex: https?:\/\/([a-z0-9\-]*\.){0,5}hathor\.network
elastic_index: testnet-token
elastic_tx_index: testnet-tx
elastic_token_balances_index: testnet-token-balance
healthcheck_hathor_core_enabled: true
healthcheck_wallet_service_db_enabled: true
healthcheck_elasticsearch_enabled: true
healthcheck_redis_enabled: true
# XXX: We've deployed this as a perfect copy of the nano-testnet environment, just to change the CORS regex
deploy-nano-testnet-dev:
needs: [init, dependencies]
if: ${{ needs.init.outputs.environment == 'nano-testnet-dev' }}
uses: ./.github/workflows/deploy-reusable.yml
with:
aws_region: eu-central-1
aws_iam_role: arn:aws:iam::471112952246:role/ExplorerServiceGitHubActionsRole
aws_secret_arn: arn:aws:secretsmanager:eu-central-1:471112952246:secret:ExplorerService/nano-testnet-MWxHpF
serverless_stage: nano-dev
# XXX: Some env vars come from the secret https://eu-central-1.console.aws.amazon.com/secretsmanager/secret?name=ExplorerService%2Fnano-testnet®ion=eu-central-1
api_port: 3001
hathor_core_url: https://hathorplay.nano-testnet.hathor.network
hathor_nodes: https://node1.nano-testnet.hathor.network
redis_key_prefix: hathor-explorer-service-nano-testnet
redis_port: 6379
redis_db: 1
metadata_bucket: hathor-explorer-metadata-nano-testnet
cors_allowed_regex: .*
elastic_index: nano-testnet-token
elastic_tx_index: nano-testnet-tx
elastic_token_balances_index: nano-testnet-token-balance
healthcheck_hathor_core_enabled: true
healthcheck_wallet_service_db_enabled: true
healthcheck_elasticsearch_enabled: true
healthcheck_redis_enabled: true
deploy-nano-testnet:
needs: [init, dependencies]
if: ${{ needs.init.outputs.environment == 'testnet' }}
uses: ./.github/workflows/deploy-reusable.yml
with:
aws_region: eu-central-1
aws_iam_role: arn:aws:iam::471112952246:role/ExplorerServiceGitHubActionsRole
aws_secret_arn: arn:aws:secretsmanager:eu-central-1:471112952246:secret:ExplorerService/nano-testnet-MWxHpF
serverless_stage: nano
# XXX: Some env vars come from the secret https://eu-central-1.console.aws.amazon.com/secretsmanager/secret?name=ExplorerService%2Fnano-testnet®ion=eu-central-1
api_port: 3001
hathor_core_url: https://hathorplay.nano-testnet.hathor.network
hathor_nodes: https://node1.nano-testnet.hathor.network
redis_key_prefix: hathor-explorer-service-nano-testnet
redis_port: 6379
redis_db: 1
metadata_bucket: hathor-explorer-metadata-nano-testnet
cors_allowed_regex: https?:\/\/([a-z0-9\-]*\.){0,5}hathor\.network
elastic_index: nano-testnet-token
elastic_tx_index: nano-testnet-tx
elastic_token_balances_index: nano-testnet-token-balance
healthcheck_hathor_core_enabled: true
healthcheck_wallet_service_db_enabled: true
healthcheck_elasticsearch_enabled: true
healthcheck_redis_enabled: true
deploy-ekvilibro-testnet:
needs: [init, dependencies]
if: ${{ needs.init.outputs.environment == 'testnet' }}
uses: ./.github/workflows/deploy-reusable.yml
with:
aws_region: eu-central-1
aws_iam_role: arn:aws:iam::730335348496:role/ExplorerServiceGitHubActionsRole
aws_secret_arn: arn:aws:secretsmanager:eu-central-1:730335348496:secret:ExplorerService/ekvilibro-testnet-DaDPgT
serverless_stage: ekvilibro
# XXX: Some env vars come from the secret https://eu-central-1.console.aws.amazon.com/secretsmanager/secret?name=ExplorerService%2Fekvilibro-testnet®ion=eu-central-1
api_port: 3001
hathor_core_url: https://node-side-dag.ekvilibro-testnet.hathor.network
hathor_nodes: https://node-side-dag.ekvilibro-testnet.hathor.network
redis_key_prefix: hathor-explorer-service-ekvilibro-testnet
redis_port: 6379
redis_db: 0
metadata_bucket: hathor-explorer-metadata-ekvilibro-testnet
cors_allowed_regex: https?:\/\/([a-z0-9\-]*\.){0,5}hathor\.network
elastic_index: ekvilibro-testnet-token
elastic_tx_index: ekvilibro-testnet-tx
elastic_token_balances_index: ekvilibro-testnet-token-balance
healthcheck_hathor_core_enabled: true
healthcheck_wallet_service_db_enabled: true
healthcheck_elasticsearch_enabled: true
healthcheck_redis_enabled: true
deploy-ekvilibro-mainnet:
needs: [init, dependencies]
if: ${{ needs.init.outputs.environment == 'mainnet' }}
uses: ./.github/workflows/deploy-reusable.yml
with:
aws_region: eu-central-1
aws_iam_role: arn:aws:iam::730335348496:role/ExplorerServiceGitHubActionsRole
aws_secret_arn: arn:aws:secretsmanager:eu-central-1:730335348496:secret:ExplorerService/ekvilibro-mainnet-yvc3s2
serverless_stage: ekvi-main
# XXX: Some env vars come from the secret https://eu-central-1.console.aws.amazon.com/secretsmanager/secret?name=ExplorerService%2Fekvilibro-mainnet®ion=eu-central-1
api_port: 3001
hathor_core_url: https://node-side-dag.ekvilibro-mainnet.hathor.network
hathor_nodes: https://node-side-dag.ekvilibro-mainnet.hathor.network
redis_key_prefix: hathor-explorer-service-ekvilibro-mainnet
redis_port: 6379
redis_db: 0
metadata_bucket: hathor-explorer-metadata-ekvilibro-mainnet
cors_allowed_regex: https?:\/\/([a-z0-9\-]*\.){0,5}hathor\.network
elastic_index: ekvilibro-mainnet-token
elastic_tx_index: ekvilibro-mainnet-tx
elastic_token_balances_index: ekvilibro-mainnet-token-balance
healthcheck_hathor_core_enabled: true
healthcheck_wallet_service_db_enabled: true
healthcheck_elasticsearch_enabled: true
healthcheck_redis_enabled: true
deploy-mainnet:
needs: [init, dependencies]
if: ${{ needs.init.outputs.environment == 'mainnet' }}
uses: ./.github/workflows/deploy-reusable.yml
with:
aws_region: eu-central-1
aws_iam_role: arn:aws:iam::769498303037:role/ExplorerServiceGitHubActionsRole
aws_secret_arn: arn:aws:secretsmanager:eu-central-1:769498303037:secret:ExplorerService/mainnet-DYYHfn
serverless_stage: mainnet
docker_image_tag: ${GITHUB_REF#refs/*/}
# XXX: Some env vars come from the secret https://eu-central-1.console.aws.amazon.com/secretsmanager/secret?name=ExplorerService%2Fmainnet®ion=eu-central-1
api_port: 3001
hathor_core_url: https://node.explorer.hathor.network
hathor_nodes: https://node.explorer.hathor.network,https://node1.mainnet.hathor.network,https://node2.mainnet.hathor.network
redis_key_prefix: hathor-explorer-service-mainnet
redis_port: 6379
redis_db: 0
metadata_bucket: hathor-explorer-metadata-mainnet
cors_allowed_regex: https?:\/\/([a-z0-9\-]*\.){0,5}hathor\.network
elastic_index: mainnet-token
elastic_tx_index: mainnet-tx
elastic_token_balances_index: mainnet-token-balance
healthcheck_hathor_core_enabled: true
healthcheck_wallet_service_db_enabled: true
healthcheck_elasticsearch_enabled: true
healthcheck_redis_enabled: true