basecamp / kamal

Deploy web apps anywhere.
https://kamal-deploy.org
MIT License
10.66k stars 410 forks source link

Deploy by role does not work #709

Closed morgoth closed 4 months ago

morgoth commented 7 months ago

I have 2 hosts - one is for web, the other for job + notification services. When I run bin/kamal deploy -d production -r notification, I'm getting:

docker stdout: Nothing written
docker stderr: docker: open .kamal/env/roles/route-optimizer-web-production.env: no such file or directory.

There is no web role on this host, so this shouldn't be needed there. The deploy to all servers runs fine, ie bin/kamal deploy -d production

kamal version: 1.3.1

argia-andreas commented 6 months ago

For additional context: This seems to be due to initial container healthcheck step which is performed with the primary role.

kamal deploy -r secondary-role

Ensure app can pass healthcheck...
  INFO [703ee48c] Running docker run --detach --name healthcheck-primary-role --publish 3999:80 --label service=healthcheck-primary-role -e KAMAL_CONTAINER_NAME="healthcheck-primary-role" --env-file .kamal/env/roles/primary-role.env --health-cmd "curl -f http://localhost/up || exit 1"
  INFO [a8ccc7f3] Finished in 0.075 seconds with exit status 123 (failed).
Releasing the deploy lock...
  Finished all in 22.6 seconds
  ERROR (SSHKit::Command::Failed): Exception while executing on host 192.168.0.11: docker exit status: 125
docker stdout: Nothing written
docker stderr: docker: open .kamal/env/roles/primary-role.env: no such file or directory.
djmb commented 5 months ago

This should be fixed by https://github.com/basecamp/kamal/pull/740