diff --git a/README.md b/README.md index fa809ff..007ea62 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,6 @@ Variable | Default | Notes `BACKUP_ARCHIVE` | `/archive` | When this path is available within the container (i.e. you've mounted a Docker volume there), a finished backup file will get archived there after each run. `BACKUP_WAIT_SECONDS` | `0` | The backup script will sleep this many seconds between re-starting stopped containers, and proceeding with archiving/uploading the backup. This can be useful if you don't want the load/network spike of a large upload immediately after the load/network spike of container startup. `BACKUP_HOSTNAME` | `$(hostname)` | Name of the host (i.e. Docker container) in which the backup runs. Mostly useful if you want a specific hostname to be associated with backup metrics (see InfluxDB support). -`DOCKER_STOP_OPT_IN_LABEL` | `docker-volume-backup.stop-during-backup` | Adding this label with the value `true` to other containers causes the backup script to stop them before the backup runs, and starting them back up after the backup has ran. This will only work if you also expose the Docker daemon via your `/var/run/docker.sock` into the backup container. See examples. `AWS_S3_BUCKET_NAME` | | When provided, the resulting backup file will be uploaded to this S3 bucket after the backup has ran. `AWS_ACCESS_KEY_ID` | | Required when using `AWS_S3_BUCKET_NAME`. `AWS_SECRET_ACCESS_KEY` | | Required when using `AWS_S3_BUCKET_NAME`. diff --git a/backup.sh b/backup.sh index d7b0a56..f10c37e 100755 --- a/backup.sh +++ b/backup.sh @@ -14,13 +14,13 @@ TIME_START="$(date +%s.%N)" DOCKER_SOCK="/var/run/docker.sock" if [ -S "$DOCKER_SOCK" ]; then TEMPFILE="$(mktemp)" - docker ps --format "{{.ID}}" --filter "label=$DOCKER_STOP_OPT_IN_LABEL=true" > "$TEMPFILE" + docker ps --format "{{.ID}}" --filter "label=docker-volume-backup.stop-during-backup=true" > "$TEMPFILE" CONTAINERS_TO_STOP="$(cat $TEMPFILE | tr '\n' ' ')" CONTAINERS_TO_STOP_TOTAL="$(cat $TEMPFILE | wc -l)" CONTAINERS_TOTAL="$(docker ps --format "{{.ID}}" | wc -l)" rm "$TEMPFILE" echo "$CONTAINERS_TOTAL containers running on host in total" - echo "$CONTAINERS_TO_STOP_TOTAL containers marked with label \"$DOCKER_STOP_OPT_IN_LABEL=true\"" + echo "$CONTAINERS_TO_STOP_TOTAL containers marked to be stopped during backup" else CONTAINERS_TO_STOP_TOTAL="0" CONTAINERS_TOTAL="0" diff --git a/entrypoint.sh b/entrypoint.sh index 50e6a9b..0e4f782 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -12,7 +12,6 @@ BACKUP_FILENAME="$(date +"${BACKUP_FILENAME:-backup-%Y-%m-%d.tar.gz}")" BACKUP_ARCHIVE="${BACKUP_ARCHIVE:-/archive}" BACKUP_WAIT_SECONDS="${BACKUP_WAIT_SECONDS:-0}" BACKUP_HOSTNAME="${BACKUP_HOSTNAME:-$(hostname)}" -DOCKER_STOP_OPT_IN_LABEL="${DOCKER_STOP_OPT_IN_LABEL:-docker-volume-backup.stop-during-backup}" INFLUXDB_URL="${INFLUXDB_URL:-}" INFLUXDB_DB="${INFLUXDB_DB:-}" INFLUXDB_CREDENTIALS="${INFLUXDB_CREDENTIALS:-}"