Sign inSign up

bpmbee/sqlite-backup

By bpmbee

Updated over 1 year ago

A simple service to create backups of SQLite database files by recursively scanning a directory.

Image
Databases & storage
0

1.2K

bpmbee/sqlite-backup repository overview

sqlite-backup

A simple service to create backups of SQLite database files by recursively scanning a directory and backing up all SQLite database files found to a specified backup directory. It will maintain the same directory structure as the source database files.

I use this as a part of my backup strategy for my self hosted services.

Usage with Docker

  1. Build the Docker image:

    docker build --load -t sqlite-backup:latest .

  2. Run the Docker container:

    docker compose up

Environment Variables
SOURCE_DIR: Directory to search for SQLite database files
BACKUP_DIR: Directory where backups will be stored
INTERVAL: Backup frequency in hours (e.g. 12, 24) (optional, defaults to 24)
LOGLEVEL: Sets the log level (e.g., info, debug, error) (optional, defaults to info)
Volume Mounts

Make sure to mount your source and backup directories, see the docker-compose file for an example.

Usage without Docker

  1. Clone the repository:

    git clone https://github.com/bpmb82/sqlite-backup.git

  2. Build the project:

    cargo build --release

  3. Run the executable:

    ./target/release/sqlite-backup <command>

Commands
  • backup: Create a backup of the source directory.
  • restore: Restore backup files to the source directory.
  • daemon: Run the backup service in daemon mode, can take SOURCE_DIR and BACKUP_DIR environment variables or the arguments --source-dir and --backup-dir.
Arguments
  • --source-dir=<source_dir>: Path to the SQLite database directory.
  • --backup-dir=<backup_dir>: Path to the backup directory.
Examples
# Create a backup of the source directory
./target/release/sqlite-backup backup --source-dir=/path/to/db --backup-dir=/path/to/backups

# Restore backup files to the source directory
./target/release/sqlite-backup restore --source-dir=/path/to/db --backup-dir=/path/to/backups

# Run the backup service in daemon mode
./target/release/sqlite-backup daemon --source-dir=/path/to/db --backup-dir=/path/to/backups

License

LICENSE

Support

For issues and feature requests, please open an issue in the GitHub repository.

Tag summary

Content type

Image

Digest

sha256:1e3d9b396

Size

2.1 MB

Last updated

over 1 year ago

docker pull bpmbee/sqlite-backup