I’ve had the worst experience I can imagine trying to deploy a Phoenix app to Fly.io using a “hobby” account. I hope my experience isn’t typical.
Yesterday, I was able to launch an app, but I couldn’t redeploy after making changes. When I tried, I got this:
Running i-know-test release_command: /app/bin/migrate
release_command 9185491f10d983 completed successfully
Updating existing machines in 'i-know-test' with rolling strategy
[1/2] Updating 9080117ae36387 [app]
Error: failed to update VM 9080117ae36387: You have reached the maximum number of machines for this app.
To unlock more features please add credit to your org (using an admin account) from your billing page:
https://fly.io/dashboard/cirvine/billing
Or contact us at billing@fly.io and we'll take a closer look at your account.
After posting to the Elixir forum, reading the docs, and other misc frustrations, I wildly speculated that my account might be corrupted and decided to delete it, create a new account and then try again. Big mistake I guess.
Now I am not even able to launch a new app. I get to the deployment phase of the launch and get message saying that I need to authenticate, even though that was the first thing that I did. See below.
% fly launch
Creating app in /Users/charlesirvine/src/my_app
Scanning source code
Resolving Hex dependencies...
Resolution completed in 0.171s
Unchanged:
castore 1.0.2
cowboy 2.10.0
cowboy_telemetry 0.4.0
cowlib 2.12.1
db_connection 2.5.0
decimal 2.1.1
ecto 3.10.1
ecto_sql 3.10.1
esbuild 0.7.0
expo 0.4.1
file_system 0.2.10
finch 0.16.0
floki 0.34.2
gettext 0.22.1
hpax 0.1.2
jason 1.4.0
mime 2.0.3
mint 1.5.1
nimble_options 1.0.2
nimble_pool 1.0.0
phoenix 1.7.2
phoenix_ecto 4.4.1
phoenix_html 3.3.1
phoenix_live_dashboard 0.7.2
phoenix_live_reload 1.4.1
phoenix_live_view 0.18.18
phoenix_pubsub 2.1.1
phoenix_template 1.0.1
plug 1.14.2
plug_cowboy 2.6.1
plug_crypto 1.2.5
postgrex 0.17.1
ranch 1.8.0
swoosh 1.10.2
tailwind 0.2.0
telemetry 1.2.1
telemetry_metrics 0.6.1
telemetry_poller 1.0.0
websock 0.5.1
websock_adapter 0.5.1
All dependencies are up to date
[info] Configuration :server was not enabled for MyAppWeb.Endpoint, http/https services won't start
Detected a Phoenix app
? Choose an app name (leave blank to generate one):
automatically selected personal organization: crirvine
Some regions require a paid plan (fra, maa).
See https://fly.io/plans to set up a plan.
? Choose a region for deployment: Dallas, Texas (US) (dfw)
App will use 'dfw' region as primary
Created app 'bold-night-7881' in organization 'personal'
Admin URL: https://fly.io/apps/bold-night-7881
Hostname: bold-night-7881.fly.dev
Set secrets on bold-night-7881: SECRET_KEY_BASE
? Would you like to set up a Postgresql database now? Yes
? Select configuration: Development - Single node, 1x shared CPU, 256MB RAM, 1GB disk
? Scale single node pg to zero after one hour? Yes
Creating postgres cluster in organization personal
Creating app...
Setting secrets on app bold-night-7881-db...
Provisioning 1 of 1 machines with image flyio/postgres-flex:15.3@sha256:814448113018b101e900c1fb875a75f98178f0978ac0715a7638bfb8a11bb59d
Waiting for machine to start...
Machine 6e82dd02a41298 is created
==> Monitoring health checks
Waiting for 6e82dd02a41298 to become healthy (started, 3/3)
Postgres cluster bold-night-7881-db created
Username: postgres
Password: ft6xIKT4NFZ4Yq8
Hostname: bold-night-7881-db.internal
Flycast: fdaa:2:2f8a:0:1::5
Proxy port: 5432
Postgres port: 5433
Connection string: postgres://postgres:ft6xIKT4NFZ4Yq8@bold-night-7881-db.flycast:5432
Save your credentials in a secure place -- you won't be able to see them again!
Connect to postgres
Any app within the crirvine organization can connect to this Postgres using the above connection string
Now that you've set up Postgres, here's what you need to understand: https://fly.io/docs/postgres/getting-started/what-you-should-know/
Failed attaching bold-night-7881 to the Postgres cluster bold-night-7881-db: can't build tunnel for personal: You must be authenticated to view this..
Try attaching manually with 'fly postgres attach --app bold-night-7881 bold-night-7881-db'
Error creating Postgresql database. Be warned that this may affect deploys
? Would you like to set up an Upstash Redis database now? No
Preparing system for Elixir builds
Installing application dependencies
Running Docker release generator
Wrote config file fly.toml
? Would you like to deploy now? Yes
Validating /Users/charlesirvine/src/my_app/fly.toml
Platform: machines
✓ Configuration is valid
==> Building image
WARN Failed to start remote builder heartbeat: failed building options: You must be authenticated to view this.
Error: failed to fetch an image or build from source: error connecting to docker: failed building options: You must be authenticated to view this.