mirror of
https://github.com/offen/docker-volume-backup.git
synced 2025-09-05 05:54:52 +08:00
Update documentation
This commit is contained in:
parent
466aa2a869
commit
95d6c1151c
3 changed files with 15 additions and 3 deletions
|
@ -8,7 +8,8 @@ nav_order: 13
|
|||
# Use with Docker Swarm
|
||||
|
||||
{: .note }
|
||||
The mechanisms described in this page __do only apply when Docker is running in [Swarm mode][swarm]__.
|
||||
The mechanisms described in this page __do only apply when Docker is running in [Swarm mode][swarm]__ and __when placing the `docker-volume-backup` container on a manager node__.
|
||||
Containers that are placed on worker nodes function as if the Docker engine is not running in Swarm mode, i.e. there is no access to services and there is no way to interact with resources that are running on different host nodes.
|
||||
|
||||
[swarm]: https://docs.docker.com/engine/swarm/
|
||||
|
||||
|
|
|
@ -67,3 +67,11 @@ A test case can signal it wants to run in swarm mode by placing an empty `.swarm
|
|||
In case the swarm setup should be compose of multiple nodes, a `.multinode` file can be used.
|
||||
|
||||
A multinode setup will contain one manager (`manager`) and two worker nodes (`worker1` and `worker2`).
|
||||
|
||||
If a test is expected to run in the context of a node other than the `manager`, the hostname can be put in the `.multinode` file.
|
||||
|
||||
> [!IMPORTANT]
|
||||
> When running against a multi-node setup and targeting a non-manager node, the test script will automatically deploy a stack named `test_stack` based on the compose file in the test directory.
|
||||
> This is required because the non-manager node cannot deploy the stack itself from within the test script.
|
||||
> This also means, you cannot mount local directories created in your test script, as the containers are already created when the script runs.
|
||||
> You can work around this limitation by creating named volumes and then `docker cp`ing the contents your test needs to inspect.
|
||||
|
|
|
@ -46,8 +46,9 @@ for dir in $(find $find_args | sort); do
|
|||
|
||||
docker compose --profile $compose_profile up -d --wait
|
||||
test_context=manager
|
||||
if [ -f "${dir}/.multinode" ]; then
|
||||
if [ -f "${dir}/.multinode" ] && [ -s "${dir}/.multinode" ]; then
|
||||
test_context=$(cat $dir/.multinode)
|
||||
echo "Running tests on $test_context instead of manager"
|
||||
fi
|
||||
docker compose exec $test_context /bin/sh -c "docker load -i /cache/image.tar.gz"
|
||||
|
||||
|
@ -60,7 +61,9 @@ for dir in $(find $find_args | sort); do
|
|||
docker compose exec worker1 docker swarm join --token $token $manager_ip:2377
|
||||
docker compose exec worker2 docker swarm join --token $token $manager_ip:2377
|
||||
|
||||
docker compose exec -w "/code/$dir" manager docker stack deploy --compose-file="docker-compose.yml" test_stack
|
||||
if [ "$test_context" != "manager" ]; then
|
||||
docker compose exec -w "/code/$dir" manager docker stack deploy --compose-file="docker-compose.yml" test_stack
|
||||
fi
|
||||
fi
|
||||
|
||||
docker compose exec -e TEST_VERSION=$IMAGE_TAG $test_context /bin/sh -c "/code/$test"
|
||||
|
|
Loading…
Add table
Reference in a new issue