Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: multi regional deployment #208

Merged
merged 1 commit into from
Aug 16, 2023
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
35 changes: 32 additions & 3 deletions .github/workflows/deploy_testnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

env:
AWS_REGION: '${{ secrets.AWS_REGION }}'
AWS_REGION_2: '${{ secrets.AWS_REGION_2 }}'
ENVIRONMENT: 'TESTNET'
REGISTRY: 'ghcr.io'
TAG: 'stable'
Expand Down Expand Up @@ -77,7 +78,7 @@ jobs:
repository: sygmaprotocol/devops
token: ${{ secrets.GHCR_TOKEN }}

- name: render jinja2 templates to task definition json files
- name: region_1
uses: cuchi/jinja2-action@v1.2.0
with:
template: 'relayers/ecs/task_definition-${{ env.ENVIRONMENT }}.j2'
Expand All @@ -87,18 +88,46 @@ jobs:
relayerId=${{ matrix.relayer_id }}
awsAccountId=${{ env.AWS_TESTNET }}
awsRegion=${{ env.AWS_REGION }}
awsEfs=${{ secrets.TESTNET_EFS_1 }}

- name: configure aws credentials
- name: region_2
uses: cuchi/jinja2-action@v1.2.0
with:
template: 'relayers/ecs/task_definition-${{ env.ENVIRONMENT }}.j2'
output_file: 'relayers/ecs/task_definition-${{ matrix.relayer_id }}_${{ env.ENVIRONMENT }}_2.json'
data_format: json
variables: |
relayerId=${{ matrix.relayer_id }}
awsAccountId=${{ env.AWS_TESTNET }}
awsRegion=${{ env.AWS_REGION_2 }}
awsEfs=${{ secrets.TESTNET_EFS_2 }}

- name: configure aws credentials region_1
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::${{ env.AWS_TESTNET }}:role/github-actions-${{ env.ENVIRONMENT }}-chainbridge
aws-region: ${{ env.AWS_REGION }}
role-session-name: GithubActions

- name: deploy task definition
- name: deploy region_1 task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: 'relayers/ecs/task_definition-${{ matrix.relayer_id }}_${{ env.ENVIRONMENT }}.json'
service: 'relayer-${{ matrix.relayer_id }}-service-${{ env.ENVIRONMENT }}'
cluster: 'relayer-${{ env.ENVIRONMENT }}'
wait-for-service-stability: true

- name: configure aws credentials region_2
uses: aws-actions/configure-aws-credentials@v1
with:
role-to-assume: arn:aws:iam::${{ env.AWS_TESTNET }}:role/github-actions-${{ env.ENVIRONMENT }}-chainbridge
aws-region: ${{ env.AWS_REGION_2 }}
role-session-name: GithubActions

- name: deploy region_2 task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: 'relayers/ecs/task_definition-${{ matrix.relayer_id }}_${{ env.ENVIRONMENT }}_2.json'
service: 'relayer-${{ matrix.relayer_id }}-service-${{ env.ENVIRONMENT }}'
cluster: 'relayer-${{ env.ENVIRONMENT }}'
wait-for-service-stability: true
Loading