Skip to main content

Backup of Alfresco data

To back up Alfresco data, it is sufficient to back up its PostgreSQL database. The following command performs the backup from the command line using Docker Compose:

docker compose -f "${alfresco_compose_path}/docker-compose.yml" exec -T postgres \
pg_dump -U alfresco -F c alfresco | gzip > "/backup/alfresco/alfresco.backup.gz"

This command connects to the PostgreSQL container managed by Docker Compose, creates a compressed backup of the alfresco database in custom format, and pipes the output through gzip to produce a .gz archive saved to /backup/alfresco/alfresco.backup.gz.

Backup schedule

To schedule periodic backups on Linux, use the system's cron daemon:

  1. Create the file /etc/cron.d/backup
  2. Add the desired backup commands using standard cron syntax

For better maintainability, it is recommended to create a separate shell script for each system and call those scripts from the cron file, rather than writing commands directly inline.

Example /etc/cron.d/backup:

# CMDBuild backup — runs daily at 22:00
00 22 * * * root /usr/local/bin/backup-cmdbuild.sh ${cmdbuild.webapp.name} > /dev/null 2>&1

# DMS backup — runs daily at 22:30
30 22 * * * root /usr/local/bin/backup-alfresco.sh > /dev/null 2>&1