fix(dgw): overhaul Linux RPM/DEB packaging#1747
fix(dgw): overhaul Linux RPM/DEB packaging#1747Benoît Cortier (CBenoit) merged 12 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
Updates Devolutions Gateway Linux packaging to ship a static systemd unit file in the RPM (aligning with the DEB approach) and adjusts install/remove scripts and CI smoke tests to avoid the previous “multiple ExecStart” systemd rejection.
Changes:
- Bundle
devolutions-gateway.servicedirectly into the RPM and set proper file attributes during packaging. - Update RPM maintainer scripts to manage the service via
systemctlinstead ofdevolutions-gateway service register/unregister. - Strengthen DEB/RPM smoke tests to require the unit file presence and add a regression check for
ExecStartdirectives.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| package/Linux/gateway/rpm/service | Adds a packaged systemd unit file for RPM installs. |
| package/Linux/gateway/rpm/prerm | Switches uninstall behavior to systemctl stop/disable instead of binary-driven unregister. |
| package/Linux/gateway/rpm/postinst | Removes service registration call; relies on packaged unit + systemctl. |
| package/Linux/gateway/debian/service | Aligns DEB unit file metadata by adding Description=. |
| devolutions-gateway/src/main.rs | Adjusts the Linux service registration unit template to clear ExecStart before setting it. |
| ci/package-gateway-rpm.ps1 | Adds the unit file to the RPM payload and sets its RPM permissions/ownership. |
| .github/scripts/smoke-test-rpm.sh | Updates RPM smoke test expectations to require the packaged unit file and adds ExecStart regression guard. |
| .github/scripts/smoke-test-lib.sh | Adds check_single_execstart() helper used by DEB/RPM smoke tests. |
| .github/scripts/smoke-test-deb.sh | Adds the ExecStart regression guard to the DEB smoke test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3cf3d34 to
4f9aa3b
Compare
Fix a systemd startup failure on RHEL/Rocky Linux caused by two ExecStart= directives: the postinst called `devolutions-gateway service register` which used ceviche to write both a base unit file and a drop-in without the mandatory ExecStart= reset, which systemd rejects. RPM packaging changes: - Bundle the systemd unit file directly in the RPM (matching how the DEB already works via dh_installsystemd), eliminating the service register call - Ship a systemd preset file (85-devolutions-gateway.preset) so the service is correctly enabled on fresh install on RHEL/Rocky (which defaults to disable * for unknown units) - Use systemd-rpm-macros (%systemd_post, %systemd_preun, %systemd_postun_with_restart) for correct install/upgrade/remove semantics - Fix prerm to use RPM numeric arguments ($1) instead of Debian-style strings - Fix postrm to preserve config on removal (RPM has no purge concept) - Move daemon-reload to postrm so it runs after the unit file is removed - Config initialization now runs unconditionally (not gated on systemd) - Fresh install: enable only, do not start (service requires configuration) - Upgrade: try-restart only if already running - Config directory permissions hardened to 750 DEB packaging changes: - Mirror RPM service lifecycle semantics: enable on fresh install but do not start; try-restart on upgrade - Config initialization now runs unconditionally - Config directory permissions hardened to 750 - Add Description= to service unit file Both packages: - Print a post-install message on fresh install directing admin to edit gateway.json and start the service, with instruction varying based on whether systemd is present main.rs: - Add ExecStart= reset line to the ceviche drop-in template so manually registered services (via `service register`) are also correct - Add Description= to the drop-in unit template CI (tlk.ps1, package-gateway-rpm.ps1): - Fix --rpm-attr flags being placed after -- (fpm treated them as file paths) - Split fpm invocation into $FpmOptions and $FpmFiles arrays for clarity - Add service file and preset file to fpm gateway file list Smoke tests (smoke-test-lib.sh, smoke-test-deb.sh, smoke-test-rpm.sh): - Add systemd_and_unit_available() helper that checks systemd presence AND unit file existence before any systemctl call - Add check_config_dir_permissions(): verifies 750 - Add check_provisioner_key(): generates RSA-2048 key pair with openssl (required for the gateway to start) - Replace best-effort check_service_startup() with check_service_health(): starts via systemctl when available or directly otherwise, polls /jet/health, then stops — hard failure - Add uninstall test: removes package, verifies binary and unit file are gone, verifies config directory is preserved - Add curl and openssl to prerequisites - check_single_execstart() rewritten to use first-found unit file path (avoids /lib → /usr/lib symlink double-count) and ignores bare ExecStart= reset directives linux-install-test.yml: - Expand matrix to Ubuntu 18.04/20.04/22.04/24.04 and Rocky Linux 8/9/10
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Confirmed working as expected end-to-end: Rocky Linux (~RHEL)Ubuntu |
Marc-André Moreau (awakecoding)
left a comment
There was a problem hiding this comment.
approved on the basis that the smoke tests validate that it all works as expected
Fix a systemd startup failure on RHEL/Rocky Linux caused by two ExecStart= directives: the postinst called
devolutions-gateway service registerwhich used ceviche to write both a base unit file and a drop-in without the mandatory ExecStart= reset, which systemd rejects.RPM packaging changes:
DEB packaging changes:
Both packages:
main.rs:
service register) are also correctCI (tlk.ps1, package-gateway-rpm.ps1):
Smoke tests (smoke-test-lib.sh, smoke-test-deb.sh, smoke-test-rpm.sh):
linux-install-test.yml:
Issue: DGW-338
Issue: DGW-366