I am using latest ruby with latest rails in a docker container for development. I have a dockerfile for the production environment.
I had been using sqlite3 for development and testing. It was working fine for “production” on render.com However, I just migrated to postgresql to be able to deploy on fly.io The new database adapter is working for development and testing. I did not test “production” since I am going to try that in fly.io
I installed the fly CLI in my docker container. Here is my attempt at launching:
...
==> Monitoring health checks
Waiting for 908061d4a16568 to become healthy (started, 3/3)
...
Failed attaching tabs to the Postgres cluster tabs-db: can't establish agent agent: failed to start.
Try attaching manually with 'fly postgres attach --app tabs tabs-db'
Error creating Postgres database. Be warned that this may affect deploys
Error creating Postgres cluster: can't establish agent agent: failed to start
...
Your Rails app is prepared for deployment.
Before proceeding, please review the posted Rails FAQ:
https://fly.io/docs/rails/getting-started/dockerfiles/.
Once ready: run 'fly deploy' to deploy your Rails app.
So I tried the command to connect the db – even though I don’t know what I’m doing tbh:
root@2c2ec6d2bfc6:~# fly postgres attach --app tabs tabs-db
Error: can't establish agent agent: failed to start
The agent failed to start with the following error log:
2023/12/15 21:09:47.827984 srv failed removing existing socket: lstat /root/.fly/fly-agent.sock: invalid argument
A copy of this log has been saved at /root/.fly/agent-logs/2708186817.log
root@2c2ec6d2bfc6:~# cat /root/.fly/agent-logs/2708186817.log
2023/12/15 21:09:47.827984 srv failed removing existing socket: lstat /root/.fly/fly-agent.sock: invalid argument
And a similar issue when deploying:
root@2c2ec6d2bfc6:~# fly deploy
==> Verifying app config
Validating /root/fly.toml
Platform: machines
✓ Configuration is valid
--> Verified app config
==> Building image
WARN Failed to start remote builder heartbeat: failed building options: agent: failed to start
Error: failed to fetch an image or build from source: error connecting to docker: failed building options: agent: failed to start
The agent failed to start with the following error log:
2023/12/15 21:20:08.669645 srv failed removing existing socket: lstat /root/.fly/fly-agent.sock: invalid argument
A copy of this log has been saved at /root/.fly/agent-logs/573799191.log
Placing the project directory directly into the home folder was causing some weird loop in the fly CLI – since the CLI installs itself in the home folder (I would recommend installing 3rd party software somewhere outside the home folder). So I nested it:
But I got an easy error to fix which was surprising:
This deployment will:
* create 2 "app" machines
No machines in group app, launching a new machine
-------
✖ Failed: error creating a new machine: failed to launch VM: To create more than 1 machine per app please add a payment method. https://fly.io/dashboard/…
-------
Error: error creating a new machine: failed to launch VM: To create more than 1 machine per app please add a payment method. https://fly.io/dashboard/.../billing
Please note that release commands run in their own ephemeral machine, and therefore count towards the machine limit. (Request ID: 01HHQTH11QK872PR78BNB3G835-lax)
root@1d4128c70c68:~/tabs#