@hi.kanily It turns out that you can’t set the builder’s region. They spawn in the region closest to you geographically. You also can’t set the app’s region because it’s tied to the region of the volume.
I think allowing region override for builders should be an option for cases like this.
Anyway, I came up with a hack you can try to workaround this:
-
Trigger a build:
fly deploy ... --region sjc --build-only
Once it shows “WARN Failed to start remote builder heartbeat” or “waiting for remote builder…”,
CTRL+C
it. You only want the builder to spawn. (I’m usingsjc
region but you can use any, remember to replace it in the steps below if you change it!) -
Grab the builder app name:
fly apps list
The builder app starts with
fly-builder-...
. -
Grab the builder app’s machine ID:
fly machine list -a $BUILDER_APP_NAME
There should only be one machine, in the
sin
region. Copy that ID. -
Clone the machine into a different region:
fly machine clone $MACHINE_ID_FROM_ABOVE --region sjc -a $BUILDER_APP_NAME
This will clone the machine and its volume into the
sjc
region. -
Verify that
sjc
is in the app’s region pool:fly regions list -a $BUILDER_APP_NAME Region Pool: sin sjc Backup Region:
(Don’t bother with
fly regions set ..
, it won’t go through because of the attached volume insin
.) -
Monitor the logs of your builder, it should hint that
sjc
is up and running:fly logs -a $BUILDER_APP_NAME 2023-01-30T06:14:00Z app[732870d7be5585] sjc [info]time="2023-01-30T06:14:00.825682582Z" level=debug msg="checking docker activity"
-
Trigger your build again, watch the logs.
sjc
should be the one performing the build. Thesin
builder will be stuck, butsjc
should be proceeding normally.
To clean this up, fly apps destroy $BUILDER_APP_NAME
will remove the apps/machines/volumes for you.
Hope this helps!
And just out of curiosity, why are you depending on remote-only builds?
edit: phrasing + question