From de87185185ba445ec376d396199685e1535ac9ce Mon Sep 17 00:00:00 2001 From: Christoph Schranz Date: Fri, 15 Nov 2019 11:22:33 +0100 Subject: [PATCH] Parametrised hostname --- add-to-swarm.sh | 3 ++- docker-compose-swarm.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/add-to-swarm.sh b/add-to-swarm.sh index ac3530e..c27f775 100755 --- a/add-to-swarm.sh +++ b/add-to-swarm.sh @@ -31,9 +31,10 @@ if [[ "$result" != *" $NETWORK "* ]]; then fi # starting in swarm -echo "Adding gpu-jupyter to the swarm in the network $NETWORK on port $PORT." +export HOSTNAME=$(hostname) export JUPYTER_PORT=$PORT export JUPYTER_NETWORK=$NETWORK +echo "Adding gpu-jupyter to the swarm on the node $HOSTNAME in the network $NETWORK on port $PORT." # echo $JUPYTER_NETWORK envsubst < docker-compose-swarm.yml > .docker-compose-swarm.yml.envsubst docker-compose -f .docker-compose-swarm.yml.envsubst build diff --git a/docker-compose-swarm.yml b/docker-compose-swarm.yml index abb95f4..be51d4c 100755 --- a/docker-compose-swarm.yml +++ b/docker-compose-swarm.yml @@ -18,7 +18,7 @@ services: - $JUPYTER_NETWORK deploy: placement: - constraints: [node.hostname == data-science] + constraints: [node.hostname == $HOSTNAME] resources: limits: cpus: "4"