aboutsummaryrefslogtreecommitdiffstats
path: root/docker/osx-setup-docker-machine.sh
diff options
context:
space:
mode:
authorArnstein Ressem <aressem@yahoo-inc.com>2016-06-21 16:46:56 +0200
committerArnstein Ressem <aressem@yahoo-inc.com>2016-06-21 16:46:56 +0200
commit37ab232dca8f5accf2ce2a5f8ca1f62b64212da0 (patch)
tree164f8f2fd9781126092908e8685711f0c9900964 /docker/osx-setup-docker-machine.sh
parenta22a1e279ceb30c9e7d75865305df4d574efbc72 (diff)
Further work on the build/run vespa on docker.
Diffstat (limited to 'docker/osx-setup-docker-machine.sh')
-rwxr-xr-xdocker/osx-setup-docker-machine.sh42
1 files changed, 42 insertions, 0 deletions
diff --git a/docker/osx-setup-docker-machine.sh b/docker/osx-setup-docker-machine.sh
new file mode 100755
index 00000000000..ce27012ab46
--- /dev/null
+++ b/docker/osx-setup-docker-machine.sh
@@ -0,0 +1,42 @@
+#!/bin/bash
+
+DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd)
+cd $DIR
+
+DOCKER_VM_NAME=vespa-docker-machine
+DOCKER_VM_DISK_SIZE_IN_MB=40000
+DOCKER_VM_MEMORY_SIZE_IN_MB=4000
+DOCKER_VM_CPU_COUNT=4
+
+DOCKER_VM_WAS_STARTED=false
+
+if ! docker-machine status "$DOCKER_VM_NAME" &> /dev/null; then
+ # Machine does not exist and we have to create and start
+ docker-machine create -d virtualbox \
+ --virtualbox-disk-size "$DOCKER_VM_DISK_SIZE_IN_MB" \
+ --virtualbox-memory "$DOCKER_VM_MEMORY_SIZE_IN_MB" \
+ --virtualbox-cpu-count "$DOCKER_VM_CPU_COUNT" \
+ "$DOCKER_VM_NAME"
+
+ eval $(docker-machine env "$DOCKER_VM_NAME")
+ DOCKER_VM_WAS_STARTED=true
+fi
+
+
+VESPA_VM_STATUS=$(docker-machine status "$DOCKER_VM_NAME")
+if [ "$VESPA_VM_STATUS" = "Stopped" ]; then
+ docker-machine start "$DOCKER_VM_NAME"
+ DOCKER_VM_WAS_STARTED=true
+ VESPA_VM_STATUS=$(docker-machine status "$DOCKER_VM_NAME")
+fi
+
+if [ "$VESPA_VM_STATUS" != "Running" ]; then
+ echo "Unable to get Docker machine $DOCKER_VM_NAME up and running."
+ echo "You can try to manually remove the machine: docker-machine rm -y $DOCKER_VM_NAME "
+ echo " and then rerun this script."
+ echo "Exiting."
+ exit 1
+fi
+
+eval $(docker-machine env "$DOCKER_VM_NAME")
+