Skip to content

Make systemd unit configurable and fix :system-mode defaults#6

Open
floriancrusius wants to merge 1 commit into
codeur:mainfrom
floriancrusius:feature/configurable-systemd-unit
Open

Make systemd unit configurable and fix :system-mode defaults#6
floriancrusius wants to merge 1 commit into
codeur:mainfrom
floriancrusius:feature/configurable-systemd-unit

Conversation

@floriancrusius

Copy link
Copy Markdown

Summary

  • Configurable env vars in the systemd unit — adds :solid_queue_service_unit_env_files and :solid_queue_service_unit_env_vars (inspired by capistrano-sidekiq). Both fall back to shared :service_unit_env_files / :service_unit_env_vars so multi-plugin setups can share one source.
  • Configurable command:solid_queue_command (default "rake solid_queue:start") so SolidQueue >= 0.4 setups can switch to "bin/jobs" without templating.
  • Fix [Install] WantedBy= — now multi-user.target in :system mode (previously always default.target, which prevented boot activation of system units).
  • Fix :system mode running as root — now renders User=<solid_queue_user> (defaults to :run_as, then Capistrano's :user).
  • Breaking: Capistrano's default_env is no longer auto-rendered into the unit; MALLOC_ARENA_MAX=2 is no longer hardcoded. Pass what you need explicitly via the new hooks. RAILS_ENV is still derived from the current stage.

Test plan

  • bundle exec cap <stage> solid_queue:generate and inspect the generated solid_queue.service — verify Environment=, EnvironmentFile=, ExecStart=, User=, WantedBy= look correct in both :user and :system modes.
  • bundle exec cap <stage> solid_queue:install on a staging host, systemctl --user status <unit> (or sudo systemctl status … for :system) — service comes up.
  • Set :solid_queue_service_unit_env_vars, ["FOO=bar"] and confirm it lands in the rendered unit.
  • Set :solid_queue_command, "bin/jobs" on a SolidQueue-0.4+ app and confirm the process starts.

- Add :solid_queue_service_unit_env_files / :solid_queue_service_unit_env_vars
  for injecting EnvironmentFile= and Environment="KEY=VALUE" lines into the
  unit (inspired by capistrano-sidekiq). Both fall back to shared
  :service_unit_env_files / :service_unit_env_vars.
- Add :solid_queue_command (default "rake solid_queue:start") so setups on
  SolidQueue >= 0.4 can switch to "bin/jobs" without templating.
- Fix WantedBy: multi-user.target when running in :system mode (previously
  always default.target, which prevented boot activation of system units).
- Fix :system mode running the service implicitly as root — now uses
  :solid_queue_user (falls back to :run_as, then :user).
- Drop implicit rendering of Capistrano's default_env and the hardcoded
  MALLOC_ARENA_MAX=2; pass anything you need explicitly via the new hooks.
  RAILS_ENV is still derived from the current stage.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant