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. |
- Project Wiki:
regularbm
- Introduction
- Core Concepts
- Pattern A
- Pattern B
- Getting Started - A Step-by-Step Guide
- Step 1: System Prerequisites
- Step 2: Deploy Cloud Infrastructure
- Step 3: Configure the Script Environment
- Step 4: Configure Server Permissions
- Step 5: Test and Automate
- Technical Deep Dive
- The Backup Process
- Packaging
- Configuration: Script Arguments
- Troubleshooting FAQ