Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 16 additions & 18 deletions .github/workflows/deploy_switch_ensnode_environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ on:

jobs:
switch-environment:
runs-on: blacksmith-4vcpu-ubuntu-2204
# NOTE: this needs to run on GH runner because of some obscure skopeo permissions thing
runs-on: ubuntu-latest
name: Switch Environment to ${{ inputs.target }}
env:
TARGET_ENVIRONMENT: ${{ inputs.target }}
REDIS_URL: ${{ secrets.TRAEFIK_REDIS_URL }}
Expand All @@ -26,38 +28,29 @@ jobs:
with:
fetch-depth: 1

- name: Print switch target
run: |
echo "Switching to: $TARGET_ENVIRONMENT"

- name: Calculate env variables
run: |
case "$TARGET_ENVIRONMENT" in
"green")
echo "SLACK_TITLE=':large_green_circle: GREEN Environment Activated" >> "$GITHUB_ENV"
echo "SLACK_TITLE=:large_green_circle: GREEN Environment Activated" >> "$GITHUB_ENV"
echo "RAILWAY_ENVIRONMENT_ID=${{ secrets.GREEN_RAILWAY_ENVIRONMENT_ID }}" >> $GITHUB_ENV
;;
"blue")
echo "SLACK_TITLE=':large_blue_circle: BLUE Environment Activated" >> "$GITHUB_ENV"
echo "SLACK_TITLE=:large_blue_circle: BLUE Environment Activated" >> "$GITHUB_ENV"
echo "RAILWAY_ENVIRONMENT_ID=${{ secrets.BLUE_RAILWAY_ENVIRONMENT_ID }}" >> $GITHUB_ENV
;;
*)
echo "SLACK_TITLE=':large_red_circle: Unrecognized environment activated" >> "$GITHUB_ENV"
echo "SLACK_TITLE=:large_red_circle: Unrecognized Environment Activated" >> "$GITHUB_ENV"
esac

- name: Install redis-cli
run: |
sudo apt install redis-tools

- name: Promote ENSAdmin Deployment
- name: Promote ENSAdmin Vercel Deployment
run: |
chmod +x ./.github/scripts/promote_ensadmin.sh
./.github/scripts/promote_ensadmin.sh

- name: Switch Traefik routers
- name: Switch Traefik Routing
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"
sudo apt install redis-tools

# ALPHA
redis-cli -u $REDIS_URL SET traefik/http/routers/alpha-api-router/service "${TARGET_ENVIRONMENT}-alpha-api"
Expand All @@ -67,14 +60,19 @@ jobs:
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"

# 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"

# 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"

- uses: ./.github/actions/send_slack_notification
- name: Send Slack Notification
uses: ./.github/actions/send_slack_notification
with:
slack_webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
slack_title: ${{ env.SLACK_TITLE }}
Expand Down