From b50742e5092c1f4a7b39fea618b3f47da4221db3 Mon Sep 17 00:00:00 2001 From: Yusuke Nakamura Date: Fri, 13 Dec 2024 17:59:37 +0900 Subject: [PATCH 1/2] Deploy ecs and apprunner in parallelism (staging) --- .github/workflows/staging_deploy.yml | 37 ++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/.github/workflows/staging_deploy.yml b/.github/workflows/staging_deploy.yml index 3415cf06..dd1fe173 100644 --- a/.github/workflows/staging_deploy.yml +++ b/.github/workflows/staging_deploy.yml @@ -36,7 +36,7 @@ jobs: cache-to: type=gha,mode=max tags: ${{ steps.meta.outputs.tags }} - deploy: + deploy_migration: runs-on: ubuntu-latest concurrency: group: "staging-deploy" @@ -48,7 +48,6 @@ jobs: env: AWS_REGION: us-west-2 steps: - - run: sudo apt-get update && sudo apt-get install jsonnet - uses: actions/checkout@v4 - uses: aws-actions/configure-aws-credentials@v4 with: @@ -59,7 +58,41 @@ jobs: with: version: latest - run: ecspresso run --config deploy/staging/ecspresso.jsonnet --ext-str IMAGE_SHA=${{ github.sha }} --overrides-file deploy/staging/runtask-db-migrate.jsonnet + deploy_worker: + runs-on: ubuntu-latest + needs: ["deploy_migration"] + permissions: + id-token: write + contents: read + env: + AWS_REGION: us-west-2 + steps: + - uses: actions/checkout@v4 + - uses: aws-actions/configure-aws-credentials@v4 + with: + aws-region: us-west-2 + role-skip-session-tagging: false + role-to-assume: "arn:aws:iam::861452569180:role/ConferenceAppDeployer" + - uses: kayac/ecspresso@v2 + with: + version: latest - run: ecspresso deploy --config deploy/staging/ecspresso.jsonnet --ext-str IMAGE_SHA=${{ github.sha }} + deploy_app: + runs-on: ubuntu-latest + needs: ["deploy_migration"] + permissions: + id-token: write + contents: read + env: + AWS_REGION: us-west-2 + steps: + - run: sudo apt-get update && sudo apt-get install jsonnet + - uses: actions/checkout@v4 + - uses: aws-actions/configure-aws-credentials@v4 + with: + aws-region: us-west-2 + role-skip-session-tagging: false + role-to-assume: "arn:aws:iam::861452569180:role/ConferenceAppDeployer" - run: | SERVICE_ARN=arn:aws:apprunner:us-west-2:861452569180:service/conference-app-staging/acfd5f3cb79044cf96a2d70c481da77a until [ $(aws apprunner describe-service --service-arn ${SERVICE_ARN} --output json | jq -r '.Service.Status') = RUNNING ] From 1f5d9d9e9111c2aa9be3c6331ad2d733a02842ce Mon Sep 17 00:00:00 2001 From: Yusuke Nakamura Date: Fri, 13 Dec 2024 18:13:05 +0900 Subject: [PATCH 2/2] Deploy ecs and apprunner in parallelism (production) --- .github/workflows/deploy.yml | 37 ++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b88735ba..57fefd93 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -35,7 +35,7 @@ jobs: cache-to: type=gha,mode=max tags: ${{ steps.meta.outputs.tags }} - deploy: + deploy_migration: runs-on: ubuntu-latest concurrency: group: "deploy" @@ -47,7 +47,6 @@ jobs: env: AWS_REGION: us-west-2 steps: - - run: sudo apt-get update && sudo apt-get install jsonnet - uses: actions/checkout@v4 - uses: aws-actions/configure-aws-credentials@v4 with: @@ -58,7 +57,41 @@ jobs: with: version: latest - run: ecspresso run --config deploy/ecspresso.jsonnet --ext-str IMAGE_SHA=${{ github.sha }} --overrides-file deploy/runtask-db-migrate.jsonnet + deploy_worker: + runs-on: ubuntu-latest + needs: ["deploy_migration"] + permissions: + id-token: write + contents: read + env: + AWS_REGION: us-west-2 + steps: + - uses: actions/checkout@v4 + - uses: aws-actions/configure-aws-credentials@v4 + with: + aws-region: us-west-2 + role-skip-session-tagging: false + role-to-assume: "arn:aws:iam::861452569180:role/ConferenceAppDeployer" + - uses: kayac/ecspresso@v2 + with: + version: latest - run: ecspresso deploy --config deploy/ecspresso.jsonnet --ext-str IMAGE_SHA=${{ github.sha }} + deploy_app: + runs-on: ubuntu-latest + needs: ["deploy_migration"] + permissions: + id-token: write + contents: read + env: + AWS_REGION: us-west-2 + steps: + - run: sudo apt-get update && sudo apt-get install jsonnet + - uses: actions/checkout@v4 + - uses: aws-actions/configure-aws-credentials@v4 + with: + aws-region: us-west-2 + role-skip-session-tagging: false + role-to-assume: "arn:aws:iam::861452569180:role/ConferenceAppDeployer" - run: | SERVICE_ARN=arn:aws:apprunner:us-west-2:861452569180:service/conference-app/37cc4e1e45894229965d668879123b40 until [ $(aws apprunner describe-service --service-arn ${SERVICE_ARN} --output json | jq -r '.Service.Status') = RUNNING ]