Migrate your Coolify installation between servers with minimal hassle. Two scripts, one manual step.
- ✅ Complete backup - Coolify config, database, SSH keys, environment files
- ✅ All Docker volumes - Your app data, databases, everything
- ✅ Network configurations - Preserves your Docker networks
- ✅ Version detection - Automatically detects and restores the same Coolify version
- ✅ Simple HTTP transfer - No manual file copying needed
- ✅ Universal - Works with any Coolify installation
curl -fsSL https://raw.githubusercontent.com/erenbertr/coolify.migrate/main/transfer.sh -o transfer.sh
chmod +x transfer.sh
sudo ./transfer.shThis will:
- Stop Coolify temporarily
- Backup everything
- Restart Coolify
- Serve the backup via HTTP
- Display the download URL
curl -fsSL https://raw.githubusercontent.com/erenbertr/coolify.migrate/main/restore.sh -o restore.sh
chmod +x restore.sh
sudo ./restore.shWhen prompted, enter the URL from the transfer script output.
After restore completes, your localhost server will show "not reachable". This is expected - you need to add the SSH key:
- Open Coolify at
http://YOUR_NEW_SERVER_IP:8000 - Go to Security → Private Keys → localhost's key
- Copy the Public Key shown there
- On your server, run:
echo "PASTE_THE_PUBLIC_KEY_HERE" >> /root/.ssh/authorized_keys
- Go to Servers → localhost → Click Validate Server
Now your server should show as connected and you can redeploy your applications.
| Component | Location | Included |
|---|---|---|
| Coolify Config | /data/coolify/ |
✅ |
| Database (SQLite/PostgreSQL) | Docker volume coolify-db |
✅ |
| SSH Keys | /data/coolify/ssh/ |
✅ |
| Environment Files | /data/coolify/source/.env |
✅ |
| Applications Data | /data/coolify/applications/ |
✅ |
| Databases Data | /data/coolify/databases/ |
✅ |
| Docker Volumes | All Coolify-managed volumes | ✅ |
| Docker Networks | Coolify networks | ✅ |
- Root access
- Coolify installed at
/data/coolify - Docker running
- curl or wget
- Root access
- Fresh Ubuntu 22.04/24.04 (recommended)
- Internet access
- curl or wget
Docker will be installed automatically if not present.
The transfer script serves backups on port 9999 by default. To use a different port:
SERVE_PORT=8888 sudo ./transfer.shIf HTTP serving doesn't work (firewall issues), you can manually transfer:
# On new server
scp root@OLD_SERVER_IP:/tmp/coolify-migration/coolify-backup-*.tar.gz /tmp/
# Then run restore with local file
sudo ./restore.sh file:///tmp/coolify-backup-XXXXX.tar.gzAfter running restore.sh:
⚠️ Fix SSH Connection (see instructions above) - Required!- Update DNS - Point your domains to the new server IP
- Redeploy Applications - After SSH is fixed, redeploy your apps
- Verify SSL - Certificates should auto-renew after redeploy
- Update Webhooks - GitHub/GitLab webhook URLs
- Shutdown Old Server - Only after everything is verified
Coolify stores the localhost SSH private key in its database and regenerates the key files on every container start. The private key from the old server won't work on the new server because:
- The key is tied to the old server's
authorized_keys - Coolify overwrites
/data/coolify/ssh/keys/on startup
The simplest solution is to copy the public key from Coolify UI and add it to authorized_keys on the new server.
cd /data/coolify/source
docker compose -f docker-compose.yml -f docker-compose.prod.yml logs -fNote: Coolify uses TWO compose files. Always use both:
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -dFollow the SSH key instructions above. This is the most common issue after migration.
Either use a different port or transfer manually via SCP.
The coolify-db volume wasn't restored properly. Fix manually:
# Stop Coolify
cd /data/coolify/source
docker compose -f docker-compose.yml -f docker-compose.prod.yml down
# Remove and restore the database volume
docker volume rm coolify-db
docker volume create coolify-db
docker run --rm \
-v coolify-db:/target \
-v /tmp/coolify-restore/coolify-backup-*/docker-volumes/coolify-db.tar.gz:/backup.tar.gz:ro \
alpine sh -c "cd /target && tar -xzf /backup.tar.gz"
# Start Coolify
docker compose -f docker-compose.yml -f docker-compose.prod.yml up -dCoolify needs a buildx builder. Create it manually:
docker buildx create --name coolify --driver docker-container --bootstrapAlso pull required images:
docker pull ghcr.io/coollabsio/coolify-helper:latest
docker pull ghcr.io/railwayapp/nixpacks:latest
docker pull node:18-alpine
docker pull node:20-alpineIf builds are still stuck, clear the build cache:
docker builder prune -afThis can happen with old package-lock.json files. Options:
- In your repo: Delete
package-lock.json, runnpm installlocally, commit the new lockfile - In Coolify: Change build command to:
rm -f package-lock.json && npm install && npm run build - Check network: Verify npm registry is accessible:
docker run --rm node:20-alpine npm ping
Check if volumes exist and have data:
docker volume ls | grep coolify
docker run --rm -v coolify-db:/data alpine ls -la /data/After fixing SSH, you need to redeploy your applications. The containers from the old server won't automatically start - Coolify needs to rebuild them on the new server.
-
SSH keys require manual setup - Coolify stores keys in its database and regenerates files on startup. You must add the public key to
authorized_keysmanually after migration. -
First deploys may be slow - Docker needs to pull base images and rebuild caches on the new server.
-
Webhooks need updating - GitHub/GitLab webhooks still point to the old server IP.
-
SSL certificates - Will be regenerated automatically on first deploy, but may take a few minutes.
- Detects Coolify version and configuration
- Stops Coolify for consistent backup
- Creates tarball of
/data/coolify - Exports all Docker volumes (including
coolify-db) - Saves network configurations
- Creates metadata file with version info
- Restarts Coolify
- Serves backup via Python HTTP server
- Installs Docker if needed
- Downloads and extracts backup
- Validates backup integrity
- Stops existing Coolify and removes old volumes
- Restores
/data/coolify - Recreates and restores Docker volumes with data
- Recreates Docker networks
- Updates server IP in configuration
- Creates Docker Buildx builder for app builds
- Prepares SSH configuration
- Starts Coolify
- Shows instructions for SSH key setup
- The HTTP server runs temporarily for file transfer
- Backup contains sensitive data (SSH keys, database)
- Delete the backup file after successful migration
- The served file is only accessible while the script runs
MIT License - Use freely, no warranty.
PRs welcome! Please test on a non-production server first.
Made with ❤️ for the Coolify community