Backups

Coolify can create scheduled, engine-aware database backups for PostgreSQL, MySQL, MariaDB, MongoDB, ClickHouse, and SQLite. Each backup schedule creates a backup on the database's server, and can upload a copy to an S3-compatible, SFTP, FTPS, or WebDAV storage. To deploy a database and turn backups on, start with Databases.

Redis, Dragonfly, and KeyDB do not support this scheduled database backup workflow. Use the engine's persistence and backup tools for those databases, or deploy a backup-capable service separately.

A backup is not a restore test

A successful backup only proves that Coolify created a file. Restore a copy into a disposable database and verify the application can read it before treating the backup as recoverable.

Create a backup schedule

  1. Open a supported database.
  2. Select Backups in the resource navigation.
  3. Select + Add next to Database backups.
  4. Enter a cron expression or a supported human-readable frequency.
  5. Select Add schedule.

The schedule runs on the server where the database is deployed. The Timezone field is read-only: it uses the server timezone when one is configured, otherwise the Coolify instance timezone.

SQLite backups use its configured database files. See SQLite for application connections and file recovery.

A backup job runs only while the database is running. If the database is stopped when the schedule fires, Coolify skips that execution.

The Backups page lists the schedules of the database under Schedules, and the runs of all its schedules under Executions. Select a schedule to open its settings in the Edit backup schedule dialog, with the General and Danger Zone tabs. Older links to a schedule page open this dialog.

Back up a database inside a service

A database component deployed inside a Service uses credentials from the environment of its running container. This differs from a standalone database resource, whose connection values are stored directly by Coolify.

Coolify reads the resolved container variables listed below. These names do not need to match the variable names shown on the parent Service's Environment Variables page. A one-click Service commonly maps a generated value such as SERVICE_PASSWORD_POSTGRES to POSTGRES_PASSWORD in its Compose definition.

DatabaseVariables used by CoolifyFallback behavior
PostgreSQLPOSTGRES_PASSWORD, POSTGRES_USER, POSTGRES_DBCoolify reads the user from POSTGRES_USER, PGUSER, or POSTGRESQL_USERNAME, and defaults to postgres. A database with a Supabase image is reached over 127.0.0.1 instead of the socket. POSTGRES_DB defaults to the resolved username. When POSTGRES_PASSWORD is absent, Coolify runs the dump without setting PGPASSWORD; password-authenticated databases require this value.
MySQLMYSQL_ROOT_PASSWORD, MYSQL_USER, MYSQL_PASSWORD, MYSQL_DATABASECoolify uses the first account that the database accepts: root with MYSQL_ROOT_PASSWORD, root without a password, then MYSQL_USER with MYSQL_PASSWORD. Without Databases to back up or All databases, the backup uses MYSQL_DATABASE, and fails when it is not set.
MariaDBMARIADB_* or MYSQL_* versions of ROOT_PASSWORD, USER, PASSWORD, and DATABASECoolify checks the MARIADB_* name first, then its MYSQL_* fallback. It uses the first account that the database accepts, in the same order as for MySQL. Without Databases to back up or All databases, the backup uses MARIADB_DATABASE or MYSQL_DATABASE, and fails when neither is set.
MongoDBMONGO_INITDB_ROOT_USERNAME, MONGO_INITDB_ROOT_PASSWORDCoolify uses both values to construct the service database connection URL. The backup fails when either value is unavailable.

For example, a PostgreSQL component can map Service variables to the names Coolify reads:

services:
  postgres:
    environment:
      POSTGRES_USER: ${SERVICE_USER_POSTGRES}
      POSTGRES_PASSWORD: ${SERVICE_PASSWORD_POSTGRES}
      POSTGRES_DB: ${POSTGRES_DB:-app}

Variable names inside the database container are case-sensitive. Do not add duplicate POSTGRES_*, MYSQL_*, MARIADB_*, or MONGO_INITDB_* entries to Environment Variables when the Compose definition already maps generated Service variables to those names.

To verify or correct the configuration:

  1. Open the parent Service and select Edit Compose File.
  2. Find the database component and inspect its environment entries.
  3. Confirm that the required container-variable names in the table are present and mapped to the intended Service variables or values.
  4. To change a referenced value such as SERVICE_PASSWORD_POSTGRES, open Environment Variables. Change a hard-coded value in the Compose file instead.
  5. Restart or deploy the Service so Coolify recreates the database container with the updated environment.
  6. Confirm that the database component is running, then open its backup schedule and select Back up now.
  7. Inspect the execution status and message.

Read Service environment variables for details about generated, referenced, and hard-coded Compose values.

When Coolify cannot find a MySQL or MariaDB database to back up, the execution fails with No database to back up and Coolify sends a Backup failure notification. Set the database-name variable, or select All databases or the Databases to back up in the schedule. If Back up now produces no execution, confirm that the database is running.

Set the backup scope

Open a schedule and use General > Backup schedule to configure the databases included in each execution. Select Enable backup or Disable backup to control scheduled runs, and Save changes after editing fields.

DatabaseScope controlsBackup created by Coolify
PostgreSQLDatabase selection (All databases or Specific databases) and Databases to back uppg_dump custom format for selected databases; pg_dumpall gzip output when all databases are selected.
MySQLDatabase selection (All databases or Specific databases) and Databases to back upmysqldump output; all-database dumps use gzip compression.
MariaDBDatabase selection (All databases or Specific databases) and Databases to back upmariadb-dump output. Selected databases are written directly. All-database dumps are compressed with pigz when it is available, otherwise gzip, and the file name ends in .gz.
MongoDBDatabases to includemongodump gzip archive. Empty includes all databases and collections.
ClickHouseDatabases to back upA ClickHouse backup archive created with the database's backup command.

For PostgreSQL, MySQL, and MariaDB, select Specific databases, then type each database name and press Enter in Databases to back up. For ClickHouse, enter a comma-separated list. An empty field uses the database configured in the resource.

For MongoDB, use database:collection1,collection2|database2 to exclude collections from each database. For example:

app:events,logs|analytics

This includes all collections in app except events and logs, and all collections in analytics. Leave the field empty to include all databases and collections.

Choose a frequency

Coolify accepts standard five-field cron expressions and these named schedules:

NameCron expression
every_minute* * * * *
hourly0 * * * *
daily0 0 * * *
weekly0 0 * * 0
monthly0 0 1 * *
yearly0 0 1 1 *

Use a Timeout of at least 60 seconds when a database dump needs more time. The timeout is the maximum runtime of the complete backup run, including the dumps and S3 uploads of all databases of the schedule. It defaults to 3600 seconds in the job when no value is set. A run that passes it fails with an error that names the timeout, for example The backup timeout of 3600 seconds has passed.

Store backups locally

Coolify writes local database backups under /data/coolify/backups on the deployment server. The exact subdirectory includes the team, database, and execution name; open the execution in Executions and copy its Backup path instead of relying on a manually reconstructed path.

Local retention can remove successful backup files after an execution completes. In Retention, set any of these values to 0 for no limit:

SettingApplies to
Backups to keepEach database of the schedule. Coolify keeps this many recent backups of every database.
Days to keepEach database of the schedule. Coolify removes backups older than this many days, counted from the newest backup of the same database.
Maximum storage (GB)All databases of the schedule together. Coolify removes the oldest backups when the total size passes the limit, but always keeps the newest backup of each database.

The limits work independently. Coolify deletes a backup when any configured limit is reached, keeping the most recent backups first. The backups of a database that the schedule no longer backs up count against the whole schedule, so they expire as new backups come in.

If Coolify cannot delete an expired local file, for example because the server is not reachable, the backup stays in Executions and the next retention run tries again.

Upload backups to S3

  1. Configure and validate an S3-compatible storage under S3 storage, or an SFTP, FTPS, or WebDAV storage.
  2. Open the database schedule and open S3 storage.
  3. Select one or more destinations in S3 storages, select Enable S3, and select Save changes.
  4. Optionally set Local copy to Delete after S3 upload.

The S3 storages list also shows the SFTP, FTPS, and WebDAV storages of the team. Uploads, retention, downloads, and restores work the same for every storage type.

A member whose access is limited to some projects or resources cannot add a new storage to a backup schedule. This needs write access on the whole team, also through the API.

Coolify uploads the local backup file to every selected S3 storage after the local dump succeeds. The execution shows each destination and its upload result. S3 warning means at least one upload failed; other destinations may still contain a usable copy.

Local copy > Delete after S3 upload removes the local file only after every selected S3 destination has a successful copy. If any upload fails, Coolify keeps the local file. It does not remove the S3 copy. Set S3 retention separately; local and S3 retention rules are independent. The S3 limits work like the local limits and apply separately to each destination.

Read Failed uploads for how Coolify retries an S3 upload and when it counts a failed upload as successful.

Through the API, use s3_storage_uuids to select multiple destinations. The singular s3_storage_uuid remains supported. When sent with the list, it must be one of its entries and selects the primary destination. See the API reference for create and update behavior.

Run and verify a backup

While the database is running, select Back up now in the actions of a schedule in Schedules, or in the schedule dialog. Coolify queues the backup job and shows the run in Executions.

The Time column of Executions shows when a run ended, how long ago that was, and how long it took. Hover over it to see the start and end times. Select a run to open Backup execution with its status, times, size, Backup path, and output.

Open the execution to verify:

  • status is Success
  • the database names match the intended scope
  • the file size is greater than zero
  • S3 upload status is successful when S3 is enabled
  • the local copy still exists unless Local copy was set to Delete after S3 upload

A failed S3 upload does not necessarily mean the local database dump failed. Read the execution message and notification to identify which copy is available.

Download backup copies

In Executions, select Download backup on a successful backup. Coolify uses the local file when available, or redirects to a short-lived link for an available S3 copy when the local file is gone. S3 download links expire after 15 minutes; request another download if a link expires. A copy in an SFTP, FTPS, or WebDAV storage downloads through Coolify. Backup downloads require an Admin or Owner role.

To verify an SFTP, FTPS, or WebDAV destination, test a real upload and recovery from the remote copy.

If the instance administrator has configured S3 for file downloads, Coolify may first prepare the local backup in that storage. Wait for preparation to finish and allow the browser to open the download.

Changing a schedule's destinations affects future uploads. Existing copies remain tracked against the destinations that received them.

Delete backups and execution records

Users who can delete the database can remove backups from Executions:

  • Delete backup on a row deletes the local file of that backup and its execution record. When an S3 copy exists, select Delete the selected backup permanently from every S3 storage to also remove its copies from every S3 destination.
  • Clean failed backups removes the records of failed executions.
  • Clean deleted entries removes the records of executions whose local file is already deleted. This includes S3-only backups after Delete after S3 upload. The remote files stay in storage, but the dashboard can no longer download them through the removed records.

Through the API, you can delete a backup schedule or an execution also when the server is not reachable. The local backup files then stay on the server.

Backups of a deleted database

When you delete a database, or a service that contains a database, the delete dialog has the option to delete its database and storage backups. The option is off by default.

If you select the option, Coolify deletes the backup files on the server and on every S3 destination, together with the backup schedules.

If you do not select the option, the backup files stay on the server in /data/coolify/backups/ and on S3. Coolify deletes the schedules and the execution history, so it no longer shows, prunes, or deletes these files. Delete them yourself when you do not need them.

Through the API, send delete_backups=true to the delete endpoint to delete the files. The parameter defaults to false.

Scheduling and failed executions

Since Coolify v4.7.4, daily cleanup removes failed database backup execution records older than 60 days. Successful backup files follow the local and remote retention settings above.

Due database backups are dispatched every minute independently of other schedule types. A scheduled backup whose queued job was lost is queued again after 60 minutes. A backup is skipped while the database starts, restarts, or imports, and a backup that exceeds its timeout fails with the timeout error.

A failed backup notifies the team on the first failure, then at most once a day while it keeps failing. This also applies to a backup whose S3 upload keeps failing. The first successful run after a failure sends one "works again" notification. Coolify never disables a backup schedule automatically, so it starts again by itself after an outage.

For backups of several databases, each database has its own result and finish time. All-database PostgreSQL, MySQL, and MariaDB backups fail if the dump command fails rather than retaining an incomplete archive. Review every result before relying on a backup set.

On this page