diff --git a/Dockerfile b/Dockerfile index 3275ddc..e0292be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,7 +20,10 @@ VOLUME /data HEALTHCHECK --interval=2s --retries=1800 \ CMD stat /var/healthy.txt || exit 1 -ENV S3_SYNC_FLAGS "--delete-removed" +ENV S3_GLOBAL_FLAGS "" +ENV S3_BACKUP_FLAGS "" +ENV S3_RESTORE_FLAGS "" +ENV S3_BACKUP_FINAL_FLAGS "" ENV S3CMD_FINAL_STRATEGY "PUT" SHELL ["/bin/bash", "-c"] diff --git a/README.md b/README.md index ac9e654..820e303 100644 --- a/README.md +++ b/README.md @@ -56,10 +56,27 @@ This will download the data from the S3 location you specify into the container's `/data` directory. When the container shuts down, the data will be synced back to S3. +## Configuration + +Configuration options could be passed to the script by command line or by +setting related environment variable. The command line option will always override +the command line parameters. + +| Variable | Description | Command Line Option | Environment Variable | +|---|---|---|---| +| Backup interval | Time interval between backups (es. "10m", "6h") | -i \| --backup-interval \ | $BACKUP_INTERVAL | +| Clean restore | Restore only if local directory is empty, else the script fails | -c \| --clean-restore | $CLEAN_RESTORE | +| Two-way sync | Does backup and restore an every cycle, else only does backup. This influence S3CMD sync flags.
:warning: **PARTIALLY WORKING** Read more at [Two-way sync](#two-way-sync) | -t \| --two-way-sync | $TWO_WAY_SYNC | +| Final backup strategy | Sets the s3cmd final cycle strategy on shutdown signal trap. Default is "AUTO" to better preserve posix permissions, "PUT" and "SYNC" are available. | --final-strategy \ | $S3CMD_FINAL_STRATEGY | +| S3CMD sync flags | Additional flags passed to s3cmd commands. Default to `--delete-removed`, or empty if two-way sync is enabled. Configurable only by environment variable | *n/d* | $S3_GLOBAL_FLAGS | +|| Additional flags passed to s3cmd restore commands. Default empty. Configurable only by environment variable | *n/d* | $S3_RESTORE_FLAGS | +|| Additional flags passed to s3cmd backup commands. Default empty. Configurable only by environment variable | *n/d* | $S3_BACKUP_FLAGS | +|| Additional flags passed to s3cmd last backup command on gracefully stop. Default empty. Configurable only by environment variable | *n/d* | $S3_BACKUP_FINAL_FLAGS | + ### Configuring a sync interval -When the `BACKUP_INTERVAL` environment variable is set, a watcher process will -sync the `/data` directory to S3 on the interval you specify. The interval can +When the `-i