# Netcup Quick Setup Guide ## 1. Server vorbereiten ### Netcup VPS bestellen - **Mindestens:** VPS 200 G8 (2 CPU, 4GB RAM) - **OS:** Ubuntu 22.04 LTS - **Netzwerk:** IPv4 + IPv6 ### SSH-Key installieren ```bash # SSH-Key generieren (falls noch nicht vorhanden) ssh-keygen -t ed25519 -C "netcup-deploy" # Key zum Server kopieren ssh-copy-id root@DEINE-SERVER-IP ``` ## 2. Konfiguration ### Basis-Einstellungen ```bash # Server-Details eintragen vim inventory/hosts.yml ``` **Wichtig ändern:** - `ansible_host: 85.123.456.789` → deine Netcup IP - `domain: "example.com"` → deine Domain - `ssl_email: "admin@example.com"` → deine E-Mail - `git_repo: "https://github.com/user/repo.git"` → dein Git Repository ### DNS konfigurieren Stelle sicher dass deine Domain zur Netcup IP zeigt: ```bash # A-Record setzen example.com. IN A DEINE-NETCUP-IP ``` ## 3. App-Anforderungen Deine App braucht: - **Dockerfile** im Repository-Root - **Port 3000** (oder ändere `app_port` in hosts.yml) - **Health-Check** Endpoint `/health` (oder ändere `health_check_url`) ### Beispiel Dockerfile (Node.js) ```dockerfile FROM node:18-alpine WORKDIR /app COPY package*.json ./ RUN npm ci --only=production COPY . . EXPOSE 3000 CMD ["npm", "start"] ``` ### Beispiel Health-Check (Express.js) ```javascript app.get('/health', (req, res) => { res.json({ status: 'ok', timestamp: new Date().toISOString() }); }); ``` ## 4. Deployment ```bash # Einfach deployen make deploy # Oder manuell ./deploy.sh ``` ## 5. Troubleshooting ### Server nicht erreichbar? ```bash # Ping testen ping DEINE-SERVER-IP # SSH testen ssh root@DEINE-SERVER-IP # Firewall prüfen (auf dem Server) ufw status ``` ### SSL-Probleme? ```bash # DNS prüfen nslookup DEINE-DOMAIN # Certbot manuell ssh root@DEINE-SERVER-IP certbot certificates ``` ### App startet nicht? ```bash # Logs anschauen make logs # Container status ansible all -m shell -a "docker ps -a" # Ins Container einsteigen ansible all -m shell -a "docker exec -it CONTAINER_NAME sh" ``` ## 6. Nach dem Deployment - ✅ **App testen:** https://deine-domain.com - ✅ **Health-Check:** https://deine-domain.com/health - ✅ **SSL prüfen:** https://www.ssllabs.com/ssltest/ - ✅ **Performance:** https://pagespeed.web.dev/ ## 7. Updates ```bash # App updaten (git pull + rebuild) make update # Logs nach Update prüfen make logs ``` Das war's! Deine App läuft jetzt auf Netcup mit SSL! 🎉