Skip to content

fix(proxy,systemd): pin Caddy storage to data_dir, fix systemd unit#84

Merged
vazra merged 1 commit into
mainfrom
worktree-fix-systemd-home-caddy
Apr 30, 2026
Merged

fix(proxy,systemd): pin Caddy storage to data_dir, fix systemd unit#84
vazra merged 1 commit into
mainfrom
worktree-fix-systemd-home-caddy

Conversation

@vazra
Copy link
Copy Markdown
Owner

@vazra vazra commented Apr 30, 2026

Summary

  • Quickstart on a fresh Ubuntu host fails with status=226/NAMESPACE (/var/log/simpledeploy: No such file or directory). The unit listed it in ReadWritePaths but nothing creates or writes it. Removed.
  • After that, tls.mode: auto (the documented default) silently breaks because Caddy/certmagic falls back to $HOME/.local/share/caddy = /root/.local/share/caddy, which ProtectHome=true masks. Two-pronged fix:
    1. Pin Caddy storage to data_dir/caddy for all TLS modes in internal/proxy/proxy.go, not just local. ACME state now lands inside the documented data dir (also makes it covered by existing data_dir backups).
    2. Add Environment=HOME=/var/lib/simpledeploy to the unit as a belt-and-suspenders for any other lib that consults $HOME (docker CLI config, future deps).
  • Docs: docs/reference/directory-layout.md updated to reflect the single caddy storage path. docs/install/ubuntu.md adds a troubleshooting note for users on existing installs.

Test plan

  • go test ./internal/proxy/... passes; new TestBuildConfigTLSAutoStorage asserts storage is set in auto mode
  • go vet ./internal/...
  • go test -short ./internal/...
  • Manual: fresh Ubuntu VM, install .deb, simpledeploy init, tls.mode: auto, systemctl enable --now simpledeploy, confirm active and /var/lib/simpledeploy/caddy/ populated

- drop bogus /var/log/simpledeploy from ReadWritePaths; never created, broke namespace setup (status=226)
- set Environment=HOME=/var/lib/simpledeploy so libs that consult $HOME hit a writable, allow-listed path (ProtectHome=true masks /root)
- always pin Caddy storage to data_dir/caddy, not just tls.mode=local; auto mode previously fell back to $HOME/.local/share/caddy and silently broke ACME under the hardened unit
- doc: directory-layout reflects single caddy storage path
- doc: ubuntu install adds troubleshooting note + upgrade steps
@vazra vazra merged commit d07b190 into main Apr 30, 2026
7 checks passed
@vazra vazra deleted the worktree-fix-systemd-home-caddy branch April 30, 2026 14:10
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.

1 participant