mirror of
https://github.com/offen/docker-volume-backup.git
synced 2024-12-23 17:30:20 +01:00
Frederik Ring
c3daeacecb
* Query for labeled services as well * Try scaling down services * Scale services back up * Use progress tool from Docker CLI * In test, label both services * Clean up error and log messages * Document scale-up/down approach in docs * Downgrade Docker CLI to match client * Document services stats * Do not rely on PreviousSpec for storing desired replica count * Log warnings from Docker when updating services * Check whether container and service labels collide * Document script behavior on label collision * Add additional check if all containers have been removed * Scale services concurrently * Move docker interaction code into own file * Factor out code for service updating * Time out after five minutes of not reaching desired container count * Inline handling of in-swarm container level restart * Timer is more suitable for timeout race * Timeout when scaling down services should be configurable * Choose better filename * Reflect changes in naming * Rename and deprecate BACKUP_STOP_CONTAINER_LABEL * Improve logging * Further simplify logging
35 lines
665 B
Bash
Executable File
35 lines
665 B
Bash
Executable File
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
cd $(dirname $0)
|
|
. ../util.sh
|
|
current_test=$(basename $(pwd))
|
|
|
|
export LOCAL_DIR=$(mktemp -d)
|
|
|
|
docker swarm init
|
|
|
|
docker stack deploy --compose-file=docker-compose.yml test_stack
|
|
|
|
while [ -z $(docker ps -q -f name=backup) ]; do
|
|
info "Backup container not ready yet. Retrying."
|
|
sleep 1
|
|
done
|
|
|
|
sleep 20
|
|
|
|
set +e
|
|
docker exec $(docker ps -q -f name=backup) backup
|
|
if [ $? = "0" ]; then
|
|
fail "Expected script to exit with error code."
|
|
fi
|
|
|
|
if [ -f "${LOCAL_DIR}/test.tar.gz" ]; then
|
|
fail "Found backup file that should not have been created."
|
|
fi
|
|
|
|
expect_running_containers "3"
|
|
|
|
pass "Script did not perform backup as there was a label collision."
|