2
Deployment Guide
Daniel Krähenbühl edited this page 2026-05-20 08:26:32 +02:00

Deployment-Guide

Server-Infos

Server armarium-test
IPv4 178.104.167.52
OS Ubuntu 24.04
SSH ssh root@178.104.167.52
App-Verzeichnis /home/armarium/armarium-suite/
Frontend-Dist /home/armarium/armarium-suite/frontend/dist/budget-frontend/browser
Systemd-Service armarium.service
Gunicorn Socket unix:/run/armarium/armarium.sock
Nginx-Config /etc/nginx/sites-enabled/
Domain https://app.armarium.ch (Certbot, HTTPS)

Deploy-Schritte

# 1. Einloggen
ssh root@178.104.167.52

# 2. Code aktualisieren
cd /home/armarium/armarium-suite
git pull origin main

# 3. Backend: Abhängigkeiten + Migrationen
cd backend
source venv/bin/activate
pip install -r requirements.txt --quiet
python manage.py migrate

# 4. Frontend bauen
cd ../frontend
npm install --silent
npm run build -- --configuration production

# 5. Service neu starten
systemctl restart armarium

Logs

# Live-Logs (Gunicorn/Django)
journalctl -u armarium -f

# Nginx Access-Log
tail -f /var/log/nginx/access.log

.env auf dem Server

Die Datei /home/armarium/armarium-suite/backend/.env ist nicht im Repo und muss nach dem ersten Setup manuell gepflegt werden.

Neue Variablen nach einem Update manuell ergänzen:

nano /home/armarium/armarium-suite/backend/.env

Wichtige Produktions-Variablen

SECRET_KEY=...
DEBUG=False
ALLOWED_HOSTS=178.104.167.52,app.armarium.ch
CSRF_TRUSTED_ORIGINS=https://app.armarium.ch
CORS_ALLOWED_ORIGINS=https://app.armarium.ch
DB_NAME=armarium_db
DB_USER=armarium_user
DB_PASSWORD=...
DB_HOST=localhost
DB_PORT=5432
TURNSTILE_SECRET_KEY=...
FRONTEND_URL=https://app.armarium.ch
EMAIL_HOST=smtp-relay.brevo.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=...
EMAIL_HOST_PASSWORD=...
DEFAULT_FROM_EMAIL=noreply@armarium.ch

Nginx

Nginx-Config unter /etc/nginx/sites-enabled/. Nach Änderungen:

nginx -t && systemctl reload nginx

Wichtig: Die /api/- und /admin/-Location-Blöcke müssen proxy_set_header X-Forwarded-Proto https; enthalten — sonst erzeugt Django's SECURE_SSL_REDIRECT eine 301-Schleife.

E-Mail testen

cd /home/armarium/armarium-suite/backend
source venv/bin/activate
python manage.py shell
from finance.email import send_email
send_email('password_changed', {}, 'Test', 'deine@email.ch')

Bekannte Hinweise

  • Roboto-Fonts erscheinen als 404 in Nginx-Logs (/media/roboto-*) — unkritisch, Fonts laden aus dem Angular-Bundle
  • DEBUG=False aktiviert automatisch SMTP, HTTPS-Redirect, HSTS und Secure Cookies