Skip to content

v0.3.2: restart services on package upgrade - #24

Merged
emoscardini merged 3 commits into
mainfrom
fix/restart-on-upgrade
Nov 24, 2026
Merged

emoscardini merged 3 commits into
mainfrom
fix/restart-on-upgrade

Conversation

@emoscardini

Copy link
Copy Markdown
Member

Prepares v0.3.2: package upgrades now restart the running services.

Problem

The ziti-ssh-host and ziti-ssh-ca postinstall scripts only ran systemctl daemon-reload. After a package upgrade the previous daemon kept running until something else restarted it.

  • On Ubuntu, needrestart usually restarted it.
  • On RHEL-family systems, and on Debian without needrestart, nothing did. In the v0.3.1 live test, a RHEL 10 host kept running the replaced binary (/proc/<pid>/exe showed (deleted)) until it was restarted by hand.
  • This also applies to hosts that upgraded to 0.3.0 for its security fixes.

Change

  • Restart on upgrade: on upgrade (deb configure <old-version>, rpm $1 >= 2), the scripts run systemctl try-restart <unit>, which restarts the service only if it is running. Fresh installs, stopped services and systems without systemd are unchanged. Upgrading to 0.3.2 from any version runs this new script.
  • Test hooks: the host script's paths can be overridden for tests, as the CA script's already could.
  • Docs:
    • a new "Upgrading" section in docs/provisioning.md, including how to tell whether a host upgraded earlier still runs the previous version: /proc/<pid>/exe shows (deleted);
    • docs/building.md links to it;
    • CHANGELOG [0.3.2] and CLAUDE.md.

Testing

  • go build ./... && go vet ./... && go test -count=1 ./... passes in all 12 packages. The new packaging/scripts_test.go runs both scripts against stub commands for deb and rpm arguments (7 cases each) and checks that nothing is reloaded or restarted without systemd.
  • Both scripts pass sh -n and bash -n.
  • Real package managers: 0.3.2~rc packages built with scripts/docker-build-packages.sh and installed in disposable containers (ubuntu:24.04 with dpkg, rockylinux/rockylinux:9 with rpm -U), using a logging systemctl stub:
Fresh install Upgrade (deb 0.2.2 → 0.3.2rc, rpm 0.1.0 → 0.3.2rc)
deb, host and CA daemon-reload only daemon-reload; try-restart <unit>
rpm, host and CA daemon-reload only daemon-reload; try-restart <unit>; the old package's scriptlet did not disable the service

Please merge with a merge commit. After merge: tag v0.3.2.

The ziti-ssh-host and ziti-ssh-ca postinstall scripts only ran
daemon-reload, so after a package upgrade the previous daemon kept
running until something restarted it (needrestart on Ubuntu; nothing on
RHEL-family systems or Debian without needrestart).

On upgrade (deb "configure <old-version>", rpm $1 >= 2) the scripts now
run "systemctl try-restart", which restarts the service only if it is
running. Fresh installs and stopped services are unchanged.

packaging/scripts_test.go runs both scripts against stub commands for
deb and rpm arguments; the host script's paths are overridable for it,
as the CA script's already were.
provisioning.md gains an Upgrading section: upgrades to 0.3.2+ restart
running services; hosts upgraded to 0.3.1 or earlier may still run the
previous version, and how to check and restart. CHANGELOG [Unreleased].
@r-caamano
r-caamano self-requested a review November 24, 2026 21:39
@emoscardini
emoscardini merged commit edbbbab into main Nov 24, 2026
1 check passed
@emoscardini
emoscardini deleted the fix/restart-on-upgrade branch November 24, 2026 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants