Browse Source

Switch from entrypoint to start command to allow exec of other scripts

scripts
ViViDboarder 1 year ago
parent
commit
947dc939f2
6 changed files with 13 additions and 11 deletions
  1. 2
    2
      Dockerfile.raspbian
  2. 2
    2
      Dockerfile.ubuntu
  3. 3
    3
      Readme.md
  4. 5
    3
      docker-compose.yaml
  5. 0
    0
      start.sh
  6. 1
    1
      tests/test.sh

+ 2
- 2
Dockerfile.raspbian View File

@@ -44,8 +44,8 @@ ENV FULL_CRON_SCHEDULE=""
ENV VERIFY_CRON_SCHEDULE=""

ADD backup.sh /
ADD entrypoint.sh /
ADD restore.sh /
ADD start.sh /
ADD verify.sh /

ENTRYPOINT [ "/entrypoint.sh" ]
CMD [ "/start.sh" ]

+ 2
- 2
Dockerfile.ubuntu View File

@@ -44,8 +44,8 @@ ENV FULL_CRON_SCHEDULE=""
ENV VERIFY_CRON_SCHEDULE=""

ADD backup.sh /
ADD entrypoint.sh /
ADD restore.sh /
ADD start.sh /
ADD verify.sh /

ENTRYPOINT [ "/entrypoint.sh" ]
CMD [ "/start.sh" ]

+ 3
- 3
Readme.md View File

@@ -17,9 +17,9 @@ Mount any directories you'd like to back up as a volume and run
|CRON_SCHEDULE| |If you want to periodic incremental backups on a schedule, provide it here. By default we just backup once and exit|
|FLOCK_WAIT|60|Seconds to wait for a lock before skipping a backup|
|FTP_PASSWORD| |Used to provide passwords for some backends. May not work without an attached TTY|
|FULL_CRON_SCHEDULE| |If you want to periodic full backups on a schedule, provide it here. This requires an incremental cron schedule too.|
|FULL_CRON_SCHEDULE| |If you want to periodic full backups on a schedule, provide it here. This requires an incremental cron schedule too|
|GPG_KEY_ID| |The ID of the key you wish to use. See [Encryption](#encryption) section below|
|OPT_ARGUMENTS| |Any additional arguments to provide to the duplicity backup command. These can also be provided as additional arguments via the command line|
|OPT_ARGUMENTS| |Any additional arguments to provide to the duplicity backup command|
|PASSPHRASE|Correct.Horse.Battery.Staple|Passphrase to use for GPG|
|PATH_TO_BACKUP|/data|The path to the directory you wish to backup. If you want to backup multiple, see the [tip below](#backing-up-more-than-one-source-directory)|
|RESTORE_ON_EMPTY_START| |Set this to "true" and if the `$PATH_TO_BACKUP` is empty, it will restore the latest backup. This can be used for auto recovery from lost data|
@@ -27,7 +27,7 @@ Mount any directories you'd like to back up as a volume and run
|VERIFY_CRON_SCHEDULE| |If you want to verify your backups on a schedule, provide it here|

## Encryption
Add a ro mount to your `~/.gnupg` directory and then provide the `GPG_KEY_ID` as an environment variable. The key will be used to sign and encrypt your files before sending to the backup destination.
By default Duplicity will use a symettric encryption using just your passphrase. If you wish to use a GPG key, you can add a ro mount to your `~/.gnupg` directory and then provide the `GPG_KEY_ID` as an environment variable. The key will be used to sign and encrypt your files before sending to the backup destination.

Need to generate a key? Install `gnupg` and run `gnupg --gen-key`


+ 5
- 3
docker-compose.yaml View File

@@ -1,10 +1,12 @@
version: '2'
services:
duplicity:
build: .
build:
context: .
dockerfile: Dockerfile.ubuntu
volumes:
- ~/my-backups:/backups
- ~/my-data:/data:ro
- ./my-backups:/backups
- ./my-data:/data:ro
environment:
PASSPHRASE: Correct.Horse.Battery.Staple
CLEANUP_COMMAND: remove-older-than 5m

entrypoint.sh → start.sh View File


+ 1
- 1
tests/test.sh View File

@@ -45,7 +45,7 @@ else
test -f /data/test.txt && exit 1 || echo "Gone"

echo "Simulate a restart with RESTORE_ON_EMPTY_START..."
RESTORE_ON_EMPTY_START=true /entrypoint.sh
RESTORE_ON_EMPTY_START=true /start.sh

echo "Verify restore happened..."
test -f /data/test.txt

Loading…
Cancel
Save