Files
tsumugu/docs/DEPLOYMENT.md
T
LarsandCursor 353001d819
Deploy Development / deploy (push) Successful in 17s
Deploy Production / deploy (push) Successful in 16s
Lege Tsumugu auf freie Pi-Ports 3007/8007 und 3094/8094.
8006 und 8095 sind bereits durch BuyingAgent belegt.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-15 09:47:10 +02:00

75 lines
3.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Deployment – Tsumugu
**Stand:** 2026-10-15
**Server:** Raspberry Pi (`192.168.2.49`) — gleicher Host wie Mitai, Shinkan, Kairo und Kanshō, **eigenes** Compose-Projekt
**Runner:** Gitea Actions (`/home/lars/gitea-runner/`), Label `ubuntu-latest`
**Repo:** `http://192.168.2.144:3000/Lars/tsumugu.git`
Der Mechanismus ist von Kanshō übernommen: der Runner auf dem Pi checkt den Branch in ein festes Verzeichnis aus, baut die Images und startet Compose. Watchtower bleibt aus.
Unter `/home/lars/docker/` legt der Lauf nur diese zwei Verzeichnisse an:
| | Production | Development |
|---|------------|-------------|
| **Git-Branch** | `main` | `develop` |
| **Server-Verzeichnis** | `/home/lars/docker/tsumugu` | `/home/lars/docker/tsumugu-dev` |
| **Frontend-Port** | 3007 | 3094 |
| **Backend-Port** | 8007 | 8094 |
| **PostgreSQL** | nur Compose-Netz, DB `tsumugu` | nur Compose-Netz, DB `tsumugu_dev` |
| **Domain** | tsumugu.jinkendo.de | dev.tsumugu.jinkendo.de |
| **Öffentliche URL** | https://tsumugu.jinkendo.de | https://dev.tsumugu.jinkendo.de |
| **Compose** | `docker-compose.yml` | `docker-compose.dev-env.yml` |
3005 ist auf dem Pi durch Bookstack belegt, 3006/8005 und 3096/8096 durch Kanshō. 3002–3004 und 3097–3099 gehören Mitai, Shinkan und Kairo. BuyingAgent hält 8006 und 8095. Tsumugu nimmt deshalb 3007/8007 und 3094/8094.
---
## Gitea Actions
| Workflow | Trigger | Zweck |
|----------|---------|--------|
| `deploy-dev.yml` | Push `develop` | Deploy nach `/home/lars/docker/tsumugu-dev`, Health `localhost:8094` und `localhost:3094` |
| `deploy-prod.yml` | Push `main` | Deploy nach `/home/lars/docker/tsumugu`, Health `localhost:8007` und `localhost:3007` |
Gearbeitet wird auf `develop`. Production entsteht nur durch einen Merge-Commit `develop` → `main` (`git merge --no-ff develop` auf `main`) und den anschließenden Push von `main`. Kein Fast-Forward, kein direkter Commit auf `main`, kein manuelles `git pull` auf dem Prod-Checkout. Gitea (`deploy-prod.yml`) ist der einzige Prod-Schreibpfad für Code.
Fehlt beim ersten Lauf die Host-`.env`, legt der Workflow sie an. Development bekommt die dokumentierten Dev-Defaults. Production bekommt ein zufälliges `DB_PASSWORD`, das nur in `/home/lars/docker/tsumugu/.env` steht und nicht ins Log geschrieben wird. Spätere Läufe überschreiben eine vorhandene `.env` nicht. `git reset --hard` lässt die Datei liegen, weil sie nicht im Repo ist.
---
## Erreichbarkeit von außen
TLS endet wie bei Kanshō auf dem Synology-NAS `192.168.2.63` (DSM Reverse Proxy), nicht auf dem Pi.
| Domain | Ziel |
|--------|------|
| `dev.tsumugu.jinkendo.de` | `http://192.168.2.49:3094` |
| `tsumugu.jinkendo.de` | `http://192.168.2.49:3007` |
DNS bzw. AdGuard-Rewrite für beide Namen auf `192.168.2.63`. Im DSM-Reverse-Proxy Lese- und Sende-Timeout auf 600s setzen. Bis die Regeln stehen, bleibt der LAN-Zugriff über die Publish-Ports:
- Development: `http://192.168.2.49:3094`
- Production: `http://192.168.2.49:3007`
`nginx/tsumugu.conf` und `nginx/tsumugu-dev.conf` sind die Host-nginx-Variante, falls TLS später auf dem Pi endet. Sie sind nicht der aktuelle Pfad.
---
## Manuelles Deploy
```bash
# Development
cd /home/lars/docker/tsumugu-dev
git fetch origin develop && git reset --hard origin/develop
docker compose -f docker-compose.dev-env.yml build --no-cache backend frontend
docker compose -f docker-compose.dev-env.yml up -d --wait
curl -sf http://localhost:8094/api/health
# Production
cd /home/lars/docker/tsumugu
git fetch origin main && git reset --hard origin/main
docker compose build --no-cache backend frontend
docker compose up -d --wait
curl -sf http://localhost:8007/api/health
```