Copilot-cli: How can I deploy multiple copilot services simultaneously

Created on 27 Jun 2021  ·  4Comments  ·  Source: aws/copilot-cli

Hi, there. I create my deployment pipeline by GitHub Actions to customize db migration timing and with maintenance or without maintenance.

スクリーンショット 2021-06-26 21 01 22

I do parallel deploy copilot services using matrix feature in GitHub Actions to reduce deployment time because of Load Balanced Web Service deployment take time 5 ~ 10 minutes.
GitHub Actions definition: https://github.com/shgtkshruch/chronos/blob/main/.github/workflows/deploy.yml

...
deploy-services:
  runs-on: ubuntu-latest
  timeout-minutes: 15
  strategy:
    matrix:
      # copilot service list
      service: [rails, admin-rails]
  steps:
  - name: Checkout
    uses: actions/checkout@v2
  - name: Configure AWS Credentials
    uses: aws-actions/configure-aws-credentials@v1
  - name: Setup AWS Copilot
     run: ...
  - name: Deploy Rails service
    run: |
      copilot svc deploy \
        --app chronos \
        --env ${{ github.event.inputs.env }} \
        --name ${{ matrix.service }}
...

But some deployments that create/update environment level resources same time was failed. For example, initial deployment of Load Balanced Web Service could not simultaneously.
How can I deploy multiple copilot services simultaneously without errors?

typbug

Most helpful comment

Hello @shgtkshruch. Yes it should be fixed by #2513, which will be included in our next release soon!

All 4 comments

Hi @shgtkshruch!

You should be able to run copilot svc deploy at the same time. Although each of these services may try to update the environment stack, under the hood our custom resource that does this job will wait until the previous update is finished to start another update.

Would you mind telling me what errror are you seeing?

Hi @Lou1415926. Thank you quick response!
I set custom domain to multiple services as http.alias field, then deploy same time this error occur bellow.

- Updating the infrastructure for stack chronos-dev-frontend                  [update rollback complete]  [1630.1s]
  The following resource(s) failed to update: [EnvControllerAction].                                      
  - Update your environment's shared resources                                [update complete]           [79.2s]
    - Request and validate an ACM certificate for your domain                 [delete complete]           [180.1s]
    - Add an A-record to the hosted zone for the domain alias                 [update complete]           [97.1s]
  - An ECS service to run and maintain your tasks in the environment cluster  [not started]               
  - An ECS task definition to group your containers and run them on ECS       [not started]               
25h✘ deploy service: stack chronos-dev-frontend did not complete successfully and exited with status UPDATE_ROLLBACK_COMPLETE

Is this problem fixed this PR https://github.com/aws/copilot-cli/pull/2513?
I try multiple service deploy without custom domain with http.alias, this deploy is success.

Hello @shgtkshruch. Yes it should be fixed by #2513, which will be included in our next release soon!

Heya we fixed this in our latest release v1.8.2. Thank you for reporting this issue ❤️

Was this page helpful?
0 / 5 - 0 ratings