-
-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow multiple schedules in the same container (#78)
* Allow mounting of config directory for multiple schedules * Add docs for conf.d feature * Fix behavior on multiple files * Define default case first in entrypoint script
- Loading branch information
Showing
8 changed files
with
95 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
BACKUP_FILENAME="conf.tar.gz" | ||
BACKUP_CRON_EXPRESSION="*/1 * * * *" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: '3' | ||
|
||
services: | ||
backup: | ||
image: offen/docker-volume-backup:${TEST_VERSION:-canary} | ||
restart: always | ||
volumes: | ||
- ./local:/archive | ||
- app_data:/backup/app_data:ro | ||
- ./backup.env:/etc/dockervolumebackup/conf.d/00backup.env | ||
- ./never.env:/etc/dockervolumebackup/conf.d/10never.env | ||
- /var/run/docker.sock:/var/run/docker.sock | ||
|
||
offen: | ||
image: offen/offen:latest | ||
labels: | ||
- docker-volume-backup.stop-during-backup=true | ||
volumes: | ||
- app_data:/var/opt/offen | ||
|
||
volumes: | ||
app_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
BACKUP_FILENAME="never.tar.gz" | ||
BACKUP_CRON_EXPRESSION="0 0 5 31 2 ?" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
cd $(dirname $0) | ||
|
||
mkdir -p local | ||
|
||
docker-compose up -d | ||
|
||
# sleep until a backup is guaranteed to have happened on the 1 minute schedule | ||
sleep 100 | ||
|
||
docker-compose down --volumes | ||
|
||
if [ ! -f ./local/conf.tar.gz ]; then | ||
echo "[TEST:FAIL] Config from file was not used." | ||
exit 1 | ||
fi | ||
echo "[TEST:PASS] Config from file was used." | ||
|
||
if [ -f ./local/never.tar.gz ]; then | ||
echo "[TEST:FAIL] Unexpected file was found." | ||
exit 1 | ||
fi | ||
echo "[TEST:PASS] Unexpected cron did not run." |