8 echo >&2 "$0 start [--ssh] [--doc] [--sso] [--api] [--workbench] [--keep]"
11 echo >&2 "If no switches are given, the default is to start all servers."
16 echo `docker inspect $container |grep IPAddress |cut -f4 -d\"`
19 function start_container {
21 if [[ "$2" != '' ]]; then
23 DOCKER_ARGS="$DOCKER_ARGS -name $name"
25 if [[ "$3" != '' ]]; then
27 DOCKER_ARGS="$DOCKER_ARGS -v $volume"
29 if [[ "$4" != '' ]]; then
31 DOCKER_ARGS="$DOCKER_ARGS -link $link"
37 DOCKER_ARGS="$DOCKER_ARGS -e ENABLE_SSH=$ENABLE_SSH"
40 `docker ps |grep -P "$name[^/]" -q`
41 if [[ "$?" == "0" ]]; then
42 echo "You have a running container with name $name -- skipping."
46 # If a container by this name already exists, remove it before
49 echo "Starting container:"
50 echo " docker run $DOCKER_ARGS $image"
51 container=`docker run $DOCKER_ARGS $image`
52 if [[ "$?" != "0" ]]; then
53 echo "Unable to start container"
58 ip=$(ip_address $container )
60 echo "You can ssh into the container with:"
67 declare -a keep_volumes
69 # Initialize the global `keep_volumes' array. If any keep volumes
70 # already appear to exist (mounted volumes with a top-level "keep"
71 # directory), use them; create temporary volumes if necessary.
73 function make_keep_volumes () {
74 # Mount a keep volume if we don't already have one
75 for mountpoint in $(cut -d ' ' -f 2 /proc/mounts); do
76 if [[ -d "$mountpoint/keep" && "$mountpoint" != "/" ]]; then
77 keep_volumes+=($mountpoint)
81 # Create any keep volumes that do not yet exist.
82 while [ ${#keep_volumes[*]} -lt 2 ]
85 echo >&2 "mounting 512M tmpfs keep volume in $new_keep"
86 sudo mount -t tmpfs -o size=512M tmpfs $new_keep
88 keep_volumes+=($new_keep)
96 local start_workbench=false
97 local start_keep=false
128 # If no options were selected, then start all servers.
129 if $start_doc || $start_sso || $start_api || $start_workbench || $start_keep
140 $start_doc && start_container "9898:80" "doc_server" '' '' "arvados/doc"
141 $start_sso && start_container "9901:443" "sso_server" '' '' "arvados/sso"
142 $start_api && start_container "9900:443" "api_server" '' "sso_server:sso" "arvados/api"
143 $start_workbench && start_container "9899:80" "workbench_server" '' "api_server:api" "arvados/workbench"
146 $start_keep && start_container "25107:25107" "keep_server_0" "${keep_volumes[0]}:/dev/keep-0" "api_server:api" "arvados/warehouse"
147 $start_keep && start_container "25108:25107" "keep_server_1" "${keep_volumes[1]}:/dev/keep-0" "api_server:api" "arvados/warehouse"
149 ARVADOS_API_HOST=$(ip_address "api_server")
150 ARVADOS_API_HOST_INSECURE=yes
151 ARVADOS_API_TOKEN=$(grep '^\w' api/generated/secret_token.rb | cut -d "'" -f 2)
153 echo "To run a test suite:"
154 echo "export ARVADOS_API_HOST=$ARVADOS_API_HOST"
155 echo "export ARVADOS_API_HOST_INSECURE=$ARVADOS_API_HOST_INSECURE"
156 echo "export ARVADOS_API_TOKEN=$ARVADOS_API_TOKEN"
157 echo "python -m unittest discover ../sdk/python"