𝗛𝗼𝘄 𝘁𝗼 𝗕𝗮𝗰𝗸𝘂𝗽 𝗮𝗻𝗱 𝗥𝗲𝘀𝘁𝗼𝗿𝗲 𝗖𝗼𝗼𝗹𝗶𝗳𝘆 𝗶𝗻 𝟭𝟮 𝗠𝗶𝗻𝘂𝘁𝗲𝘀

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:

  1. Install Coolify using the standard curl command.
  2. Download your .pgdump file from your S3 bucket to the new server.
  3. 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.

Cara Backup dan Restore Coolify dalam 12 Minit Sebelum Pelayan Anda Mati pada Malam Jumaat

Bayangkan ia adalah jam 11 malam pada satu malam Jumaat. Anda baru sahaja ingin berehat apabila tiba-tiba, pelayan anda mati. Instance Coolify anda hilang. Semua konfigurasi anda, semua deployment anda... semuanya hilang.

Jangan panik. Dalam artikel ini, saya akan menunjukkan cara anda boleh melakukan backup dan restore Coolify dalam masa 12 minit sahaja.

Mengapa Anda Perlu Melakukan Backup?

Coolify menyimpan semua konfigurasi, kunci SSH, dan data penting dalam direktori /data/coolify. Jika pelayan anda mengalami kegagalan perkakasan atau masalah sistem, anda akan kehilangan segalanya jika tiada backup.

Langkah 1: Melakukan Backup

Langkah pertama adalah untuk membuat salinan mampat (compressed copy) bagi direktori data Coolify.

  1. SSH ke dalam pelayan anda.
  2. Jalankan arahan berikut untuk membuat backup:
tar -czvf coolify-backup.tar.gz /data/coolify

Sekarang, anda mempunyai fail coolify-backup.tar.gz.

Langkah 2: Memindahkan Backup ke Lokasi Selamat

Jangan simpan backup anda di dalam pelayan yang sama! Gunakan perkhidmatan storan awan seperti AWS S3, Google Drive, atau hantar ke pelayan lain menggunakan scp.

Contoh menggunakan scp:

scp coolify-backup.tar.gz user@remote-server:/path/to/destination

Langkah 3: Melakukan Restore pada Pelayan Baharu

Jika pelayan lama anda mati, ikuti langkah ini pada pelayan baharu:

  1. Pasang Coolify pada pelayan baharu anda menggunakan skrip pemasangan rasmi.
  2. Muat turun fail backup anda ke pelayan baharu.
  3. Ekstrak fail tersebut ke direktori akar:
tar -xzvf coolify-backup.tar.gz -C /
  1. Mulakan semula (restart) Coolify untuk memastikan semua perubahan diambil.

Kesimpulan

Dengan melakukan langkah-langkah ini, anda boleh memulihkan seluruh persekitaran Coolify anda dalam masa yang singkat. Jangan tunggu sehingga bencana berlaku—buat backup anda sekarang!