-
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass file location to lifecycle commands (#173)
* Add test case for extending image and calling through to rsync * Keep backup file location env var * Add documentation * Work against untared content in test
- Loading branch information
Showing
5 changed files
with
102 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
ARG version=canary | ||
FROM offen/docker-volume-backup:$version | ||
|
||
RUN apk add rsync |
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 @@ | ||
version: '3' | ||
|
||
services: | ||
backup: | ||
image: offen/docker-volume-backup:${TEST_VERSION:-canary} | ||
restart: always | ||
labels: | ||
- docker-volume-backup.copy-post=/bin/sh -c 'mkdir -p /tmp/unpack && tar -xvf $$COMMAND_RUNTIME_ARCHIVE_FILEPATH -C /tmp/unpack && rsync -r /tmp/unpack/backup/app_data /local' | ||
environment: | ||
BACKUP_FILENAME: test.tar.gz | ||
BACKUP_CRON_EXPRESSION: 0 0 5 31 2 ? | ||
EXEC_FORWARD_OUTPUT: "true" | ||
volumes: | ||
- ./local:/local | ||
- app_data:/backup/app_data:ro | ||
- /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,28 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
cd "$(dirname "$0")" | ||
. ../util.sh | ||
current_test=$(basename $(pwd)) | ||
|
||
mkdir -p local | ||
|
||
export TEST_VERSION="${TEST_VERSION:-canary}-with-rsync" | ||
|
||
docker build . -t offen/docker-volume-backup:$TEST_VERSION | ||
|
||
docker-compose up -d | ||
sleep 5 | ||
|
||
docker-compose exec backup backup | ||
|
||
sleep 5 | ||
|
||
expect_running_containers "2" | ||
|
||
if [ ! -f "./local/app_data/offen.db" ]; then | ||
fail "Could not find expected file in untared archive." | ||
fi | ||
|
||
docker-compose down --volumes |