1 Technical Deep Dive
first edited this page 2025-07-07 04:12:07 +00:00

This section explains how the major components work.

The Backup Process (docker cp)

The script's first action is to copy the live webui.db file from the Docker container using docker cp. This approach was chosen specifically to avoid database is locked errors that can occur when trying to read a database file while an application is actively writing to it. The docker cp command provides an atomic, point-in-time snapshot of the database, ensuring the script always works with a clean and unlocked data source.

Packaging (tar and lz4)

All extracted data (user chat JSONs, config JSON, and the database file) are first bundled into a single .tar archive. This archive is then compressed using LZ4. LZ4 was chosen for its extremely high-speed compression and decompression, which is ideal for a backup script where performance is valued over achieving the absolute smallest file size.

Configuration: Script Arguments

The regularbm.py script is stateless and configured at runtime via command-line arguments. This is a deliberate design choice to prevent secrets or environment-specific configuration from being hardcoded.

Argument Required Default Description
--s3-bucket Yes N/A The name of the target S3 bucket.
--s3-region Yes N/A The AWS region of the S3 bucket.
--container-name No open-webui The name of the Open WebUI Docker container.
--s3-prefix No openwebui_backups/ A folder path within the S3 bucket for storage.
--tmp-dir No /tmp A temporary directory for staging backup files.