Repository navigation
Use :rails_env for RAILS_ENV in the systemd service - #9
Merged
Merged
Conversation
Le service systemd recevait toujours le nom du stage Capistrano comme RAILS_ENV : un stage « preprod » configuré avec `set :rails_env, "production"` lançait Solid Queue avec RAILS_ENV=preprod (issue #8). Le template lit maintenant `fetch(:rails_env, fetch(:stage))`, comme capistrano-rails et capistrano3-puma. Un service déjà installé n'est pas régénéré au déploiement : il faut relancer `cap <stage> solid_queue:install`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
burisu
marked this pull request as ready for review
November 9, 2026 08:20
This was referenced Nov 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Issue #8: the systemd service generated by
solid_queue:installwritesRAILS_ENV=<stage>. A stage whose name isn't the Rails environment (e.g. apreprodstage withset :rails_env, "production") therefore starts Solid Queue withRAILS_ENV=preprod.Changes
lib/capistrano/templates/solid_queue.service.erb:RAILS_ENVcomes fromfetch(:rails_env, fetch(:stage)). Same rule as capistrano-rails (set_rails_env.rake:fetch(:rails_env) || fetch(:stage)) and capistrano3-puma (puma.rb:110). Without:rails_env, nothing changes.<application>_solid_queue_<stage>: two stages on the same server can share the sameRAILS_ENV.cap <stage> solid_queue:installhas to be run again.Tests
test/capistrano/test_service_unit.rbrunscap preprod solid_queue:generatein a minimal Capistrano project (standard Capfile, SSHKitLocalbackend, so neither SSH nor systemd) and reads the generated unit:set :rails_env, "production"→Environment='RAILS_ENV=production'(fails without the fix: the unit containedRAILS_ENV=preprod);:rails_env→Environment='RAILS_ENV=preprod'.fetch(:stage), removing thefetch(:stage)fallback, or deleting the line each makes at least one of the two tests fail.bundle exec rake(tests + standard): green locally (Ruby 4.0.6).🤖 Generated with Claude Code