From 10e4ad90c7344630c9ffb29405ffa32205ec61e2 Mon Sep 17 00:00:00 2001 From: Lucas Gabriel Vuotto Date: Wed, 9 Oct 2024 13:48:49 +0000 Subject: [PATCH 1/4] feat: add deployment for staging environment --- .github/workflows/staging.deploy.yaml | 73 +++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/staging.deploy.yaml diff --git a/.github/workflows/staging.deploy.yaml b/.github/workflows/staging.deploy.yaml new file mode 100644 index 00000000..50d72fba --- /dev/null +++ b/.github/workflows/staging.deploy.yaml @@ -0,0 +1,73 @@ +name: Deploy to Amazon ECS (staging) + +on: + push: + branches: + - develop + +env: + AWS_REGION: us-east-1 + ECR_REPOSITORY: rscoll-dev-dao-staging + ECS_CLUSTER: rscoll-dev + ECS_SERVICE: rscoll-dev-dao-staging + ECS_TASK_DEFINITION: rscoll-dev-dao-staging + CONTAINER_NAME: rscoll-dev-dao-staging + + PROFILE: XXX FIXME + +jobs: + deploy: + name: Deploy + runs-on: ubuntu-latest + environment: + name: staging + + permissions: + id-token: write + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_LOGIN_STAGING_ROLE_ARN }} + aws-region: ${{ env.AWS_REGION }} + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + + - name: Build, tag, and push image to Amazon ECR + id: build-image + env: + ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} + IMAGE_TAG: ${{ github.sha }} + run: | + # Build a docker container and + # push it to ECR so that it can + # be deployed to ECS. + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG --build-arg arg_env="$PROFILE" --build-arg NEXT_PUBLIC_BUILD_ID=${{ github.sha }} --no-cache . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG + echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" + + - name: Download task definition + run: aws ecs describe-task-definition --task-definition ${{ env.ECS_TASK_DEFINITION }} --query taskDefinition > task-definition.json + + - name: Fill in the new image ID in the Amazon ECS task definition + id: task-def + uses: aws-actions/amazon-ecs-render-task-definition@v1 + with: + task-definition: task-definition.json + container-name: ${{ env.CONTAINER_NAME }} + image: ${{ steps.build-image.outputs.image }} + + - name: Deploy Amazon ECS task definition + uses: aws-actions/amazon-ecs-deploy-task-definition@v1 + with: + task-definition: ${{ steps.task-def.outputs.task-definition }} + service: ${{ env.ECS_SERVICE }} + cluster: ${{ env.ECS_CLUSTER }} + wait-for-service-stability: true From 28e36503e75e374d2dc94c32114904d593518ed8 Mon Sep 17 00:00:00 2001 From: Lucas Gabriel Vuotto Date: Wed, 9 Oct 2024 13:49:12 +0000 Subject: [PATCH 2/4] fix: update the AWS config values for dev environment --- .github/workflows/dev.deploy.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/dev.deploy.yaml b/.github/workflows/dev.deploy.yaml index d499bbe7..6b611eaa 100644 --- a/.github/workflows/dev.deploy.yaml +++ b/.github/workflows/dev.deploy.yaml @@ -7,11 +7,11 @@ on: env: AWS_REGION: us-east-1 - ECR_REPOSITORY: dao-frontend-dev - ECS_CLUSTER: dao-frontend - ECS_SERVICE: dao-frontend-dev - ECS_TASK_DEFINITION: dao-frontend-dev - CONTAINER_NAME: dao-frontend-dev + ECR_REPOSITORY: rscoll-dev-dao-dev + ECS_CLUSTER: rscoll-dev + ECS_SERVICE: rscoll-dev-dao-dev + ECS_TASK_DEFINITION: rscoll-dev-dao-dev + CONTAINER_NAME: rscoll-dev-dao-dev PROFILE: dev From 79df5f9a3822ab301d1decb415cf0fec0876f41d Mon Sep 17 00:00:00 2001 From: Francis Rodriguez Date: Thu, 10 Oct 2024 11:24:31 -0400 Subject: [PATCH 3/4] feat: added .env.qa --- .env.qa | 15 +++++++++++++++ .github/workflows/staging.deploy.yaml | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 .env.qa diff --git a/.env.qa b/.env.qa new file mode 100644 index 00000000..8abeaed4 --- /dev/null +++ b/.env.qa @@ -0,0 +1,15 @@ +NEXT_PUBLIC_ENV=testnet +NEXT_PUBLIC_RIF_WALLET_SERVICES=https://dev.rws.app.rootstockcollective.xyz +NEXT_PUBLIC_EXPLORER=https://explorer.testnet.rootstock.io +NEXT_PUBLIC_BUILD_ID= + +NEXT_PUBLIC_RIF_ADDRESS=0x19f64674d8a5b4e652319f5e239efd3bc969a1fe +NEXT_PUBLIC_STRIF_ADDRESS=0x7C19923bac1b41e9bBD1c33815A61854beeD9b54 +NEXT_PUBLIC_GOVERNOR_ADDRESS=0x0DB02C99619bB0E6d2cBeF5545Cc968DAb724E10 +NEXT_PUBLIC_EA_NFT_ADDRESS=0xa060A65967cb9b9511E3A4ec091Aa81c6dCe6662 +NEXT_PUBLIC_MULTICALL_ADDRESS=0xcA11bde05977b3631167028862bE2a173976CA11 +NEXT_PUBLIC_GRANTS_BUCKET_ADDRESS=0xfaca664c661af7e0e630c8f92b401012cd2a30ef +NEXT_PUBLIC_GRANTS_ACTIVE_BUCKET_ADDRESS=0x2217E4d3Ae0A6E30075D1B5a7b8C1520E8009f49 +NEXT_PUBLIC_GROWTH_BUCKET_ADDRESS=0x420f39968009a0e8693a0e1bba633cd99eaffb9b +NEXT_PUBLIC_GENERAL_BUCKET_ADDRESS=0x72Ed7d7b7835Ad62B1f9b6280bAd62618aA71461 +NEXT_PUBLIC_CHAIN_ID=31 \ No newline at end of file diff --git a/.github/workflows/staging.deploy.yaml b/.github/workflows/staging.deploy.yaml index 50d72fba..f72ea3fc 100644 --- a/.github/workflows/staging.deploy.yaml +++ b/.github/workflows/staging.deploy.yaml @@ -13,7 +13,7 @@ env: ECS_TASK_DEFINITION: rscoll-dev-dao-staging CONTAINER_NAME: rscoll-dev-dao-staging - PROFILE: XXX FIXME + PROFILE: qa jobs: deploy: From 8365d5b432a9021fac2206a49451647735e68d09 Mon Sep 17 00:00:00 2001 From: Francis Rodriguez Date: Thu, 10 Oct 2024 11:27:01 -0400 Subject: [PATCH 4/4] fix: updated Dockerfile to account for new QA env --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 22c7463b..1b8f4cc6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,6 +28,8 @@ RUN if [ "$arg_env" = "testnet" ]; then \ mv .env.testnet .env.local; \ elif [ "$arg_env" = "dev" ]; then \ mv .env.dev .env.local; \ + elif [ "$arg_env" = "qa" ]; then \ + mv .env.qa .env.local; \ elif [ "$arg_env" = "mainnet" ]; then \ mv .env.prod .env.local; \ fi