From 2f1a32178aa39fd5021434cbad6131f45c6888e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sybren=20A=2E=20St=C3=BCvel?= Date: Fri, 10 Mar 2017 14:24:22 +0100 Subject: [PATCH] Explicitly pass hostname to deploy script. The script now also pings the hostname to deply to, to see if it's alive before doing anything else. --- deploy.sh | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/deploy.sh b/deploy.sh index efa8200..c5c4188 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,17 +1,25 @@ #!/bin/bash -e case $1 in - production) - DEPLOYHOST="cloud.blender.org" - ;; - staging) - DEPLOYHOST="cloud2" + cloud*) + DEPLOYHOST="$1" ;; *) - echo "Use $0 cloud|staging" >&2 + echo "Use $0 cloud{nr}|cloud.blender.org" >&2 exit 1 esac +echo -n "Deploying to ${DEPLOYHOST}... " + +if ! ping ${DEPLOYHOST} -q -c 1 -w 2 >/dev/null; then + echo "host ${DEPLOYHOST} cannot be pinged, refusing to deploy." >&2 + exit 2 +fi + +echo "press [ENTER] to continue, Ctrl+C to abort." +read dummy + + # Deploys the current production branch to the production machine. PROJECT_NAME="blender-cloud" DOCKER_NAME="blender_cloud"