feat: apt-based deployment via Gitea Debian registry

Deklarix now ships as a .deb package instead of a raw binary, matching
the enconf-webpanel infrastructure standard: scripts/build.sh assembles
a real .deb (systemd unit, env template, postinst/prerm), scripts/release.sh
uploads it to Gitea's built-in Debian package registry after a green
test run. Target servers add one apt source and get updates via
`apt upgrade` from then on.

postinst only starts the service once DATABASE_URL is actually set in
/etc/deklarix/deklarix.env — the shipped template ships it commented out
on purpose, since an uncommented but unfilled placeholder URL is
syntactically indistinguishable from a real one and caused exactly that
crash-loop during verification.

Verified end-to-end against the real test server and Gitea registry:
upload -> apt-get update -> apt-cache policy -> apt-get install -> a
service that stays down until configured, then runs migrations and
serves /health once a real database is set.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
noroot
2026-08-27 13:34:58 +02:00
parent e929e5bf26
commit 8b08b39725
9 changed files with 255 additions and 37 deletions

View File

@@ -0,0 +1,15 @@
# Deklarix — Konfiguration
# Wird bei der Erstinstallation nach /etc/deklarix/deklarix.env kopiert.
# Diese Datei selbst wird von apt-Updates verwaltet — Anpassungen gehören
# in deklarix.env, nicht hierhin.
PORT=8080
# Pflicht — der Dienst startet nicht ohne gültige DATABASE_URL. Auskommentiert
# lassen, bis eine echte Postgres-Verbindung eingetragen ist: postinst prüft
# genau diese Zeile, um den Dienst nicht blind in eine Restart-Schleife gegen
# einen Platzhalter-Host laufen zu lassen.
#DATABASE_URL=postgres://user:password@host:5432/deklarix?sslmode=require
# Für internal/extract (Claude-API-Extraktion), sobald angebunden.
#ANTHROPIC_API_KEY=

View File

@@ -0,0 +1,23 @@
[Unit]
Description=Deklarix
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=deklarix
Group=deklarix
EnvironmentFile=/etc/deklarix/deklarix.env
ExecStart=/usr/bin/deklarix
WorkingDirectory=/var/lib/deklarix
Restart=on-failure
RestartSec=5
NoNewPrivileges=true
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
ReadWritePaths=/var/lib/deklarix /var/log/deklarix
[Install]
WantedBy=multi-user.target