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:
56
CLAUDE.md
56
CLAUDE.md
@@ -180,20 +180,48 @@ go vet ./...
|
||||
# 1. Alle Änderungen committen
|
||||
git add -p && git commit -m "feat: ..."
|
||||
|
||||
# 2. Release-Skript (macht Tests → Build → Tag → Push)
|
||||
# 2. Release-Skript (macht Tests → .deb-Build → Gitea-Upload → Tag → Push)
|
||||
./scripts/release.sh 1.2.0
|
||||
|
||||
# Danach liegt in dist/:
|
||||
# deklarix_1.2.0_amd64
|
||||
# deklarix_1.2.0_arm64
|
||||
# deklarix_1.2.0_amd64.deb
|
||||
# deklarix_1.2.0_arm64.deb
|
||||
```
|
||||
|
||||
### Was das Release-Skript tut
|
||||
1. Prüft: sauberer Git-Status (keine uncommitted changes)
|
||||
2. Führt `./scripts/test.sh` aus (vet + race tests + build-check)
|
||||
3. Kompiliert für `linux/amd64` und `linux/arm64`
|
||||
4. Setzt Git-Tag `v<version>` mit Annotierung
|
||||
5. Pusht `main` + Tag nach `origin`
|
||||
2. Führt `./scripts/test.sh` aus (vet + race tests + build-check, braucht `DATABASE_URL`)
|
||||
3. Baut `.deb`-Pakete für `linux/amd64` und `linux/arm64` (`scripts/build.sh`)
|
||||
4. Lädt die Pakete in Giteas Debian-Paketregistrierung hoch (Kanal `testing`,
|
||||
Suites `bookworm` + `trixie`) — siehe „Deployment“ unten
|
||||
5. Setzt Git-Tag `v<version>` mit Annotierung
|
||||
6. Pusht `main` + Tag nach `origin`
|
||||
|
||||
### Deployment (apt, Infrastruktur-Standard wie bei enconf)
|
||||
|
||||
Updates laufen ausschließlich über ein apt-Paket, nie über manuelles
|
||||
Kopieren eines Binaries. `.deb`-Pakete landen in Giteas eingebauter
|
||||
Debian-Paketregistrierung unter der Gitea-Org `projekte` (gleicher
|
||||
Mechanismus wie beim Schwesterprojekt enconf-webpanel). Zielserver
|
||||
richten sich einmalig ein:
|
||||
|
||||
```bash
|
||||
sudo mkdir -p /etc/apt/keyrings
|
||||
sudo curl -fsSL https://git.netcell-it.de/api/packages/projekte/debian/repository.key \
|
||||
-o /etc/apt/keyrings/deklarix-gitea.asc
|
||||
echo "deb [signed-by=/etc/apt/keyrings/deklarix-gitea.asc] https://git.netcell-it.de/api/packages/projekte/debian $(lsb_release -cs) testing" \
|
||||
| sudo tee /etc/apt/sources.list.d/deklarix.list
|
||||
sudo apt-get update && sudo apt-get install deklarix
|
||||
```
|
||||
|
||||
Danach: `apt upgrade` für Updates, `systemctl {start,stop,status} deklarix`
|
||||
für den Dienst. Konfiguration liegt in `/etc/deklarix/deklarix.env`
|
||||
(aus `deklarix.env.example` beim Erstinstall kopiert, `DATABASE_URL` ist
|
||||
dort absichtlich auskommentiert — der Dienst startet erst, wenn sie
|
||||
gesetzt ist; `postinst` startet ihn sonst bewusst nicht, um keine
|
||||
Crash-Restart-Schleife gegen einen Platzhalter-Host zu erzeugen).
|
||||
Aktuell gibt es nur den Kanal `testing` (kein `stable` — es gibt noch
|
||||
keine Kunden, für die eine Trennung nötig wäre).
|
||||
|
||||
---
|
||||
|
||||
@@ -298,13 +326,23 @@ git push origin main
|
||||
|
||||
### Server-Prozess
|
||||
```bash
|
||||
# Start (manuell)
|
||||
PORT=8080 DATABASE_URL=postgres://... ANTHROPIC_API_KEY=... ./dist/deklarix_latest_amd64 &
|
||||
# Dienst läuft über systemd (installiert per apt, siehe Deployment oben)
|
||||
sudo systemctl start deklarix
|
||||
sudo systemctl status deklarix
|
||||
|
||||
# Config: /etc/deklarix/deklarix.env (DATABASE_URL, PORT, ANTHROPIC_API_KEY)
|
||||
|
||||
# Logs prüfen
|
||||
journalctl -u deklarix -f
|
||||
```
|
||||
|
||||
### Bekannte Server
|
||||
|
||||
| Rolle | Host | Zugang |
|
||||
|---|---|---|
|
||||
| Testsystem (DB-Integrationstests, apt-Verifikation) | 89.163.205.4 | SSH `noroot`, sudo passwortlos |
|
||||
| Installer-Endpoint (`get.deklarix.com`) | 89.163.205.110 | noch nicht eingerichtet |
|
||||
|
||||
---
|
||||
|
||||
## Arbeitsweise für Claude Code
|
||||
|
||||
Reference in New Issue
Block a user