Remote deploy errors when deploying multiple apps

Hello there!

We just migrated all our apps from heroku to fly (nice!). To deploy these apps we added a GH workflow that queries Fly for apps matching a certain naming pattern and create a matrix that we can then use to run the deploy command for each app.

jobs:
  build-app-matrix:
    name: Query Fly site apps
    runs-on: ubuntu-latest
    outputs:
      matrix: ${{ steps.set-matrix.outputs.app }}
    steps:
      - uses: actions/checkout@v2
      - uses: superfly/flyctl-actions/setup-flyctl@master
      - id: set-matrix
        run: echo "::set-output name=app::$(flyctl apps list -j | jq -c 'map( select(.ID | contains("org-site-stage-")) | .ID)')"

Then when the workflow file starts to deploy each app in that matrix

flyctl deploy --remote-only -a ${{ matrix.app }}

We noticed that in some cases the deployment would break with this error

Run flyctl deploy --remote-only -a org-site-stage-xxx
==> Verifying app config
--> Verified app config
==> Building image
Waiting for remote builder fly-builder-silent-smoke-4697...
Error failed to fetch an image or build from source: error connecting to docker: failed building options: server returned a non-200 status code: 502

We noticed that this happens only when we try to deploy several apps at once. We have a couple of other repos that handle remote deploys of one or two apps just fine.

We found this issue but apparently we couldn’t see any solution. For the time being we bundled in Docker in our workflow files, however, we would like to move to using Fly remote builder.

Is there any solution to this?

Sounds like it’s being caused by concurrent remote builds. As found by other users e.g this thread:

(Note that we tried to run these concurrently but that threw an error)

As I replied there, if you want concurrent remote builds it seems you would need one of Fly’s larger paid plans. For example their Scale plan includes 10 concurrent remote builds. Check Plan Pricing · Fly