We’re working to migrate the Fly Apps platform to Machines. We’re calling this Apps v2. Apps v1 are the apps that use Nomad.
The first big step will be making new apps use the machines platform instead of nomad. There’s a bunch of small steps to get there. Today we’re sharing a prerelease and PR that improves fly deploy
for apps with machines.
Install the prerelease or build the PR to try out the new fly deploy
behavior:
To install the prerelease:
curl -L https://fly.io/install.sh | sh -s -- prerelease
fly version
fly v0.0.451-pre-1 darwin/arm64 Commit: 8a0f2ae8 BuildDate: 2023-01-13T23:46:04Z
Try it out and let us know what you think! We’re looking for bugs we can squash, missing features, things you’d like see. Let us know in this thread.
Getting started
You’ll need an app that has machines in it and hasn’t been launch on nomad. If you don’t have one lying around, you can make one with:
fly launch --image nginx
...
? Would you like to set up a Postgresql database now? No
? Would you like to set up an Upstash Redis database now? No
? Would you like to deploy now? No
fly machine run nginx
fly ips allocate-v6
The ip isn’t necessary. It helps if you want to see the nginx service running at app_name.fly.dev. Make sure to change the internal port in fly.toml to port 80.
First deploy
Then run: fly deploy
% fly deploy
...
? Deploying machines with `fly deploy` is highly experimental and may produce unexpected results. Proceed? Yes
...
WARN Found 1 machines that are not part of the Fly Apps Platform:
winter-grass-7821 machines
ID NAME STATE REGION IMAGE IP ADDRESS VOLUME CREATED LAST UPDATED
39080ddec59e87 snowy-grass-4279 started sea library/nginx:latest fdaa:0:bfcd:a7b:a6:9b78:fc9c:2 2023-01-13T21:53:14Z 2023-01-13T21:53:15Z
? Migrate 1 existing machines into Fly Apps Platform? Yes
INFO Migrating 1 machines to the Fly Apps Platform
Deploying winter-grass-7821 app with rolling strategy
Waiting for 39080ddec59e87 to have state started, currently: started
Finished deploying
You’ll be prompted to move the existing machine(s) into the Fly Apps Platform. This is a one time step.
The Fly Apps Platform is all the things it takes to run and orchestrate Fly Apps—restarts, deploys, scale, secrets, etc. Machines that are part of the Fly Apps Platform get deployed to as a group, and will be updated based on the fly.toml app configuration. We use some metadata on the machine’s config to indicate it’s part of the Fly Apps Platform.
Subsequent deploys
Subsequent deploys will update all of the machines that have the metadata indicating they are part of the Fly Apps Platform.
Other machines are simply ignored. Other machines are ones creates using fly machines run
or with the Machines API. Developer will need to manage these other machines themselves using the fly machines
commands or the Machines API.
Scaling
We don’t yet support using fly scale
to create/destroy machines in Apps v2. Right now, you’ll need add new machines to the App using fly machines clone
or the Machines API and ensure the metadata fields are included in the config of the new machines. For example, we can start 3 new machines using:
for i in $(seq 1 3) ; do
fly machine clone 39080ddec59e87
done
The next deployment will apply to all 4 machines in the app:
fly deploy
--> Verified app config
==> Building image
Searching for image 'nginx' remotely...
image found: img_wd57v5nge95v38o0
? Deploying machines with `fly deploy` is highly experimental and may produce unexpected results. Proceed? Yes
...
Deploying winter-grass-7821 app with rolling strategy
Machine e148eee9bd6789 has state: started
Machine 9185905b4e6383 has state: started
Machine 0e286039f61d86 has state: started
Machine 39080ddec59e87 has state: started
Finished deploying