Docker Backup Script

Backup strategy for Faveo Helpdesk deployed via faveo-helpdesk-docker-v2 (Docker Compose), modeled on the existing on-prem backup-script but adapted for a containerized deployment. This project only reads faveo-helpdesk-docker-v2’s .env / docker-compose.yml for context - it never modifies either faveo-helpdesk-docker-v2 or backup-script.

Client-facing setup steps are published at https://docs.faveohelpdesk.com/docs/installation/providers/enterprise/docker-backup-script/ (source: _docs/installation/providers/enterprise/docker-backup-script.md). This file is the technical/maintainer reference: design rationale, every config field, and troubleshooting.

Why the backup is split this way

Looking at faveo-helpdesk-docker-v2/docker-compose.yml:

So: filesystem from the host, database from the container.

Layout

docker-backup-script/
├── config.py                         # fill in paths/credentials here
├── docker_backup_common.py           # shared backup/upload/purge helpers
├── dockerlocal.py                    # backup, store locally only
├── dockerftp.py                      # backup + upload to FTP
├── dockerscp.py                      # backup + upload to SFTP/SCP
├── dockersmb.py                      # backup + upload to an SMB share
├── cron.sh                           # interactive cron installer
└── README.md                         # this file (maintainer reference)

config.py ships ready-to-edit, split into # Faveo Info, # FTP Cred, # SFTP/SCP Cred and # SMB Cred sections - no copying/renaming needed. Each docker*.py script only reads the variables it actually uses, so a credential section can be left at its placeholder values if that upload method isn’t used.

Each docker*.py script does, in order: MySQL dump (via docker exec) → filesystem tar (host bind-mounts) → upload (if applicable) → remote retention purge (if applicable) → local retention purge.

Requirements

config.py field reference

Faveo Info (always required)

Field Required? Meaning
PROJECT_DIR Yes Absolute path to this client’s faveo-helpdesk-docker-v2 checkout (must contain docker-compose.yml and .env). Independent of where docker-backup-script itself lives.
BACKUP_DIRECTORY Yes Absolute path where local backup archives are written.
LOG_FILE Yes Absolute path to the backup log file.
LOCAL_BACKUP_RETENTION No Days to keep local backups (default 5 / (24*60) ≈ 5 minutes, matches backup-script’s default - raise this for real use).
BACKUP_RETENTION No Days to keep backups on the remote target (FTP/SFTP/SMB). Unused by dockerlocal.py.

Auto-derived-from-.env overrides (leave blank unless needed)

These are not required inputs - by default they’re read straight out of PROJECT_DIR/.env, which every faveo-helpdesk-docker-v2 deployment already has filled in (DOMAINNAME, HOST_ROOT_DIR, MYSQL_DATABASE, MYSQL_ROOT_PASSWORD). The *_OVERRIDE fields exist only so a maintainer can force a different value without touching that .env file:

Field Default (if left "") When to set it
DOMAINNAME_OVERRIDE .env’s DOMAINNAME .env is missing/wrong and can’t be fixed.
HOST_ROOT_DIR_OVERRIDE .env’s HOST_ROOT_DIR Set to "faveo" for servers installed with faveo-run.sh: its .env has no HOST_ROOT_DIR (the app folder is always ./faveo).
MYSQL_DATABASE_OVERRIDE .env’s MYSQL_DATABASE Same as above.
MYSQL_ROOT_PASSWORD_OVERRIDE .env’s MYSQL_ROOT_PASSWORD Same as above, or the root password was rotated in MySQL but not in .env.
MYSQL_CONTAINER "<DOMAINNAME>-mysql" Only if the client’s compose stack doesn’t follow the standard naming from docker-compose.yml (container_name: ${DOMAINNAME}-mysql, confirmed against faveo-helpdesk-docker-v2/docker-compose.yml). Normally leave blank.
EXTRA_BACKUP_PATHS [] (only HOST_ROOT_DIR + storage/ are backed up) Add extra paths, relative to PROJECT_DIR, e.g. ["ssl_copy"], if a client needs more than the app code + storage folder backed up.

If resolve_settings() can’t find a required value in either .env or its override, the script exits with Could not resolve required setting(s) [...] naming exactly which one is missing.

Credential sections (fill in only what you use)

Cron

cron.sh writes one crontab line pointing at whichever docker*.py script was chosen (dockerlocal.py / dockerftp.py / dockerscp.py / dockersmb.py), including SMB - it is scheduled the same way as FTP/SCP, not left out of automation. Re-running cron.sh and choosing “remove” strips any existing line referencing those four filenames before optionally adding a new one.

Restoring

Troubleshooting