-
Notifications
You must be signed in to change notification settings - Fork 676
Open
Description
I am using kamal to deploy a rails 8 application. I have a custom environment, staging, and created the respective config/deploy.staging.yml configuration file.
This is my config/deploy.yml env settings:
env:
clear:
RAILS_ENV: production
secret:
- RAILS_MASTER_KEYAnd this is my config/deploy.staging.yml:
env:
clear:
RAILS_ENV: staging
secret:
- DATABASE_URLWhen deploying with kamal deploy -d staging, I would expect that the secret envs would be merged, ending up with RAILS_MASTER_KEY and DATABASE_URL in my container. However, that's not the case.
When I run the above command, the deployment fails with the following error:
2026-01-08T16:46:03.487349794Z ArgumentError: Missing `secret_key_base` for 'staging' environment, set this string with `bin/rails credentials:edit` (ArgumentError)
2026-01-08T16:46:03.487360669Z
2026-01-08T16:46:03.487364601Z raise ArgumentError, "Missing `secret_key_base` for '#{Rails.env}' environment, set this string with `bin/rails credentials:edit`"
2026-01-08T16:46:03.487368438Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2026-01-08T16:46:03.487371979Z /rails/config/environment.rb:5:in `<main>'If I add the RAILS_MASTER_KEY explicitly to config/deploy.staging/yml and alongside DATABASE_URL, then the deployment works as expected.
Is this expected behaviour? I couldn't find any documentation that supports it.
Versions:
- kamal
2.10.1 - rails
8.0.4 - ruby
3.3.10
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels