4.4 KiB
4.4 KiB
CitySensor Docker Registry Integration
🏢 Überblick
Diese Konfiguration ist speziell für die CitySensor Docker Registry (docker.citysensor.de) angepasst und unterstützt:
- ✅ Private Registry Authentication mit Username/Passwort
- ✅ Automatisches Login in Build- und Deployment-Skripten
- ✅ Traefik-Integration für
rezepte.your.domain.com - ✅ CI/CD Pipeline mit GitHub Actions
- ✅ Minimaler Server-Footprint (~60 KB statt Repository-Clone)
🚀 Schnell-Setup
1. Build-Konfiguration erstellen:
cp .env.build.example .env.registry
# Edit .env.registry mit Ihren CitySensor-Zugangsdaten
2. Images bauen und pushen:
./build-and-push.sh
3. Server-Deployment:
# Dateien auf Server kopieren:
scp docker-compose.traefik.yml user@server:/opt/rezepte/
scp .env.production user@server:/opt/rezepte/
scp *.sql user@server:/opt/rezepte/
scp deploy-traefik.sh user@server:/opt/rezepte/
# Auf Server deployen:
ssh user@server
cd /opt/rezepte
./deploy-traefik.sh
📁 Konfigurationsdateien
.env.registry (für Build):
DOMAIN=example.com
API_BASE_URL=https://rezepte.example.com/api
DOCKER_REGISTRY=docker.citysensor.de
DOCKER_USERNAME=your_username
DOCKER_PASSWORD=your_password
MYSQL_PASSWORD=secure_db_password
MYSQL_ROOT_PASSWORD=super_secure_root_password
.env.production (für Server):
DOMAIN=example.com
ACME_EMAIL=admin@example.com
MYSQL_PASSWORD=secure_db_password
MYSQL_ROOT_PASSWORD=super_secure_root_password
DOCKER_REGISTRY=docker.citysensor.de
DOCKER_USERNAME=your_username
DOCKER_PASSWORD=your_password
BACKEND_IMAGE=docker.citysensor.de/rezepte-backend:latest
FRONTEND_IMAGE=docker.citysensor.de/rezepte-frontend:latest
🔧 Registry-Authentifizierung
Manuelles Login:
echo "your_password" | docker login docker.citysensor.de -u your_username --password-stdin
Automatisches Login:
Die Skripte build-and-push.sh, deploy-registry.sh und deploy-traefik.sh führen automatisch ein Login durch, wenn die Umgebungsvariablen gesetzt sind.
🌐 DNS-Konfiguration
Für rezepte.example.com benötigen Sie diese DNS-Einträge:
# A-Records auf Ihre Server-IP:
rezepte.example.com → 1.2.3.4
traefik.example.com → 1.2.3.4
# Oder Wildcard:
*.example.com → 1.2.3.4
🔒 Sicherheitshinweise
- Niemals Credentials committen:
.env.*Dateien sind in.gitignore - Starke Passwörter verwenden: Besonders für Datenbank und Registry
- Traefik Dashboard absichern: Basic Auth konfiguriert (admin/admin - ändern!)
- SSL automatisch: Let's Encrypt Zertifikate werden automatisch erstellt
📊 CI/CD mit GitHub Actions
Repository Secrets konfigurieren:
DOCKER_USERNAME: your_citysensor_username
DOCKER_PASSWORD: your_citysensor_password
PRODUCTION_API_URL: https://rezepte.example.com/api
Repository Variables (optional):
DOCKER_REGISTRY: docker.citysensor.de
🎯 Zugangspunkte nach Deployment
- Hauptanwendung: https://rezepte.example.com
- Traefik Dashboard: https://traefik.example.com
- API: https://rezepte.example.com/api
- Images: https://rezepte.example.com/uploads/...
🛠️ Wartung
Images aktualisieren:
# Lokal: Neue Images bauen und pushen
./build-and-push.sh
# Server: Images pullen und neu starten
./deploy-traefik.sh
Logs anzeigen:
docker-compose -f docker-compose.traefik.yml logs -f
Backup:
./backup.sh
🆘 Troubleshooting
Registry-Login-Probleme:
# Manuell testen:
docker login docker.citysensor.de -u username
# Credentials prüfen:
echo $DOCKER_USERNAME
echo $DOCKER_PASSWORD
SSL-Zertifikat-Probleme:
# DNS prüfen:
nslookup rezepte.example.com
# Traefik Logs:
docker logs traefik
Container-Probleme:
# Status prüfen:
docker-compose -f docker-compose.traefik.yml ps
# Logs einzelner Services:
docker-compose -f docker-compose.traefik.yml logs backend
✅ Checkliste für Go-Live
- DNS-Einträge konfiguriert
.env.productionmit korrekten Werten erstellt- CitySensor Registry-Credentials getestet
- Images erfolgreich gepusht
- Server-Firewall (Ports 80, 443) konfiguriert
- Traefik Dashboard-Passwort geändert
- Backup-Strategie implementiert
- Monitoring eingerichtet
Das System ist produktionsreif und skalierbar! 🚀