basecamp / basecamp/kamal

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

Open
#809 5 comments 1 reaction 0 assignees View on GitHub
Dominant language
Ruby
Stars
14.6k
Forks
752
Avg merge
4d 23h
Merged PRs (30d)
8

Description

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:

```yml
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.

Contributor guide

Open the contributing guide

Research direction

The issue names no files or tests. Start by tracing Kamal's deployment configuration loading for the `-d destination` option, then reproduce cases where either `deploy.yml` or `deploy.destination.yml` is absent, including an empty file. Done means a shared `deploy.yml` works without a destination-specific file and the existing configuration errors are avoided.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.