4 echo >&2 "usage: $0 [--doc] [--sso] [--api] [--workbench] [--keep]"
5 echo >&2 "If no switches are given, the default is to start all servers."
8 if [[ "$ENABLE_SSH" != "" ]]; then
9 EXTRA=" -e ENABLE_SSH=$ENABLE_SSH"
46 # If no options were selected, then start all servers.
47 if $start_doc || $start_sso || $start_api || $start_workbench || $start_keep
60 echo `docker inspect $container |grep IPAddress |cut -f4 -d\"`
63 function start_container {
65 if [[ "$2" != '' ]]; then
68 if [[ "$3" != '' ]]; then
71 if [[ "$4" != '' ]]; then
76 `docker ps |grep -P "$2[^/]" -q`
77 if [[ "$?" == "0" ]]; then
78 echo "You have a running container with name $2 -- skipping."
82 echo "Starting container:"
83 echo " docker run -d -i -t$EXTRA $port $name $volume $link $image"
84 container=`docker run -d -i -t$EXTRA $port $name $volume $link $image`
85 if [[ "$?" != "0" ]]; then
86 echo "Unable to start container"
90 ip=$(ip_address $container )
92 echo "You can ssh into the container with:"
99 function make_keep_volume {
100 # Mount a keep volume if we don't already have one
102 for mountpoint in $(cut -d ' ' -f 2 /proc/mounts); do
103 if [[ -d "$mountpoint/keep" && "$mountpoint" != "/" ]]; then
104 keepvolume=$mountpoint
108 if [[ "$keepvolume" == '' ]]; then
109 keepvolume=$(mktemp -d)
110 echo "mounting 512M tmpfs keep volume in $keepvolume"
111 sudo mount -t tmpfs -o size=512M tmpfs $keepvolume
112 mkdir $keepvolume/keep
117 $start_doc && start_container "9898:80" "doc_server" '' '' "arvados/doc"
118 $start_sso && start_container "9901:443" "sso_server" '' '' "arvados/sso"
119 $start_api && start_container "9900:443" "api_server" '' "sso_server:sso" "arvados/api"
120 $start_workbench && start_container "9899:80" "workbench_server" '' "api_server:api" "arvados/workbench"
122 keepvolume=$(make_keep_volume)
123 $start_keep && start_container "25107:25107" "keep_server_0" "$keepvolume:/dev/keep-0" '' "arvados/warehouse"
124 $start_keep && start_container "25108:25107" "keep_server_1" "$keepvolume:/dev/keep-0" '' "arvados/warehouse"