𝗛𝗼𝘄 𝘁𝗼 𝗕𝗮𝗰𝗸𝘂𝗽 𝗮𝗻𝗱 𝗥𝗲𝘀𝘁𝗼𝗿𝗲 𝗖𝗼𝗼𝗹𝗶𝗳𝘆 𝗶𝗻 𝟭𝟮 𝗠𝗶𝗻𝘂𝘁𝗲𝘀
Your server feels safe today. You spent hours setting up Coolify. You host your own apps, databases, and blogs. You feel in control.
Then a disaster happens. Your VPS provider shuts down your region. You run a wrong command. The server dies.
If you have no backups, you lose everything. This guide prevents that. You can set up automated backups and a full restore in 12 minutes.
Step 1: Set up S3 Storage
Coolify needs a place to store backups. Use S3-compatible storage. Cloudflare R2 is a great choice because it has zero egress fees.
You need these details from your storage provider:
- Endpoint
- Region
- Access Key
- Secret Key
- Bucket Name
In Coolify, go to the S3 Storage tab. Add your details and click Validate Connection.
Step 2: Enable Automated Backups
Go to Settings and then Backup.
- Turn on S3 Backup.
- Turn on Backup.
- Select your S3 storage source.
- Set the frequency to Daily.
Run one manual backup immediately. Check your S3 bucket to confirm the file exists.
Step 3: Save Your APP_KEY
This is the most important step. Coolify encrypts your data. If you lose this key, your backup is useless.
SSH into your server and run: cat /data/coolify/source/.env
Find the line starting with APP_KEY. Copy this value. Save it in a password manager. Do not skip this.
Step 4: Restore to a New Server
If your server dies, follow these steps on your new VPS:
- Install Coolify using the standard curl command.
- Download your .pgdump file from your S3 bucket to the new server.
- Run the restore command:
sudo docker exec -i coolify-db pg_restore --username coolify --verbose --dbname coolify < /path/to/your-backup.pgdump
You might see warnings about existing tables. Ignore them. It still works.
Step 5: Fix the 500 Error
After restoring, you might see a 500 error when clicking apps. This happens because the new server has a different APP_KEY.
To fix this:
- Open your new .env file: nano /data/coolify/source/.env
- Add this line: APP_PREVIOUS_KEYS=base64:your-old-app-key
- Save and restart Coolify using the install script.
Now your old data is readable again.
Summary Checklist:
- Set up S3 storage.
- Enable daily backups.
- Save your APP_KEY safely.
- Test a manual backup.
Self-hosting gives you control. Backups give you peace of mind.
Wie man Coolify in 12 Minuten sichert und wiederherstellt (Bevor dein Server an einem Freitagabend den Geist aufgibt)
Wir alle kennen das. Es ist Freitagabend, du willst dich gerade entspannen, und plötzlich... dein Server fällt aus. Und wenn du Coolify nutzt, merkst du, dass du weder deine Konfigurationen, noch deine Datenbanken oder sonst irgendetwas gesichert hast.
In diesem Leitfaden zeige ich dir, wie du Coolify in nur 12 Minuten sicherst und wiederherstellst.
Warum brauchst du ein Backup?
Coolify speichert alles im Verzeichnis /data/coolify. Dazu gehören unter anderem:
- Server-Konfigurationen
- Anwendungs-Einstellungen
- Datenbank-Volumes (sofern sie dort gespeichert sind)
- Umgebungsvariablen
Wenn dein Server ausfällt, verlierst du alles, sofern du kein Backup dieses Verzeichnisses hast.
Die Backup-Strategie
Der einfachste Weg, Coolify zu sichern, besteht darin, ein komprimiertes Archiv des Verzeichnisses /data/coolify zu erstellen und es an einen entfernten Speicherort (wie S3, Google Drive oder einen anderen Server) zu verschieben.
Schritt 1: Ein Backup-Skript erstellen
Erstelle eine Datei namens backup_coolify.sh:
#!/bin/bash
# Variablen definieren
BACKUP_DIR="/backups/coolify"
SOURCE_DIR="/data/coolify"
TIMESTAMP=$(date +"%Y%m%d_%H%M%S")
BACKUP_NAME="coolify_backup_$TIMESTAMP.tar.gz"
# Backup-Verzeichnis erstellen, falls es nicht existiert
mkdir -p $BACKUP_DIR
# Das Verzeichnis komprimieren
tar -czf $BACKUP_DIR/$BACKUP_NAME $SOURCE_DIR
echo "Backup erfolgreich abgeschlossen: $BACKUP_DIR/$BACKUP_NAME"
# Optional: Alte Backups löschen (älter als 7 Tage)
find $BACKUP_DIR -type f -mtime +7 -name "*.tar.gz" -delete
Schritt 2: Ausführbar machen
Damit das Skript ausgeführt werden kann, musst du die Berechtigungen anpassen:
chmod +x backup_coolify.sh
Schritt 3: Mit Cron automatisieren
Um dieses Backup jeden Tag automatisch auszuführen, füge es deiner Crontab hinzu:
crontab -e
Füge diese Zeile am Ende der Datei hinzu (um das Backup täglich um Mitternacht auszuführen):
0 0 * * * /pfad/zu/deinem/skript/backup_coolify.sh
Der Wiederherstellungsprozess
Wenn dein Server tatsächlich den Geist aufgibt, folge diesen Schritten:
- Installiere eine frische Coolify-Instanz auf deinem neuen Server.
- Stoppe die Coolify-Dienste, damit keine Dateien während des Wiederherstellungsprozesses verwendet werden:
docker stop coolify coolify-db coolify-proxy - Übertrage dein Backup auf den neuen Server.
- Extrahiere das Backup direkt in das Verzeichnis
/data/coolify:tar -xzf coolify_backup_TIMESTAMP.tar.gz -C / - Starte die Dienste neu:
docker start coolify coolify-db coolify-proxy
Fazit
Warte nicht, bis dein Server an einem Freitagabend den Geist aufgibt. Richte deine Backups jetzt ein! Es dauert nur wenige Minuten, kann dir aber später Stunden (oder Tage) an Stress ersparen.