Timer-App unter Versionsverwaltung stellen
Stand der laufenden Anwendung von 192.168.1.5:/opt/timer-app (systemd-Dienst timer-app, Port 3003). Zeiterfassung mit Kostenberechnung: Node/Express, SQLite, Anmeldung ausschliesslich ueber Authentik (OIDC, PKCE, RP-Logout) - der frueher vorhandene Passwort-Login ist entfernt. Nicht im Repo, bewusst: - backend/.env und die .env-Sicherung: enthalten Session-Secret und die Authentik-Zugangsdaten. Vorlage ist backend/.env.example. - data/: die Datenbank mit den echten Zeiterfassungen. - node_modules/. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
# Caddy - Beispiel für die Timer App
|
||||
#
|
||||
# Caddy holt und erneuert das Zertifikat selbst. Bei dieser Variante
|
||||
# in der .env COOKIE_SECURE=true und HOST=127.0.0.1 setzen.
|
||||
|
||||
timer.firma.example {
|
||||
header {
|
||||
Strict-Transport-Security "max-age=31536000; includeSubDomains"
|
||||
X-Frame-Options "SAMEORIGIN"
|
||||
X-Content-Type-Options "nosniff"
|
||||
Referrer-Policy "no-referrer"
|
||||
}
|
||||
|
||||
reverse_proxy 127.0.0.1:3003 {
|
||||
# /health antwortet ohne Anmeldung
|
||||
health_uri /health
|
||||
health_interval 30s
|
||||
health_timeout 10s
|
||||
}
|
||||
|
||||
log {
|
||||
output file /var/log/caddy/timer.log {
|
||||
roll_size 100mb
|
||||
roll_keep 5
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Variante: nur im internen Netz, ohne öffentliches Zertifikat.
|
||||
# Caddy stellt dann ein selbstsigniertes Zertifikat aus (Browser-Warnung beim
|
||||
# ersten Aufruf). COOKIE_SECURE darf hier true bleiben, weil HTTPS gesprochen
|
||||
# wird.
|
||||
#
|
||||
# https://timer.intern:443 {
|
||||
# tls internal
|
||||
# reverse_proxy 127.0.0.1:3003
|
||||
# }
|
||||
@@ -0,0 +1,55 @@
|
||||
# nginx - Beispiel für die Timer App
|
||||
#
|
||||
# Bei dieser Variante in der .env:
|
||||
# HOST=127.0.0.1
|
||||
# TRUST_PROXY=1
|
||||
# COOKIE_SECURE=true
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name timer.firma.example;
|
||||
return 301 https://$host$request_uri;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 443 ssl http2;
|
||||
server_name timer.firma.example;
|
||||
|
||||
ssl_certificate /etc/letsencrypt/live/timer.firma.example/fullchain.pem;
|
||||
ssl_certificate_key /etc/letsencrypt/live/timer.firma.example/privkey.pem;
|
||||
|
||||
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;
|
||||
add_header X-Frame-Options "SAMEORIGIN" always;
|
||||
add_header X-Content-Type-Options "nosniff" always;
|
||||
add_header Referrer-Policy "no-referrer" always;
|
||||
|
||||
# CSV-Export darf auch bei vielen Einträgen dauern
|
||||
client_max_body_size 1m;
|
||||
proxy_read_timeout 120s;
|
||||
|
||||
location / {
|
||||
proxy_pass http://127.0.0.1:3003;
|
||||
proxy_http_version 1.1;
|
||||
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
# Ohne diese Zeile hält die App die Verbindung für unverschlüsselt
|
||||
# und das secure-Cookie kommt nicht zustande:
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
}
|
||||
}
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Variante ohne TLS, rein intern (z. B. http://timer.intern):
|
||||
# Dann in der .env COOKIE_SECURE=false setzen, sonst scheitert der Login stumm.
|
||||
#
|
||||
# server {
|
||||
# listen 80;
|
||||
# server_name timer.intern;
|
||||
# location / {
|
||||
# proxy_pass http://127.0.0.1:3003;
|
||||
# proxy_set_header Host $host;
|
||||
# proxy_set_header X-Forwarded-Proto $scheme;
|
||||
# }
|
||||
# }
|
||||
@@ -0,0 +1,45 @@
|
||||
[Unit]
|
||||
Description=Timer App - Zeiterfassung
|
||||
Documentation=file:///opt/timer-app/DEPLOY.md
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
|
||||
# --- Anpassen ---------------------------------------------------------------
|
||||
WorkingDirectory=/opt/timer-app/backend
|
||||
ExecStart=/usr/bin/node server.js
|
||||
User=timerapp
|
||||
Group=timerapp
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
Restart=always
|
||||
RestartSec=10
|
||||
|
||||
Environment=NODE_ENV=production
|
||||
# Zeitzone bestimmt die Tagesgrenzen im Historien-Filter
|
||||
Environment=TZ=Europe/Berlin
|
||||
|
||||
# Ausgabe landet im Journal: journalctl -u timer-app -f
|
||||
StandardOutput=journal
|
||||
StandardError=journal
|
||||
|
||||
# --- Härtung ----------------------------------------------------------------
|
||||
NoNewPrivileges=true
|
||||
PrivateTmp=true
|
||||
ProtectSystem=strict
|
||||
ProtectHome=true
|
||||
ProtectKernelTunables=true
|
||||
ProtectKernelModules=true
|
||||
ProtectControlGroups=true
|
||||
RestrictSUIDSGID=true
|
||||
RestrictNamespaces=true
|
||||
LockPersonality=true
|
||||
|
||||
# Einziger Pfad mit Schreibrecht: das Datenverzeichnis
|
||||
ReadWritePaths=/opt/timer-app/data
|
||||
|
||||
LimitNOFILE=4096
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
Reference in New Issue
Block a user