mirror of
https://github.com/complexcaresolutions/cms.c2sgmbh.git
synced 2026-03-17 19:44:12 +00:00
- Add comprehensive Git & GitHub documentation - GitHub CLI installation instructions - Git configuration (HTTPS and SSH) - .gitignore best practices - Git workflow and commit conventions - Useful Git and GitHub CLI commands - Backup via Git (exception handling) - Update deployment workflow - Add detailed 4-step deployment process - Show Dev → GitHub → Production flow - Include verification steps - Document Git setup on both servers - Add comprehensive deployment commands 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
939 lines
33 KiB
Markdown
939 lines
33 KiB
Markdown
# TECHSTACK DOKUMENTATION - DEZEMBER 2025
|
|
|
|
## Infrastruktur-Gesamtübersicht
|
|
|
|
```
|
|
┌─────────────────────────────────────────────────────────────────────────────────────┐
|
|
│ GESAMTARCHITEKTUR │
|
|
│ │
|
|
│ ┌───────────────────────────────────────────────────────────────────────────────┐ │
|
|
│ │ LOKALE ENTWICKLUNGSUMGEBUNG │ │
|
|
│ │ (Proxmox VE Cluster) │ │
|
|
│ │ LAN: 10.10.181.0/24 │ │
|
|
│ │ │ │
|
|
│ │ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │ │
|
|
│ │ │ sv-payload │ │ sv-postgres │ │sv-dev-payload│ │sv-analytics │ │ │
|
|
│ │ │ LXC 700 │ │ LXC 701 │ │ LXC 702 │ │ LXC 703 │ │ │
|
|
│ │ │ Payload CMS │ │ PostgreSQL │ │ Next.js │ │ Umami │ │ │
|
|
│ │ │10.10.181.100│ │10.10.181.101│ │10.10.181.102│ │10.10.181.103│ │ │
|
|
│ │ │ + Redis │ │ │ │ │ │ │ │ │
|
|
│ │ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ │ │
|
|
│ └───────────────────────────────────────────────────────────────────────────────┘ │
|
|
│ │ │
|
|
│ ┌───────────────────┴───────────────────┐ │
|
|
│ │ LOKALER INTERNETZUGANG │ │
|
|
│ │ 850 Mbps ↓ / 50 Mbps ↑ │ │
|
|
│ │ │ │
|
|
│ │ Feste IP-Adressen: │ │
|
|
│ │ 37.24.237.178 - Router │ │
|
|
│ │ 37.24.237.179 - complexcaresolutions │ │
|
|
│ │ 37.24.237.180 - Nginx Proxy Manager │ │
|
|
│ │ 37.24.237.181 - pl.c2sgmbh.de │ │
|
|
│ │ 37.24.237.182 - frei │ │
|
|
│ └───────────────────┬───────────────────┘ │
|
|
│ │ │
|
|
│ INTERNET │
|
|
│ │ │
|
|
│ ┌──────────────────────────────────┼──────────────────────────────────┐ │
|
|
│ │ │ │ │
|
|
│ ▼ ▼ ▼ │
|
|
│ ┌─────────────────────┐ ┌─────────────────────┐ ┌─────────────────────┐ │
|
|
│ │ HETZNER 1 │ │ HETZNER 2 │ │ HETZNER 3 │ │
|
|
│ │ CCS GmbH │ │ Martin Porwoll │ │ Backend/Analytics │ │
|
|
│ │ │ │ │ │ │ │
|
|
│ │ 78.46.87.137 │ │ 94.130.141.114 │ │ 162.55.85.18 │ │
|
|
│ │ Debian 12.12 │ │ Ubuntu 24.04 │ │ Debian 13 │ │
|
|
│ │ Plesk │ │ Plesk │ │ Native │ │
|
|
│ │ │ │ │ │ │ │
|
|
│ │ Next.js Frontends │ │ Next.js Frontends │ │ ✅ Payload CMS │ │
|
|
│ │ • complexcare... │ │ • porwoll.de │ │ ✅ Umami │ │
|
|
│ │ • gunshin.de │ │ • caroline-... │ │ ✅ PostgreSQL 17 │ │
|
|
│ └─────────────────────┘ └─────────────────────┘ │ ✅ Redis Cache │ │
|
|
│ │ ✅ Claude Code │ │
|
|
│ └─────────────────────┘ │
|
|
│ │
|
|
└─────────────────────────────────────────────────────────────────────────────────────┘
|
|
```
|
|
|
|
---
|
|
|
|
## Server-Details
|
|
|
|
### HETZNER 3 - Backend & Analytics (NEU)
|
|
|
|
| Eigenschaft | Wert |
|
|
|-------------|------|
|
|
| **Hostname** | sv-hz03-backend |
|
|
| **IP-Adresse** | 162.55.85.18 |
|
|
| **Betriebssystem** | Debian 13 "Trixie" |
|
|
| **CPU** | AMD Ryzen 5 3600 (6 Cores / 12 Threads) |
|
|
| **RAM** | 64 GB DDR4 ECC |
|
|
| **Storage** | 2x 512 GB NVMe SSD (Software RAID 1) |
|
|
| **Netzwerk** | 1 Gbit/s (garantiert) |
|
|
| **Traffic** | Unbegrenzt |
|
|
| **Kosten** | ~€52/Monat |
|
|
|
|
#### Services auf Hetzner 3
|
|
|
|
| Service | User | Port | URL | Status |
|
|
|---------|------|------|-----|--------|
|
|
| PostgreSQL 17 | postgres | 5432 | localhost | ✅ Läuft |
|
|
| Payload CMS | payload | 3001 | https://cms.c2sgmbh.de | ✅ Läuft |
|
|
| Umami Analytics | umami | 3000 | https://analytics.c2sgmbh.de | ✅ Läuft |
|
|
| Redis Cache | redis | 6379 | localhost | ✅ Läuft |
|
|
| Nginx | root | 80/443 | Reverse Proxy | ✅ Läuft |
|
|
| Claude Code | claude | - | CLI Tool | ✅ Installiert |
|
|
|
|
#### System-User
|
|
|
|
| User | Zweck | Home-Verzeichnis |
|
|
|------|-------|------------------|
|
|
| root | System-Administration | /root |
|
|
| payload | Payload CMS | /home/payload |
|
|
| umami | Umami Analytics | /home/umami |
|
|
| claude | Claude Code / Server-Admin | /home/claude |
|
|
|
|
#### SSH-Zugang
|
|
|
|
```bash
|
|
ssh root@162.55.85.18
|
|
ssh payload@162.55.85.18
|
|
ssh umami@162.55.85.18
|
|
ssh claude@162.55.85.18
|
|
```
|
|
|
|
---
|
|
|
|
### HETZNER 1 - Complex Care Solutions GmbH
|
|
|
|
| Eigenschaft | Wert |
|
|
|-------------|------|
|
|
| **Eigentümer** | Complex Care Solutions GmbH |
|
|
| **IP-Adresse** | 78.46.87.137 |
|
|
| **Betriebssystem** | Debian 12.12 |
|
|
| **Control Panel** | Plesk Web Pro Edition 18.0.73 |
|
|
| **CPU** | AMD Ryzen 7 Pro 8700GE |
|
|
| **RAM** | 64 GB |
|
|
| **Storage** | 2x 512 GB NVMe SSD (Software RAID 1) |
|
|
| **Max. Domains** | 30 |
|
|
|
|
#### Domains auf Hetzner 1
|
|
|
|
| Domain | DNS/Weiterleitung | Zweck |
|
|
|--------|-------------------|-------|
|
|
| **complexcaresolutions.de** | A: 78.46.87.137 | Hauptdomain |
|
|
| complexcaresolutions.at/ch/eu/nl | → complexcaresolutions.de | Redirects |
|
|
| complexcaresolutions.org | A: 78.46.87.137 | Alternate |
|
|
| complex-care-solutions.com | A: 78.46.87.137 | International |
|
|
| **gunshin.de** | Vorlage: Standard | Portfolio/Holding |
|
|
| c2sgmbh.de | → complexcaresolutions.de | Kurzform |
|
|
| zweitmeinung-*.de | → complexcaresolutions.de | Fachgebiete |
|
|
|
|
---
|
|
|
|
### HETZNER 2 - Martin Porwoll (privat)
|
|
|
|
| Eigenschaft | Wert |
|
|
|-------------|------|
|
|
| **Eigentümer** | Martin Porwoll (privat) |
|
|
| **IP-Adresse** | 94.130.141.114 |
|
|
| **Betriebssystem** | Ubuntu 24.04 LTS |
|
|
| **Control Panel** | Plesk Web Pro Edition 18.0.73 |
|
|
| **CPU** | Intel Xeon E3-1275v6 |
|
|
| **RAM** | 64 GB |
|
|
| **Storage** | 2x 512 GB NVMe SSD (Software RAID 1) |
|
|
| **Max. Domains** | 30 |
|
|
|
|
#### Domains auf Hetzner 2
|
|
|
|
| Domain | DNS/Weiterleitung | Zweck |
|
|
|--------|-------------------|-------|
|
|
| **porwoll.de** | A: 94.130.141.114 | Hauptdomain |
|
|
| **caroline-porwoll.de** | A: 94.130.141.114 | Dr. Caroline Porwoll |
|
|
| caroline-porwoll.com | A: 94.130.141.114 | International |
|
|
| porwoll.com/cloud/live/shop/tech | Vorlage: Standard | Varianten |
|
|
|
|
---
|
|
|
|
### Lokale Infrastruktur (Proxmox)
|
|
|
|
| Server | IP | Port | Funktion | OS |
|
|
|--------|-----|------|----------|-----|
|
|
| sv-payload | 10.10.181.100 | 3000 | Payload CMS (Dev) + Redis | Debian 13 |
|
|
| sv-postgres | 10.10.181.101 | 5432 | PostgreSQL (Dev) | Debian 13 |
|
|
| sv-dev-payload | 10.10.181.102 | 3001 | Next.js Frontend | Debian 13 |
|
|
| sv-analytics | 10.10.181.103 | 3000 | Umami (Dev) | Debian 13 |
|
|
|
|
#### Feste IP-Adressen (Lokal)
|
|
|
|
| IP | Verwendung |
|
|
|----|------------|
|
|
| 37.24.237.178 | Router / Gateway |
|
|
| 37.24.237.179 | complexcaresolutions.cloud |
|
|
| 37.24.237.180 | Nginx Proxy Manager |
|
|
| 37.24.237.181 | pl.c2sgmbh.de (Payload Dev) |
|
|
| 37.24.237.182 | **Frei** |
|
|
|
|
---
|
|
|
|
## Credentials
|
|
|
|
### sv-hz03-backend (162.55.85.18) - Produktion
|
|
|
|
#### PostgreSQL
|
|
|
|
| Datenbank | User | Passwort |
|
|
|-----------|------|----------|
|
|
| payload_db | payload | Suchen55 |
|
|
| umami_db | umami | Suchen55 |
|
|
|
|
#### Redis
|
|
|
|
```bash
|
|
redis-cli -h localhost -p 6379
|
|
# Kein Passwort (nur localhost)
|
|
```
|
|
|
|
#### Umami Analytics
|
|
|
|
| URL | User | Passwort |
|
|
|-----|------|----------|
|
|
| https://analytics.c2sgmbh.de | admin | ⚠️ ÄNDERN! (Standard: umami) |
|
|
|
|
#### Payload CMS
|
|
|
|
| URL | User | Passwort |
|
|
|-----|------|----------|
|
|
| https://cms.c2sgmbh.de/admin | [wie Dev] | [wie Dev] |
|
|
|
|
#### Environment Variables - Payload (.env)
|
|
|
|
```env
|
|
DATABASE_URI=postgresql://payload:Suchen55@localhost:5432/payload_db
|
|
PAYLOAD_SECRET=hxPARlMkmv+ZdCOAMw+N4o2x4mNbERB237iDQTYXALY=
|
|
PAYLOAD_PUBLIC_SERVER_URL=https://cms.c2sgmbh.de
|
|
NEXT_PUBLIC_SERVER_URL=https://cms.c2sgmbh.de
|
|
NODE_ENV=production
|
|
PORT=3001
|
|
CONSENT_LOGGING_API_KEY=7644095c1be9b726ac6c1433c7a544f4d99b55337d70f52c8dc85a4b76ef9f1a
|
|
IP_ANONYMIZATION_PEPPER=18f2d29f1ead67f15fec88ee2357565a6c0073394bcd085ef636f877954bd546
|
|
REDIS_HOST=localhost
|
|
REDIS_PORT=6379
|
|
```
|
|
|
|
#### Environment Variables - Umami (.env)
|
|
|
|
```env
|
|
DATABASE_URL=postgresql://umami:Suchen55@localhost:5432/umami_db
|
|
APP_SECRET=aqwsOyaH/1IyWHby+Ni5e5IIt/soJwvWcfxMM6kwYS0=
|
|
TRACKER_SCRIPT_NAME=custom
|
|
COLLECT_API_ENDPOINT=/api/send
|
|
DISABLE_TELEMETRY=1
|
|
```
|
|
|
|
---
|
|
|
|
### pl.c2sgmbh.de (Entwicklung)
|
|
|
|
#### PostgreSQL (sv-postgres)
|
|
|
|
| Datenbank | User | Passwort |
|
|
|-----------|------|----------|
|
|
| payload_db | payload | Finden55 |
|
|
|
|
#### Redis (sv-payload)
|
|
|
|
```bash
|
|
redis-cli -h localhost -p 6379
|
|
# Kein Passwort (nur localhost)
|
|
```
|
|
|
|
#### Environment Variables (.env)
|
|
|
|
```env
|
|
DATABASE_URI=postgresql://payload:Finden55@10.10.181.101:5432/payload_db
|
|
PAYLOAD_SECRET=a53b254070d3fffd2b5cfcc3
|
|
PAYLOAD_PUBLIC_SERVER_URL=https://pl.c2sgmbh.de
|
|
NEXT_PUBLIC_SERVER_URL=https://pl.c2sgmbh.de
|
|
NODE_ENV=production
|
|
PORT=3000
|
|
CONSENT_LOGGING_API_KEY=7644095c1be9b726ac6c1433c7a544f4d99b55337d70f52c8dc85a4b76ef9f1a
|
|
IP_ANONYMIZATION_PEPPER=18f2d29f1ead67f15fec88ee2357565a6c0073394bcd085ef636f877954bd546
|
|
REDIS_HOST=localhost
|
|
REDIS_PORT=6379
|
|
```
|
|
|
|
---
|
|
|
|
## Redis Caching
|
|
|
|
### Architektur
|
|
|
|
```
|
|
┌─────────────────────────────────────────────────────────────────────────────────────┐
|
|
│ REDIS CACHING STRATEGIE │
|
|
│ │
|
|
│ Request → Payload CMS → Redis Cache? │
|
|
│ │ │
|
|
│ ┌────┴────┐ │
|
|
│ HIT MISS │
|
|
│ │ │ │
|
|
│ ▼ ▼ │
|
|
│ Return PostgreSQL → Cache in Redis → Return │
|
|
│ │
|
|
│ Cache-Typen: │
|
|
│ • API Response Cache (GET /api/pages, /api/posts) │
|
|
│ • Automatische Invalidierung bei Content-Änderungen │
|
|
│ │
|
|
│ Konfiguration: │
|
|
│ • Max Memory: 2GB (Prod) / 512MB (Dev) │
|
|
│ • Eviction: allkeys-lru │
|
|
│ • TTL: 5 Minuten (Standard) │
|
|
│ │
|
|
└─────────────────────────────────────────────────────────────────────────────────────┘
|
|
```
|
|
|
|
### Redis Befehle
|
|
|
|
```bash
|
|
# Status prüfen
|
|
redis-cli ping
|
|
|
|
# Statistiken
|
|
redis-cli info stats
|
|
|
|
# Cache-Keys anzeigen
|
|
redis-cli keys "*"
|
|
|
|
# Cache leeren
|
|
redis-cli flushdb
|
|
|
|
# Live-Monitoring
|
|
redis-cli monitor
|
|
```
|
|
|
|
### Cache-Dateien im Projekt
|
|
|
|
```
|
|
src/
|
|
├── lib/
|
|
│ ├── redis.ts # Redis Client & Cache Helper
|
|
│ └── cache-keys.ts # Cache Key Definitionen
|
|
└── hooks/
|
|
└── invalidateCache.ts # Cache Invalidierung bei Content-Änderungen
|
|
```
|
|
|
|
---
|
|
|
|
## Claude Code
|
|
|
|
### Installation auf sv-hz03-backend
|
|
|
|
```bash
|
|
ssh claude@162.55.85.18
|
|
claude
|
|
```
|
|
|
|
### CLAUDE.md Standort
|
|
|
|
```
|
|
/home/claude/CLAUDE.md
|
|
```
|
|
|
|
### Berechtigungen
|
|
|
|
| Berechtigung | Status |
|
|
|--------------|--------|
|
|
| sudo systemctl restart nginx | ✅ NOPASSWD |
|
|
| sudo systemctl restart postgresql | ✅ NOPASSWD |
|
|
| sudo systemctl status * | ✅ NOPASSWD |
|
|
| sudo su - payload | ✅ NOPASSWD |
|
|
| sudo su - umami | ✅ NOPASSWD |
|
|
| sudo redis-cli * | ✅ NOPASSWD |
|
|
|
|
### Häufige Claude Code Aufgaben
|
|
|
|
```bash
|
|
# Service-Status
|
|
sudo su - payload -c "pm2 status"
|
|
sudo systemctl status nginx postgresql redis-server
|
|
|
|
# Logs
|
|
sudo su - payload -c "pm2 logs payload"
|
|
sudo tail -f /var/log/nginx/error.log
|
|
|
|
# Deployment
|
|
sudo su - payload -c "~/deploy.sh"
|
|
|
|
# Backup
|
|
sudo su - payload -c "~/backup.sh"
|
|
|
|
# Redis Monitor
|
|
sudo redis-cli monitor
|
|
```
|
|
|
|
---
|
|
|
|
## Git & GitHub
|
|
|
|
### Repository
|
|
|
|
| Eigenschaft | Wert |
|
|
|-------------|------|
|
|
| **Repository** | https://github.com/c2s-admin/cms.c2sgmbh.git |
|
|
| **Visibility** | Private |
|
|
| **Owner** | c2s-admin |
|
|
| **Branch** | main |
|
|
|
|
### GitHub CLI Installation
|
|
|
|
**Auf Debian/Ubuntu:**
|
|
|
|
```bash
|
|
# GPG-Schlüssel hinzufügen
|
|
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
|
|
sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg
|
|
|
|
# Repository hinzufügen
|
|
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list
|
|
|
|
# Installation
|
|
sudo apt update
|
|
sudo apt install gh -y
|
|
```
|
|
|
|
### GitHub Authentifizierung
|
|
|
|
```bash
|
|
# Mit Web-Authentifizierung
|
|
gh auth login --web
|
|
|
|
# Status prüfen
|
|
gh auth status
|
|
```
|
|
|
|
### Git-Konfiguration
|
|
|
|
**Remote Repository:**
|
|
|
|
```bash
|
|
# HTTPS (empfohlen für gh auth)
|
|
git remote add origin https://github.com/c2s-admin/cms.c2sgmbh.git
|
|
|
|
# Remote prüfen
|
|
git remote -v
|
|
|
|
# Remote URL ändern (falls nötig)
|
|
git remote set-url origin https://github.com/c2s-admin/cms.c2sgmbh.git
|
|
```
|
|
|
|
**SSH-Keys (Alternative):**
|
|
|
|
```bash
|
|
# SSH-Key generieren
|
|
ssh-keygen -t ed25519 -C "payload@c2sgmbh.de"
|
|
|
|
# Public Key zu GitHub hinzufügen
|
|
cat ~/.ssh/id_ed25519.pub
|
|
# → Auf GitHub.com: Settings → SSH and GPG keys → New SSH key
|
|
|
|
# SSH Remote verwenden
|
|
git remote set-url origin git@github.com:c2s-admin/cms.c2sgmbh.git
|
|
```
|
|
|
|
### .gitignore (Wichtig!)
|
|
|
|
Sensible Dateien, die NICHT committed werden dürfen:
|
|
|
|
```gitignore
|
|
# Environment Variables
|
|
.env
|
|
.env*.local
|
|
|
|
# Build-Ausgaben
|
|
/.next/
|
|
/build
|
|
/out
|
|
|
|
# Dependencies
|
|
/node_modules
|
|
|
|
# Backups & Datenbanken
|
|
*.sql
|
|
*.sql.gz
|
|
/backups/
|
|
|
|
# Media-Uploads
|
|
/media
|
|
|
|
# Logs
|
|
*.log
|
|
```
|
|
|
|
### Git Workflow
|
|
|
|
**Entwicklung (pl.c2sgmbh.de):**
|
|
|
|
```bash
|
|
cd /home/payload/payload-cms
|
|
|
|
# Status prüfen
|
|
git status
|
|
|
|
# Änderungen stagen
|
|
git add .
|
|
|
|
# Commit erstellen
|
|
git commit -m "feat: Beschreibung der Änderung"
|
|
|
|
# Zu GitHub pushen
|
|
git push origin main
|
|
```
|
|
|
|
**Commit Message Konventionen:**
|
|
|
|
```
|
|
feat: Neues Feature
|
|
fix: Bugfix
|
|
chore: Wartung/Cleanup
|
|
docs: Dokumentation
|
|
refactor: Code-Refactoring
|
|
style: Formatierung
|
|
test: Tests
|
|
```
|
|
|
|
### Nützliche Git-Befehle
|
|
|
|
```bash
|
|
# Letzte Commits anzeigen
|
|
git log --oneline -10
|
|
|
|
# Änderungen anzeigen
|
|
git diff
|
|
git diff --staged
|
|
|
|
# Änderungen rückgängig machen
|
|
git restore <file> # Unstaged Änderungen verwerfen
|
|
git restore --staged <file> # Aus Staging entfernen
|
|
|
|
# Branch-Info
|
|
git branch -a
|
|
git status
|
|
|
|
# Von GitHub pullen
|
|
git pull origin main
|
|
|
|
# Merge-Konflikte prüfen
|
|
git diff --name-only --diff-filter=U
|
|
```
|
|
|
|
### GitHub CLI Befehle
|
|
|
|
```bash
|
|
# Repository anzeigen
|
|
gh repo view
|
|
gh repo view --web
|
|
|
|
# Issues
|
|
gh issue list
|
|
gh issue create
|
|
|
|
# Pull Requests
|
|
gh pr list
|
|
gh pr create
|
|
|
|
# Repository klonen
|
|
gh repo clone c2s-admin/cms.c2sgmbh
|
|
```
|
|
|
|
### Backup über Git (Ausnahme!)
|
|
|
|
**Normalerweise:** SQL-Dateien werden NICHT committed (`.gitignore`)
|
|
|
|
**Ausnahme für Server-Migration:**
|
|
|
|
```bash
|
|
# Backup erzwingen (einmalig!)
|
|
git add -f backup.sql
|
|
git commit -m "chore: temporary database backup for migration"
|
|
git push
|
|
|
|
# ⚠️ WICHTIG: Nach Transfer wieder entfernen!
|
|
git rm backup.sql
|
|
git commit -m "chore: remove database backup after migration"
|
|
git push
|
|
|
|
# Optional: Aus Git-Historie komplett löschen
|
|
git filter-branch --force --index-filter \
|
|
"git rm --cached --ignore-unmatch backup.sql" \
|
|
--prune-empty --tag-name-filter cat -- --all
|
|
git push origin --force --all
|
|
```
|
|
|
|
---
|
|
|
|
## Deployment Workflow
|
|
|
|
```
|
|
┌─────────────────────────────────────────────────────────────────────────────────────┐
|
|
│ DEPLOYMENT WORKFLOW │
|
|
│ │
|
|
│ ┌──────────────────────────────────┐ ┌──────────────────────────────────┐ │
|
|
│ │ ENTWICKLUNG (DEV) │ │ PRODUKTION (PROD) │ │
|
|
│ │ pl.c2sgmbh.de │ │ cms.c2sgmbh.de │ │
|
|
│ │ 37.24.237.181 │ │ 162.55.85.18 │ │
|
|
│ │ 10.10.181.100 (LAN) │ │ │ │
|
|
│ └──────────────────────────────────┘ └──────────────────────────────────┘ │
|
|
│ │
|
|
│ Step 1: CODE ENTWICKELN │
|
|
│ ┌────────────────────────────────────────────────────────────────────────┐ │
|
|
│ │ cd /home/payload/payload-cms │ │
|
|
│ │ # Code ändern, testen │ │
|
|
│ │ pnpm dev # Lokal testen │ │
|
|
│ │ pnpm build # Build-Test │ │
|
|
│ │ pm2 restart payload # Auf Dev-Server deployen │ │
|
|
│ └────────────────────────────────────────────────────────────────────────┘ │
|
|
│ ↓ │
|
|
│ │
|
|
│ Step 2: ZU GITHUB PUSHEN │
|
|
│ ┌────────────────────────────────────────────────────────────────────────┐ │
|
|
│ │ git status # Änderungen prüfen │ │
|
|
│ │ git add . # Alle Änderungen stagen │ │
|
|
│ │ git commit -m "feat: XYZ" # Commit erstellen │ │
|
|
│ │ git push origin main # Zu GitHub pushen │ │
|
|
│ └────────────────────────────────────────────────────────────────────────┘ │
|
|
│ ↓ │
|
|
│ │
|
|
│ ┌────────────────────────────────────────────────────┐ │
|
|
│ │ GITHUB REPOSITORY (PRIVAT) │ │
|
|
│ │ https://github.com/c2s-admin/cms.c2sgmbh │ │
|
|
│ │ │ │
|
|
│ │ ✅ Code gesichert │ │
|
|
│ │ ✅ Versionierung │ │
|
|
│ │ ✅ .env in .gitignore │ │
|
|
│ │ ✅ Backup SQL (temporär, nach Transfer löschen) │ │
|
|
│ └────────────────────────────────────────────────────┘ │
|
|
│ ↓ │
|
|
│ │
|
|
│ Step 3: AUF PRODUKTION DEPLOYEN │
|
|
│ ┌────────────────────────────────────────────────────────────────────────┐ │
|
|
│ │ ssh payload@162.55.85.18 │ │
|
|
│ │ ~/deploy.sh # Automatisches Deployment │ │
|
|
│ │ │ │
|
|
│ │ Das deploy.sh Script macht: │ │
|
|
│ │ ├─ git pull origin main # Code von GitHub holen │ │
|
|
│ │ ├─ pnpm install # Dependencies aktualisieren │ │
|
|
│ │ ├─ pnpm build # Produktions-Build │ │
|
|
│ │ └─ pm2 restart payload # Service neustarten │ │
|
|
│ └────────────────────────────────────────────────────────────────────────┘ │
|
|
│ ↓ │
|
|
│ │
|
|
│ Step 4: VERIFIZIERUNG │
|
|
│ ┌────────────────────────────────────────────────────────────────────────┐ │
|
|
│ │ pm2 status # Prozess läuft? │ │
|
|
│ │ pm2 logs payload --lines 20 # Logs prüfen │ │
|
|
│ │ curl https://cms.c2sgmbh.de/api/globals/site-settings │ │
|
|
│ │ # Browser: https://cms.c2sgmbh.de/admin │ │
|
|
│ └────────────────────────────────────────────────────────────────────────┘ │
|
|
│ │
|
|
└─────────────────────────────────────────────────────────────────────────────────────┘
|
|
```
|
|
|
|
### Git-Setup auf Servern
|
|
|
|
| Server | User | Remote | Auth-Methode | Status |
|
|
|--------|------|--------|--------------|--------|
|
|
| pl.c2sgmbh.de (Dev) | payload | HTTPS | GitHub CLI (`gh auth`) | ✅ Konfiguriert |
|
|
| cms.c2sgmbh.de (Prod) | payload | SSH | SSH-Key | ✅ Eingerichtet |
|
|
|
|
### Deployment-Befehle
|
|
|
|
**Entwicklungsserver → GitHub:**
|
|
|
|
```bash
|
|
# Auf pl.c2sgmbh.de (10.10.181.100)
|
|
cd /home/payload/payload-cms
|
|
|
|
# 1. Änderungen prüfen
|
|
git status
|
|
git diff
|
|
|
|
# 2. Build-Test lokal
|
|
pnpm build
|
|
pm2 restart payload
|
|
|
|
# 3. Testen
|
|
curl https://pl.c2sgmbh.de/api/globals/site-settings
|
|
|
|
# 4. Zu Git committen
|
|
git add .
|
|
git commit -m "feat: Beschreibung der Änderung"
|
|
|
|
# 5. Zu GitHub pushen
|
|
git push origin main
|
|
```
|
|
|
|
**GitHub → Produktionsserver:**
|
|
|
|
```bash
|
|
# Option A: SSH + Deploy-Script (empfohlen)
|
|
ssh payload@162.55.85.18 '~/deploy.sh'
|
|
|
|
# Option B: Manuelles SSH-Login
|
|
ssh payload@162.55.85.18
|
|
cd ~/payload-cms
|
|
git pull origin main
|
|
pnpm install
|
|
pnpm build
|
|
pm2 restart payload
|
|
pm2 logs payload --lines 20
|
|
```
|
|
|
|
### Deploy-Script (~/deploy.sh)
|
|
|
|
```bash
|
|
#!/bin/bash
|
|
set -e
|
|
|
|
echo "🚀 Deployment gestartet..."
|
|
|
|
cd ~/payload-cms
|
|
|
|
echo "📥 Git Pull..."
|
|
git pull origin main
|
|
|
|
echo "📦 Dependencies installieren..."
|
|
pnpm install
|
|
|
|
echo "🔨 Build erstellen..."
|
|
pnpm build
|
|
|
|
echo "🔄 PM2 Neustart..."
|
|
pm2 restart payload
|
|
|
|
echo "✅ Deployment abgeschlossen!"
|
|
pm2 status
|
|
```
|
|
|
|
---
|
|
|
|
## Backup
|
|
|
|
### Backup-Script (~/backup.sh)
|
|
|
|
```bash
|
|
#!/bin/bash
|
|
set -e
|
|
|
|
BACKUP_DIR=~/backups
|
|
DATE=$(date +%Y-%m-%d_%H-%M-%S)
|
|
RETENTION_DAYS=7
|
|
|
|
mkdir -p $BACKUP_DIR
|
|
|
|
echo "🔄 Backup gestartet: $DATE"
|
|
|
|
# PostgreSQL Backup
|
|
PGPASSWORD=Suchen55 pg_dump -h localhost -U payload payload_db > $BACKUP_DIR/payload_db_$DATE.sql
|
|
PGPASSWORD=Suchen55 pg_dump -h localhost -U umami umami_db > $BACKUP_DIR/umami_db_$DATE.sql
|
|
|
|
# Komprimieren
|
|
gzip $BACKUP_DIR/payload_db_$DATE.sql
|
|
gzip $BACKUP_DIR/umami_db_$DATE.sql
|
|
|
|
# Alte Backups löschen
|
|
find $BACKUP_DIR -name "*.sql.gz" -mtime +$RETENTION_DAYS -delete
|
|
|
|
echo "✅ Backup abgeschlossen!"
|
|
ls -lh $BACKUP_DIR/*.sql.gz 2>/dev/null | tail -10
|
|
```
|
|
|
|
### Cronjob (täglich 3:00 Uhr)
|
|
|
|
```
|
|
0 3 * * * /home/payload/backup.sh >> /home/payload/backups/backup.log 2>&1
|
|
```
|
|
|
|
### Backup-Speicherort
|
|
|
|
```
|
|
/home/payload/backups/
|
|
├── payload_db_2025-12-05_03-00-00.sql.gz
|
|
├── umami_db_2025-12-05_03-00-00.sql.gz
|
|
└── backup.log
|
|
```
|
|
|
|
---
|
|
|
|
## Service-Management
|
|
|
|
### PM2 Befehle
|
|
|
|
```bash
|
|
# Status
|
|
pm2 status
|
|
|
|
# Logs
|
|
pm2 logs payload
|
|
pm2 logs umami
|
|
|
|
# Neustart
|
|
pm2 restart payload
|
|
pm2 restart umami
|
|
|
|
# Alle neustarten
|
|
pm2 restart all
|
|
|
|
# Speichern für Autostart
|
|
pm2 save
|
|
```
|
|
|
|
### Systemd Services
|
|
|
|
```bash
|
|
# PostgreSQL
|
|
systemctl status postgresql
|
|
systemctl restart postgresql
|
|
|
|
# Nginx
|
|
systemctl status nginx
|
|
systemctl restart nginx
|
|
nginx -t # Config testen
|
|
|
|
# Redis
|
|
systemctl status redis-server
|
|
systemctl restart redis-server
|
|
```
|
|
|
|
---
|
|
|
|
## URLs Übersicht
|
|
|
|
| Service | Entwicklung | Produktion |
|
|
|---------|-------------|------------|
|
|
| Payload Admin | https://pl.c2sgmbh.de/admin | https://cms.c2sgmbh.de/admin |
|
|
| Payload API | https://pl.c2sgmbh.de/api | https://cms.c2sgmbh.de/api |
|
|
| Umami | - | https://analytics.c2sgmbh.de |
|
|
|
|
---
|
|
|
|
## SSH Schnellzugriff
|
|
|
|
```bash
|
|
# Produktion (Hetzner 3)
|
|
ssh root@162.55.85.18 # Root
|
|
ssh payload@162.55.85.18 # Payload User
|
|
ssh umami@162.55.85.18 # Umami User
|
|
ssh claude@162.55.85.18 # Claude Code
|
|
|
|
# Hetzner Server
|
|
ssh root@78.46.87.137 # Hetzner 1 (CCS)
|
|
ssh root@94.130.141.114 # Hetzner 2 (Porwoll)
|
|
|
|
# Entwicklung (Proxmox)
|
|
ssh payload@10.10.181.100 # sv-payload
|
|
ssh root@10.10.181.101 # sv-postgres
|
|
ssh developer@10.10.181.102 # sv-dev-payload
|
|
ssh root@10.10.181.103 # sv-analytics
|
|
```
|
|
|
|
---
|
|
|
|
## Wichtige Dateipfade
|
|
|
|
### sv-hz03-backend (Produktion)
|
|
|
|
```
|
|
/home/payload/
|
|
├── payload-cms/ # Payload CMS
|
|
│ ├── .env # Environment
|
|
│ ├── src/ # Source Code
|
|
│ │ ├── lib/
|
|
│ │ │ ├── redis.ts # Redis Client
|
|
│ │ │ └── cache-keys.ts # Cache Keys
|
|
│ │ └── hooks/
|
|
│ │ └── invalidateCache.ts
|
|
│ └── .next/ # Build Output
|
|
├── deploy.sh # Deployment Script
|
|
├── backup.sh # Backup Script
|
|
└── backups/ # Backups
|
|
|
|
/home/umami/
|
|
└── umami/ # Umami Analytics
|
|
├── .env
|
|
└── .next/
|
|
|
|
/home/claude/
|
|
└── CLAUDE.md # Claude Code Kontext
|
|
```
|
|
|
|
---
|
|
|
|
## Firewall (UFW)
|
|
|
|
```bash
|
|
ufw status verbose
|
|
|
|
# Offene Ports auf sv-hz03-backend:
|
|
# 22/tcp - SSH
|
|
# 80/tcp - HTTP
|
|
# 443/tcp - HTTPS
|
|
```
|
|
|
|
---
|
|
|
|
## SSL Zertifikate
|
|
|
|
| Domain | Anbieter | Ablauf |
|
|
|--------|----------|--------|
|
|
| cms.c2sgmbh.de | Let's Encrypt | 2026-03-05 |
|
|
| analytics.c2sgmbh.de | Let's Encrypt | 2026-03-05 |
|
|
|
|
Auto-Renewal via Certbot Timer.
|
|
|
|
---
|
|
|
|
## Tech Stack
|
|
|
|
| Komponente | Technologie | Version |
|
|
|------------|-------------|---------|
|
|
| CMS | Payload CMS | 3.66.0 |
|
|
| Framework | Next.js | 15.4.7 |
|
|
| Runtime | Node.js | 22.x |
|
|
| Datenbank | PostgreSQL | 17.6 |
|
|
| Cache | Redis | 7.x |
|
|
| Analytics | Umami | 3.x |
|
|
| Process Manager | PM2 | Latest |
|
|
| Package Manager | pnpm | Latest |
|
|
| Reverse Proxy | Nginx | Latest |
|
|
| SSL | Let's Encrypt | - |
|
|
| Server Admin | Claude Code | 2.0.59 |
|
|
|
|
---
|
|
|
|
## Notfall-Kontakte
|
|
|
|
Bei Problemen:
|
|
|
|
1. **Logs prüfen:** `pm2 logs`
|
|
2. **Services neustarten:** `pm2 restart all`
|
|
3. **Nginx prüfen:** `nginx -t && systemctl restart nginx`
|
|
4. **PostgreSQL prüfen:** `systemctl status postgresql`
|
|
5. **Redis prüfen:** `redis-cli ping`
|
|
6. **Claude Code nutzen:** `ssh claude@162.55.85.18` → `claude`
|
|
|
|
---
|
|
|
|
## Checkliste nach Deployment
|
|
|
|
- [ ] `pm2 status` - Alle Prozesse online?
|
|
- [ ] `redis-cli ping` - Redis antwortet?
|
|
- [ ] https://cms.c2sgmbh.de/admin - Admin erreichbar?
|
|
- [ ] https://analytics.c2sgmbh.de - Umami erreichbar?
|
|
- [ ] `pm2 logs payload --lines 10` - Keine Fehler?
|
|
|
|
---
|
|
|
|
*Stand: 05. Dezember 2025*
|
|
*Server: sv-hz03-backend (162.55.85.18)*
|
|
*Setup: Payload CMS + Umami + PostgreSQL + Redis + Claude Code*
|