kamal
kamal copied to clipboard
Kamal setup fails (version 2.0.0.rc3 from docker)
Looks like there's a problem with secrets - the registry password is empty. I have proper .env file in the project directory containing KAMAL_REGISTRY_PASSWORD=mypassword
$ kamal setup
INFO [4a37da09] Running /usr/bin/env mkdir -p .kamal on 1.2.3.4
INFO [4a37da09] Finished in 5.948 seconds with exit status 0 (successful).
Acquiring the deploy lock...
Ensure Docker is installed...
INFO [312bfcba] Running docker -v on 1.2.3.4
INFO [312bfcba] Finished in 1.201 seconds with exit status 0 (successful).
INFO [05559197] Running docker login registry.gitlab.com -u [REDACTED] -p [REDACTED] on 1.2.3.4
Releasing the deploy lock...
Finished all in 9.5 seconds
ERROR (SSHKit::Command::Failed): Exception while executing on host 1.2.3.4: docker exit status: 125
docker stdout: Nothing written
docker stderr: flag needs an argument: 'p' in -p
See 'docker login --help'.
@a3kov - the secrets have moved in Kamal 2.0 - you should put them in .kamal/secrets instead now.
Yes, I have KAMAL_REGISTRY_PASSWORD=$KAMAL_REGISTRY_PASSWORD
I thought Kamal will read the .env file to substitute $KAMAL_REGISTRY_PASSWORD. Do I need to provide environment variables myself now ? That was totally unexpected
Ok, now after reading https://github.com/basecamp/kamal/pull/924 it's a bit more clear..
Hmm, after making KAMAL_REGISTRY_PASSWORD variable available in the current environment, it still doesn't work (same symptoms). Any ideas ?
To anyone having the same problem: if you run Kamal from docker, you have to pass the environment inside the container, otherwise it won't be available to the Kamal process.
I actually had multiple issues with the docker version of Kamal so I switched to the gem one. It seems nobody tests if the docker version even works
To anyone having the same problem: if you run Kamal from docker, you have to pass the environment inside the container, otherwise it won't be available to the Kamal process.
Thank you for mentioning this! If all your Kamal env vars begin with KAMAL_, you can pass them to the container cleanly like this (MacOS version; the Linux one is slightly different, see Installation):
docker run -it --rm \
-v "${PWD}:/workdir" \
-v "/run/host-services/ssh-auth.sock:/run/host-services/ssh-auth.sock" \
-e SSH_AUTH_SOCK="/run/host-services/ssh-auth.sock" \
-v /var/run/docker.sock:/var/run/docker.sock \
--env-file <(env | grep '^KAMAL_') \
ghcr.io/basecamp/kamal:latest "$@"
I've hit this several times too. Surprising that this happens given the assertion of registry.password's presence here.
if anyone is running into this when just trying to set up kamal to deploy. Since the env vars are not loaded yet, we get this issue. I use dotenv so doing dotenv kamal secrets print adds the env vars for me.
So, I went to deploy today and now, KAMAL_REGISTRY_PASSWORD does not show up if I do either dotenv kamal secrets print or kamal secrets print
When I add another letter to the env var it does show up.
Any idea what this could be? it was working well a while back :(