mirror of
https://github.com/ViViDboarder/docker-duplicity-cron.git
synced 2024-11-23 09:36:30 +00:00
Add scripts and new Dockerfile for SQLite backups
This commit is contained in:
parent
5c97af4fb3
commit
37dc8be78d
3
helper-scripts/Readme.md
Normal file
3
helper-scripts/Readme.md
Normal file
@ -0,0 +1,3 @@
|
||||
# Helper Scripts
|
||||
|
||||
These are some pre-written pre/post backup/restore scripts that can be used for some common usecases. Eg. Backing up a SQLite database.
|
15
helper-scripts/sqlite-scripts/Dockerfile
Normal file
15
helper-scripts/sqlite-scripts/Dockerfile
Normal file
@ -0,0 +1,15 @@
|
||||
FROM vividboarder/docker-duplicity-cron
|
||||
MAINTAINER ViViDboarder <vividboarder@gmail.com>
|
||||
|
||||
# Install SQLite
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends sqlite3 \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/apt/lists/*
|
||||
|
||||
# Copy SQLite backup scripts
|
||||
COPY ./backup /scripts/backup
|
||||
COPY ./restore /scripts/restore
|
||||
|
||||
# Env that points to sqlite db
|
||||
ENV DB_PATH /data/db.sqlite3
|
3
helper-scripts/sqlite-scripts/Readme.md
Normal file
3
helper-scripts/sqlite-scripts/Readme.md
Normal file
@ -0,0 +1,3 @@
|
||||
# SQLite Backup Scripts
|
||||
|
||||
Add these to your image and then set an env variable `$DB_PATH` that points to the database file you wish to backup. This will use the proper SQLite backup command for backups.
|
6
helper-scripts/sqlite-scripts/backup/after/post-backup.sh
Executable file
6
helper-scripts/sqlite-scripts/backup/after/post-backup.sh
Executable file
@ -0,0 +1,6 @@
|
||||
set -e
|
||||
|
||||
cd /data
|
||||
|
||||
# Remove backed up copy
|
||||
rm "$DB_PATH.bak"
|
6
helper-scripts/sqlite-scripts/backup/before/pre-backup.sh
Executable file
6
helper-scripts/sqlite-scripts/backup/before/pre-backup.sh
Executable file
@ -0,0 +1,6 @@
|
||||
set -e
|
||||
|
||||
cd /data
|
||||
|
||||
# Dump the SQLite database
|
||||
sqlite3 "$DB_PATH" ".backup $DB_PATH.bak"
|
6
helper-scripts/sqlite-scripts/restore/after/post-restore.sh
Executable file
6
helper-scripts/sqlite-scripts/restore/after/post-restore.sh
Executable file
@ -0,0 +1,6 @@
|
||||
set -e
|
||||
|
||||
cd /data
|
||||
|
||||
# Restore the backedup database
|
||||
mv "$DB_PATH.bak" "$DB_PATH"
|
3
helper-scripts/sqlite-scripts/restore/before/pre-restore.sh
Executable file
3
helper-scripts/sqlite-scripts/restore/before/pre-restore.sh
Executable file
@ -0,0 +1,3 @@
|
||||
set -e
|
||||
|
||||
# Don't really need to do anything here
|
Loading…
Reference in New Issue
Block a user