Files
michaelschiemer/ansible/netcup-simple-deploy/QUICK-SETUP.md

2.4 KiB

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

# 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

# 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:

# 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)

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)

app.get('/health', (req, res) => {
  res.json({ status: 'ok', timestamp: new Date().toISOString() });
});

4. Deployment

# Einfach deployen
make deploy

# Oder manuell
./deploy.sh

5. Troubleshooting

Server nicht erreichbar?

# Ping testen
ping DEINE-SERVER-IP

# SSH testen
ssh root@DEINE-SERVER-IP

# Firewall prüfen (auf dem Server)
ufw status

SSL-Probleme?

# DNS prüfen
nslookup DEINE-DOMAIN

# Certbot manuell
ssh root@DEINE-SERVER-IP
certbot certificates

App startet nicht?

# 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

7. Updates

# 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! 🎉