Skip to content

Fix install, uninstall and status, drop reload and the quiet hook, clean up the gem - #15

Merged
burisu merged 3 commits into
mainfrom
review-fixes
Nov 9, 2026
Merged

burisu merged 3 commits into
mainfrom
review-fixes

Conversation

@burisu

@burisu burisu commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Fixes from a review of the whole gem, checked on a test server: Ubuntu 24.04 with systemd 255 in Docker, Capistrano connecting over SSH as deploy, who has sudo but can't write to /etc/systemd/system. Each task below was run with main and with this branch.

Tasks

Task main This branch
install, :system mode fails: scp can't write to /etc/systemd/system/ uploads to :tmp_dir, then sudo mv; unit enabled, User=deploy
uninstall, :system mode fails: rm without sudo, Permission denied sudo rm -f <name>.service
uninstall, user mode, with app_solid_queue_preprod_eu.service next to the unit removes both files (rm -f <name>*) removes only app_solid_queue_preprod.service
status on a stopped service cap aborts on systemctl status exit status 3 shows Active: inactive (dead)
  • install used to call invoke "solid_queue:enable" from inside its on roles block. enable then ran on every server from the first one, possibly before the unit reached the others. install now runs systemctl enable in the same block, after daemon-reload. This race was not reproduced; the test checks that the enable task isn't invoked and that enable follows daemon-reload.
  • solid_queue:reload and ExecReload=/bin/kill -TSTP $MAINPID are removed. Solid Queue 1.7.2 doesn't trap TSTP, and in the test container a systemctl reload sending TSTP to the main process of a service left it running unchanged (state Ss), so the task did nothing.
  • The solid_queue:quiet hook after deploy:starting is removed: its SIGTERM makes Solid Queue shut down (supervisor/signals.rb: TERM → stop, terminate_gracefully), so jobs stopped for the whole deploy. The service is now stopped after deploy:updated and started after deploy:published. The task itself stays.
  • Template rendering moves to Systemd#service_unit (it was duplicated in generate and install), the unit file name to Systemd#service_unit_file. The duplicate mkdir -p of install goes away.

Gem

  • Ruby 3.1 or later (CI tests 3.1 to 4.0); standard targets 3.1.
  • Capistrano 3.5 or later: capistrano/plugin is missing from 3.4.1 and present in 3.5.0, with everything the plugin uses (set_defaults, define_tasks, register_hooks, eval_rakefile, backend, DSL#sudo, set_if_empty). Only 3.20.1 is tested.
  • changelog_uri points to CHANGELOG.md (the repo has no GitHub release).
  • New summary and description; bindir and executables removed (there is no exe/).
  • sig/ removed: the signature declared class SolidQueue instead of a module, without Systemd, and nothing checked it. .standard.yml and Rakefile are no longer packaged. gem build now ships lib/, the gemspec, README.md, CHANGELOG.md, LICENSE.txt and CODE_OF_CONDUCT.md.

README

  • Task list taken from cap -T, without reload; hooks without quiet.
  • User services need lingering: in the test container, a user service started over SSH stopped within 15 s of logging out without lingering, and kept running with loginctl enable-linger deploy.
  • Typo, missing stage in the cap … solid_queue:restart example, and the code of conduct link ([USERNAME] placeholder) fixed.

Tests

  • New tests (each failed before the change): install (user mode: unit moved into place, enable after daemon-reload, solid_queue:enable task not invoked; :system mode: mv through sudo), uninstall (only this unit; rm through sudo in :system mode), status on a failing systemctl, a dry-run deploy running solid_queue:stop then solid_queue:start only, no reload task, no ExecReload=.
  • Mutation: removing the upload!, mkdir, mv, daemon-reload or enable line of install, the rm line of uninstall, raise_on_non_zero_exit: false of status, or the File.write of generate makes at least one test fail.
  • bundle exec rake (tests + standard): green locally (Ruby 4.0.6).

Upgrade

Run cap <stage> solid_queue:install again after upgrading, so the installed unit loses its ExecReload= line.

🤖 Generated with Claude Code

burisu and others added 3 commits November 9, 2026 10:51
Vérifié sur un serveur de test (Ubuntu 24.04, systemd 255, connexion
SSH en deploy avec sudo, /etc/systemd/system non inscriptible) :

- install en mode :system échouait (scp refusé dans
  /etc/systemd/system) : l'unité est envoyée dans :tmp_dir puis
  déplacée avec sudo_if_needed (sudo mv en :system, mv sinon) ;
- install appelait invoke "solid_queue:enable" depuis le bloc on roles,
  qui relance enable sur tous les serveurs depuis le premier : enable
  est maintenant lancé dans le même bloc, après daemon-reload ;
- uninstall supprimait <nom>* (et donc l'unité d'un autre stage au nom
  plus long) sans sudo (Permission denied en :system) : il supprime
  <nom>.service avec sudo_if_needed ;
- status s'arrêtait sur le code 3 de systemctl status pour un service
  arrêté : il ne lève plus d'erreur ;
- ExecReload envoyait SIGTSTP, que Solid Queue n'intercepte pas et que
  le noyau ignore pour le processus principal d'un service : reload ne
  faisait rien. La tâche reload et ExecReload sont supprimées ;
- le hook quiet après deploy:starting envoyait SIGTERM, ce qui arrête
  Solid Queue (pas de mode quiet) pendant tout le déploiement : retiré,
  la tâche reste disponible.

Le rendu du template est factorisé dans Systemd#service_unit, le nom du
fichier d'unité dans Systemd#service_unit_file ; le double mkdir -p
d'install disparaît.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- required_ruby_version >= 3.1.0 (la CI teste 3.1 à 4.0), standard en
  ruby_version 3.1 ;
- capistrano >= 3.5 : capistrano/plugin n'existe pas dans la 3.4.1 et
  existe dans la 3.5.0, avec tout ce que le plugin utilise ;
- changelog_uri pointe vers CHANGELOG.md (aucune release GitHub) ;
- summary et description décrivent le gem, bindir et executables
  (pas de dossier exe/) sont retirés ;
- sig/ supprimé : signature fausse (class au lieu de module) et jamais
  vérifiée ; .standard.yml et Rakefile ne sont plus dans le gem.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
README : liste des tâches reprise de cap -T, sans reload ; hooks sans
quiet ; linger à activer une fois pour un service utilisateur (vérifié :
sans linger, le service s'arrête à la déconnexion) ; coquille, stage
manquant dans l'exemple et lien du code de conduite corrigés.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@burisu
burisu marked this pull request as ready for review November 9, 2026 10:07
@burisu
burisu merged commit 6a960af into main Nov 9, 2026
5 checks passed
@burisu
burisu deleted the review-fixes branch November 9, 2026 10:07
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