Kamal setup fails because docker login fails on server
When I try to run kamal setup It connects to Dockerhub fine on my local machine and starts the process.
But when it starts to pull from dockerhub on the server it fails to finish because it fails on docker stop
Manual docker login with the exact same username and password works successfully when SSH'd directly into the server.
I think this might be a secondary issue because the remote server isn't able to login to Dockerhub
No value provided for required options '--account'
ERROR Failed to boot web on
ERROR (NoMethodError): Exception while executing on host: undefined method 'chomp' for nil
Also when I run kamal app exec -i "/bin/bash" it fails
kamal app exec -i "/bin/bash"
Get most recent version available as an image...
Launching interactive command with version latest via SSH from new container on ..
INFO [10a0ca8c] Running docker login -u [REDACTED] -p [REDACTED] on
INFO [10a0ca8c] Finished in 1.206 seconds with exit status 0 (successful).
docker: open .kamal/apps/hdlife/env/roles/web.env: no such file or directory
Run 'docker run --help' for more information
Connection to closed.
Kamal Version: Kamal 2.7.0 Operating System (Local Machine): macOS 15.5 Remote Server OS: Ubuntu 24.04
Logs
ERROR Could not fetch logs for 85c5f95901e85c6eda64c32f4bc60102989274f0
INFO [532bfa38] Running docker container ls --all --filter name=^hdlife-web-85c5f95901e85c6eda64c32f4bc60102989274f0$ --quiet | xargs docker stop on
DEBUG [532bfa38] Command: docker container ls --all --filter name=^hdlife-web-85c5f95901e85c6eda64c32f4bc60102989274f0$ --quiet | xargs docker stop
DEBUG [532bfa38] docker: 'docker stop' requires at least 1 argument
Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...]
See 'docker stop --help' for more information
INFO [532bfa38] Finished in 0.249 seconds with exit status 123 (failed).
Finished all in 34.2 seconds
Releasing the deploy lock...
DEBUG [3af496b9] Running /usr/bin/env rm .kamal/lock-hdlife/details && rm -r .kamal/lock-hdlife on
DEBUG [3af496b9] Command: /usr/bin/env rm .kamal/lock-hdlife/details && rm -r .kamal/lock-hdlife
DEBUG [3af496b9] Finished in 0.200 seconds with exit status 0 (successful).
Finished all in 36.6 seconds
ERROR (NoMethodError): Exception while executing on host: undefined method 'chomp' for nil
Okay I think I figured it out! I had a typo in the kamal secrets file (I thought there would be some checks on that file formatting) Also when I put in the credential directly in the deploy file to test it never worked, but grabbing from 1 password worked.
I've followed the instructions on this Youtube video but now my error is the database can't resolve. Deploying with Kamal 2.0 | Rails 8 Unpacked https://www.youtube.com/watch?v=sPUk9-1WVXI
This video says to put this in the deploy.yml
DB_HOST: DB_HOST
And then paste the connection string from Digital Ocean into your 1password as DB_HOST
I'm not set on any specific setup, I just want this dang app to deploy. I've deployed many rails apps in the past but this new version is so complicated. When I connect to the database locally with the host the connection is fine.
PG::ConnectionBad: could not translate host name "postgresql://doadmin:[email protected]:25060/defaultdb?sslmode=require" to address: Name or service not known (PG::ConnectionBad)
Can someone please help me figure out what is happening here?
I used another way of passing all the database variables explicitly and that seems to work, but now it just times out.
ERROR (SSHKit::Command::Failed): Exception while executing on host: docker exit status: 1 docker stdout: Nothing written docker stderr: Error: target failed to become healthy within configured timeout (30s)
Check the logs of that new container, it might have something like an error of your application in it, causing it to not come up and become healthy.