Backup

CheckCle Data Backup & Persistence Guide

1. Data Persistence Setup

CheckCle uses PocketBase as its embedded database. By default, PocketBase stores all application data in the pb_data folder inside the container. To prevent data loss when restarting or recreating the container, you should persist this directory on the host machine.

Example: Host Volume Mount

In your container configuration:

  • Host Path: /mnt/db/pb_data

  • Container Path: /mnt/pb_data

  • Mode: RW (Read/Write)

This ensures all PocketBase data (SQLite database, uploaded files, migrations, logs) is stored on the host at:

/mnt/db/pb_data

With this setup, even if the container is removed or recreated, the CheckCle data will persist.

2. Backup Strategy for pb_data

Since pb_data contains the SQLite database and file storage, backing it up regularly is critical. Here are recommended strategies:

A. Simple File Copy Backup

Use rsync or cp to copy the pb_data folder to a backup location:

# Example: backup to /backups/checkcle with timestamp
rsync -avz /mnt/db/pb_data /backups/checkcle/pb_data_$(date +%F_%H-%M-%S)

B. Compressed Archive Backup

Create a compressed .tar.gz archive for portability:

tar -czvf /backups/checkcle/pb_data_$(date +%F).tar.gz /mnt/db/pb_data

C. Automated Cron Job

Automate daily backups with cron:

0 2 * * * rsync -avz /mnt/db/pb_data /backups/checkcle/pb_data_$(date +\%F) >> /var/log/checkcle_backup.log 2>&1

This runs at 2 AM daily.

D. Remote Backup (Optional)

Push backups to a remote server or cloud (S3, MinIO, rsync to another server):

rsync -avz /mnt/db/pb_data user@remote-server:/remote/backups/checkcle/

3. Restore Strategy

To restore a backup:

  1. Stop the CheckCle (PocketBase) container:

    docker stop checkcle
  2. Replace the pb_data directory with your backup:

    rm -rf /mnt/db/pb_data
    cp -r /backups/checkcle/pb_data_2025-09-15 /mnt/db/pb_data
  3. Restart the container:

    docker start checkcle

4. Best Practices

  • Always back up before upgrades of CheckCle or PocketBase.

  • Test restore procedures regularly to ensure backups are valid.

  • Use off-site storage (S3, Minio, or another server) for disaster recovery.

  • Monitor disk space on the host to prevent backup failures.

Last updated