kamal icon indicating copy to clipboard operation
kamal copied to clipboard

Getting an error when using a destination with no corresponding deploy yml file

Open jeromedalbert opened this issue 1 year ago • 5 comments

When using -d destination, at the moment you have to have a deploy.destination.yml file (along with a deploy.yml file), or you get a ERROR (RuntimeError): Configuration file not found error.

Conversely, when using -d destination, at the moment you have to have a deploy.yml file (along with a deploy.destination.yml file), or you also get a ERROR (RuntimeError): Configuration file not found error.

I don't think it should error out. I think only one yml file can be enough, because you can make a deploy.yml file that works for all destinations.

Like this one:

service: myapp
image: myuser/myapp

servers:
  web:
  - <%= ENV['SERVER_IP'] %>

registry:
  username: myuser
  password:
    - KAMAL_REGISTRY_PASSWORD

env:
  secret:
    - RAILS_MASTER_KEY
    - SERVER_IP

Because the SERVER_IP comes from an environment variable, like .env.production or .env.staging, I don't have anything to add in a deploy.production.yml file or deploy.staging.yml file. One deploy.yml file is enough, but this won't work in Kamal at the moment.

The only way to work around this is to create a dummy deploy.production.yml file with a dummy key in it (or {} as mentioned in https://github.com/basecamp/kamal/issues/682). If the file is empty, you get a ERROR (NoMethodError): undefined method symbolize_keys' for false` error) error.

If this issue makes sense I’d be happy to make a PR to fix this.

jeromedalbert avatar May 17 '24 08:05 jeromedalbert