Add package definitions, build script, and test suite#232
Conversation
There was a problem hiding this comment.
Pull request overview
This PR introduces a new, Debian-policy-aligned packaging layout for Sia daemons by defining per-daemon package metadata/config under packages/<name>/, generating .deb artifacts via a shared scripts/build-deb.sh, and validating install/upgrade/migration/remove behavior with an end-to-end containerized test suite.
Changes:
- Add
scripts/build-deb.shand packaging templates (systemd unit, maintainer scripts, control, logrotate, copyright). - Add per-daemon package definitions and default configs for
hostd,renterd,walletd, ands3d. - Add a Docker-based packaging test suite + CI workflow to lint, build, and run package scenarios across Debian/Ubuntu variants.
Reviewed changes
Copilot reviewed 35 out of 36 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
.gitignore |
Ignore generated dist/ artifacts and .deb outputs. |
.github/workflows/test.yml |
Add CI workflow for shellcheck, Go checks, package build, and package scenario tests. |
scripts/build-deb.sh |
New build script that assembles .deb packages from templates + per-daemon definitions. |
scripts/templates/control.tmpl |
Package control file template. |
scripts/templates/copyright.tmpl |
Debian copyright file template. |
scripts/templates/logrotate.tmpl |
Logrotate config template for daemon logs. |
scripts/templates/postinst.tmpl |
Post-install maintainer script handling migration and restart policy. |
scripts/templates/postrm.tmpl |
Post-removal maintainer script handling purge and failure unwind. |
scripts/templates/preinst.tmpl |
Pre-install maintainer script handling legacy unit detection/stash. |
scripts/templates/prerm.tmpl |
Pre-removal maintainer script handling disable/stop policy. |
scripts/templates/service.tmpl |
Systemd unit template using Debian-expected locations and defaults. |
packages/hostd/package.env |
hostd package metadata. |
packages/hostd/hostd.yml |
Default hostd config shipped as a conffile under /etc. |
packages/renterd/package.env |
renterd package metadata. |
packages/renterd/renterd.yml |
Default renterd config shipped as a conffile under /etc. |
packages/s3d/package.env |
s3d package metadata. |
packages/s3d/s3d.yml |
Default s3d config shipped as a conffile under /etc. |
packages/walletd/package.env |
walletd package metadata. |
packages/walletd/walletd.yml |
Default walletd config shipped as a conffile under /etc. |
tests/README.md |
Documentation for running the packaging test suite locally. |
tests/Dockerfile.systemd |
Builds a systemd-enabled test image for running package scenarios. |
tests/lib.sh |
Container lifecycle helpers for the packaging tests. |
tests/run-tests.sh |
Orchestrates building the stub, building images, running scenario scripts. |
tests/container-prep.sh |
Container-side prep: copy sources, build debs, build legacy debs. |
tests/build-legacy-deb.sh |
Builds legacy-style .deb packages for migration testing. |
tests/lintian-suppressions.txt |
Lintian suppressions used by the lintian scenario. |
tests/stub/main.go |
Minimal stub daemon used by packaging tests. |
tests/scenarios/helpers.sh |
Scenario assertion helpers and systemd state helpers. |
tests/scenarios/01-fresh-install.sh |
Fresh install layout + conffile registration assertions. |
tests/scenarios/02-upgrade.sh |
Upgrade behavior assertions (restart-if-running, preserve enablement). |
tests/scenarios/03-config-preservation.sh |
Conffile + systemd drop-in preservation assertions. |
tests/scenarios/04-legacy-migration.sh |
Legacy migration assertions (stock vs modified unit behavior). |
tests/scenarios/05-remove-purge.sh |
Remove vs purge behavior assertions (keep config/data vs cleanup logs/config). |
tests/scenarios/06-lintian.sh |
Lintian check scenario (runs on Debian trixie only). |
tests/scenarios/07-failed-upgrade.sh |
Failed-upgrade unwind behavior assertions. |
tests/scenarios/nosystemd-install.sh |
Install/upgrade/remove/purge + legacy migration in no-systemd containers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
8ac483e to
0b9d6f0
Compare
6b6e0aa to
f81a230
Compare
|
@n8mgr @ChrisSchinnerl one thing I didn't really address with this PR is our logging strategy Today all four daemons default What if we would update our daemons though and default edit: I'm trying to gauge whether we can effectively close #129 after these changes or if we need to keep that one open |
1ebb0db to
3a2fa68
Compare
as discussed I'll F/U with PRs that disable file logging by default so we can somewhat bypass the complaint we don't logrotate our log file |
Groundwork for #129 and #179. It changes how we define our .deb packages, but doesn't touch the release flow yet. A later PR flips the build workflow over and closes both, if this gets approved. It's long because it also migrates existing installs to the new layout.
Two things are wrong with our packages today:
The main fix is about config. Every daemon already writes its own config to
/etc/<name>/<name>.ymlwhen you run<name> config. The tempting way to help with #179 would be to ship a default config in the package, but then the package and the daemon would fight over that file: the package claims it, the daemon overwrites it the first time you run<name> config, and every upgrade stops to ask "keep yours or take mine?". So we deliberately ship no config. The daemon owns it, the package never touches it, upgrades can't clobber it. That's #179.A test suite installs, upgrades, migrates and removes the packages in real containers across debian bullseye, bookworm, trixie and ubuntu jammy, questing. all green, runs on every PR. nothing here changes what we publish until the follow up PR.