Sign inSign up

codemonkeysoftware/sqlite-backup

By codemonkeysoftware

Updated about 4 years ago

A docker container for running sqlite3 backups on a schedule.

Image
0

2.3K

codemonkeysoftware/sqlite-backup repository overview

A docker container for running sqlite3 backups on a schedule.

It reads a list of paths in $DATABASE_PATHS to backup to the $BACKUP_PATH folder. You will need to mount your databases or their folders using volumes. I recommend you mount specific files, because it will use whatever the basename is for the mounted file as the name of the backup file. The backup script uses the --readonly flag for sqlite, but it never hurts to mount the targets read-only as an extra precaution.

$BACKUP_SCHEDULE uses crontab format (and actual cron) to schedule the backups.

$HEALTHCHECKS_ID is an optional variable that, when set, will send cron pings to the healthchecks.io ID specified. $HEALTHCHECKS_HOST optionally can be used to set a self-hosted instance of healthchecks.io, defaults to https://hc-ping.com

Please forgive the weird version tags, I have to somehow include sqlite's version as well as a build version for this package

Usage (docker):

docker exec \
    -v /path/to/sqlite3.db3:/path/sqlite3.db3:ro \
    -v /path/to/another.db3:/another.db3:ro \
    -e DATABASE_PATHS=/path/sqlite3.db3:/path/to/another.db3 \
    -v /path/to/backups:/backups \
    -e BACKUP_PATH=/backups \
    -e BACKUP_SCHEDULE='0 2 * * *' \
  codemonkeysoftware/sqlite3-backup 

Usage (docker-compose):

version: "3.0"

services:
  something_with_a_database:
    ...
  backups:
    image: codemonkeysoftware/sqlite3-backup
    restart: unless-stopped
    volumes:
      - /path/to/sqlite3.db3:/path/sqlite3.db3:ro
      - /path/to/backups:/backups
    environment:
      - DATABASE_PATHS=/path/sqlite3.db3:/path/to/another.db3
      - BACKUP_PATH=/backups
      - BACKUP_SCHEDULE='0 2 * * *'

Tag summary

Content type

Image

Digest

sha256:1c4d688f5

Size

7.2 MB

Last updated

about 4 years ago

docker pull codemonkeysoftware/sqlite-backup