X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/652aec8c581bb6c38bae2c98f0611b142f855e4b..c51634cad3c68d0a8400f1b1c47da9eef5307e06:/docker/arvdock diff --git a/docker/arvdock b/docker/arvdock index 544c64148e..e36e5cfd59 100755 --- a/docker/arvdock +++ b/docker/arvdock @@ -18,10 +18,12 @@ function usage { echo >&2 " -w[port], --workbench[=port] Workbench server (default port 9899)" echo >&2 " -s[port], --sso[=port] SSO server (default port 9901)" echo >&2 " -a[port], --api[=port] API server (default port 9900)" - echo >&2 " -c[count], --compute[=count] Compute nodes (default starts 2)" - echo >&2 " -k, --keep Keep servers" - echo >&2 " --ssh Enable SSH access to server containers" - echo >&2 " -h, --help Display this help and exit" + echo >&2 " -c, --compute Compute nodes (starts 2)" + echo >&2 " -v, --vm Shell server" + echo >&2 " -n, --nameserver Nameserver" + echo >&2 " -k, --keep Keep servers" + echo >&2 " --ssh Enable SSH access to server containers" + echo >&2 " -h, --help Display this help and exit" echo >&2 echo >&2 " If no options are given, the action is applied to all servers." echo >&2 @@ -43,13 +45,14 @@ function start_container { if [[ "$2" != '' ]]; then local name="$2" if [[ "$name" == "api_server" ]]; then - args="$args --hostname api --name $name" + args="$args --dns=172.17.42.1 --dns-search=compute.dev.arvados --hostname api -P --name $name" elif [[ "$name" == "compute" ]]; then name=$name$COMPUTE_COUNTER - args="$args --hostname compute$COMPUTE_COUNTER --name $name" + # We need --privileged because we run docker-inside-docker on the compute nodes + args="$args --dns=172.17.42.1 --dns-search=compute.dev.arvados --hostname compute$COMPUTE_COUNTER -P --privileged --name $name" let COMPUTE_COUNTER=$(($COMPUTE_COUNTER + 1)) else - args="$args --name $name" + args="$args --dns=172.17.42.1 --dns-search=dev.arvados --hostname ${name#_server} --name $name" fi fi if [[ "$3" != '' ]]; then @@ -77,13 +80,14 @@ function start_container { $DOCKER rm "$name" 2>/dev/null echo "Starting container:" + #echo " $DOCKER run --dns=127.0.0.1 $args $image" echo " $DOCKER run $args $image" container=`$DOCKER run $args $image` - if [[ "$?" != "0" ]]; then + if [ "$?" != "0" -o "$container" = "" ]; then echo "Unable to start container" exit 1 fi - if $ENABLE_SSH + if [ "$name" == "compute" -o "$ENABLE_SSH" != "false" ]; then ip=$(ip_address $container ) echo @@ -91,6 +95,8 @@ function start_container { echo echo " ssh root@$ip" echo + else + echo "Started container: $container" fi if [[ "$name" == "doc_server" ]]; then @@ -143,11 +149,13 @@ function do_start { local start_api=false local start_compute=false local start_workbench=false + local start_vm=false + local start_nameserver=false local start_keep=false # NOTE: This requires GNU getopt (part of the util-linux package on Debian-based distros). - local TEMP=`getopt -o d::s::a::c::w::kh \ - --long doc::,sso::,api::,compute::,workbench::,keep,help,ssh \ + local TEMP=`getopt -o d::s::a::cw::nkvh \ + --long doc::,sso::,api::,compute,workbench::,nameserver,keep,vm,help,ssh \ -n "$0" -- "$@"` if [ $? != 0 ] ; then echo "Use -h for help"; exit 1 ; fi @@ -177,10 +185,8 @@ function do_start { esac ;; -c | --compute) - case "$2" in - "") start_compute=2; shift 2 ;; - *) start_compute=$2; shift 2 ;; - esac + start_compute=2 + shift ;; -w | --workbench) case "$2" in @@ -188,6 +194,14 @@ function do_start { *) start_workbench=$2; shift 2 ;; esac ;; + -v | --vm) + start_vm=true + shift + ;; + -n | --nameserver) + start_nameserver=true + shift + ;; -k | --keep) start_keep=true shift @@ -214,6 +228,8 @@ function do_start { $start_api == false && $start_compute == false && $start_workbench == false && + $start_vm == false && + $start_nameserver == false && $start_keep == false ]] then start_doc=9898 @@ -221,6 +237,8 @@ function do_start { start_api=9900 start_compute=2 start_workbench=9899 + start_vm=true + start_nameserver=true start_keep=true fi @@ -234,6 +252,24 @@ function do_start { start_container "$start_api:443" "api_server" '' "sso_server:sso" "arvados/api" fi + if [[ $start_nameserver != false ]] + then + # We rely on skydock and skydns for dns discovery between the slurm controller and compute nodes, + # so make sure they are running + $DOCKER ps | grep skydns >/dev/null + if [[ "$?" != "0" ]]; then + echo "Starting crosbymichael/skydns container..." + $DOCKER rm "skydns" 2>/dev/null + $DOCKER run -d -p 172.17.42.1:53:53/udp --name skydns crosbymichael/skydns -nameserver 8.8.8.8:53 -domain arvados + fi + $DOCKER ps | grep skydock >/dev/null + if [[ "$?" != "0" ]]; then + echo "Starting crosbymichael/skydock container..." + $DOCKER rm "skydock" 2>/dev/null + $DOCKER run -d -v /var/run/docker.sock:/docker.sock --name skydock crosbymichael/skydock -ttl 30 -environment dev -s /docker.sock -domain arvados -name skydns + fi + fi + if [[ $start_compute != false ]] then for i in `seq 0 $(($start_compute - 1))`; do @@ -251,11 +287,11 @@ function do_start { [ -f $v/keep/.metadata.yml ] && sudo rm $v/keep/.metadata.yml done start_container "25107:25107" "keep_server_0" \ - "${keep_volumes[0]}:/dev/keep-0" \ + "${keep_volumes[0]}:/keep-data" \ "api_server:api" \ "arvados/keep" start_container "25108:25107" "keep_server_1" \ - "${keep_volumes[1]}:/dev/keep-0" \ + "${keep_volumes[1]}:/keep-data" \ "api_server:api" \ "arvados/keep" fi @@ -265,6 +301,11 @@ function do_start { start_container "$start_doc:80" "doc_server" '' '' "arvados/doc" fi + if [[ $start_vm != false ]] + then + start_container "" "shell" '' "api_server:api" "arvados/shell" + fi + if [[ $start_workbench != false ]] then start_container "$start_workbench:80" "workbench_server" '' "api_server:api" "arvados/workbench" @@ -287,11 +328,13 @@ function do_stop { local stop_api="" local stop_compute="" local stop_workbench="" + local stop_nameserver="" + local stop_vm="" local stop_keep="" # NOTE: This requires GNU getopt (part of the util-linux package on Debian-based distros). - local TEMP=`getopt -o dsacwkh \ - --long doc,sso,api,compute,workbench,keep,help \ + local TEMP=`getopt -o dsacwnkvh \ + --long doc,sso,api,compute,workbench,nameserver,keep,vm,help \ -n "$0" -- "$@"` if [ $? != 0 ] ; then echo "Use -h for help"; exit 1 ; fi @@ -312,6 +355,10 @@ function do_stop { stop_compute=`$DOCKER ps |grep -P "compute\d+" |grep -v api_server |cut -f1 -d ' '` ; shift ;; -w | --workbench) stop_workbench=workbench_server ; shift ;; + -n | --nameserver ) + stop_nameserver="skydock skydns" ; shift ;; + -v | --vm ) + stop_vm="shell" ; shift ;; -k | --keep ) stop_keep="keep_server_0 keep_server_1" ; shift ;; --) @@ -331,6 +378,8 @@ function do_stop { $stop_api == "" && $stop_compute == "" && $stop_workbench == "" && + $stop_vm == "" && + $stop_nameserver == "" && $stop_keep == "" ]] then stop_doc=doc_server @@ -338,10 +387,12 @@ function do_stop { stop_api=api_server stop_compute=`$DOCKER ps |grep -P "compute\d+" |grep -v api_server |cut -f1 -d ' '` stop_workbench=workbench_server + stop_vm=shell + stop_nameserver="skydock skydns" stop_keep="keep_server_0 keep_server_1" fi - $DOCKER stop $stop_doc $stop_sso $stop_api $stop_compute $stop_workbench $stop_keep \ + $DOCKER stop $stop_doc $stop_sso $stop_api $stop_compute $stop_workbench $stop_nameserver $stop_keep $stop_vm \ 2>/dev/null }