-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathdeploy_switch_ensnode_environment.yml
More file actions
73 lines (61 loc) · 2.7 KB
/
deploy_switch_ensnode_environment.yml
File metadata and controls
73 lines (61 loc) · 2.7 KB
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
name: "Deploy: Switch ENSNode Environment"
on:
workflow_dispatch:
inputs:
target:
description: "New main environment (green or blue)"
required: true
type: choice
options:
- green
- blue
jobs:
switch-environment:
runs-on: blacksmith-4vcpu-ubuntu-2204
env:
TARGET_ENVIRONMENT: ${{ inputs.target }}
REDIS_URL: ${{ secrets.TRAEFIK_REDIS_URL }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Print switch target
run: |
echo "Switching to: $TARGET_ENVIRONMENT"
- name: Install redis-cli
run: |
sudo apt install redis-tools
- name: Switch Traefik routers
run: |
# SEPOLIA
redis-cli -u $REDIS_URL SET traefik/http/routers/sepolia-api-router/service "${TARGET_ENVIRONMENT}-sepolia-api"
redis-cli -u $REDIS_URL SET traefik/http/routers/sepolia-indexer-router/service "${TARGET_ENVIRONMENT}-sepolia-indexer"
# ALPHA
redis-cli -u $REDIS_URL SET traefik/http/routers/alpha-api-router/service "${TARGET_ENVIRONMENT}-alpha-api"
redis-cli -u $REDIS_URL SET traefik/http/routers/alpha-indexer-router/service "${TARGET_ENVIRONMENT}-alpha-indexer"
# MAINNET
redis-cli -u $REDIS_URL SET traefik/http/routers/mainnet-api-router/service "${TARGET_ENVIRONMENT}-mainnet-api"
redis-cli -u $REDIS_URL SET traefik/http/routers/mainnet-indexer-router/service "${TARGET_ENVIRONMENT}-mainnet-indexer"
# HOLESKY
redis-cli -u $REDIS_URL SET traefik/http/routers/holesky-api-router/service "${TARGET_ENVIRONMENT}-holesky-api"
redis-cli -u $REDIS_URL SET traefik/http/routers/holesky-indexer-router/service "${TARGET_ENVIRONMENT}-holesky-indexer"
# ENSRAINBOW
redis-cli -u $REDIS_URL SET traefik/http/routers/ensrainbow-api-router/service "${TARGET_ENVIRONMENT}-ensrainbow-api"
- name: Calculate env variables
run: |
case "$TARGET_ENVIRONMENT" in
"green")
echo "SLACK_TITLE=':large_green_circle: GREEN environment activated" >> "$GITHUB_ENV"
;;
"blue")
echo "SLACK_TITLE=':large_blue_circle: BLUE environment activated" >> "$GITHUB_ENV"
;;
*)
echo "SLACK_TITLE=':large_red_circle: Unrecognized environment activated" >> "$GITHUB_ENV"
esac
- uses: ./.github/actions/send_slack_notification
with:
slack_webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
slack_title: ${{ env.SLACK_TITLE }}
slack_message: "✅ Switch ENSNode environment completed"