X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/dde8a2e6ac2eba20a45b85d556f53c8f0ef201c7..refs/heads/17607-register-shell-nodes:/tools/salt-install/provision.sh diff --git a/tools/salt-install/provision.sh b/tools/salt-install/provision.sh index 51acc8e4a2..193ab502c7 100755 --- a/tools/salt-install/provision.sh +++ b/tools/salt-install/provision.sh @@ -28,14 +28,15 @@ usage() { echo >&2 " Possible values are:" echo >&2 " api" echo >&2 " controller" + echo >&2 " dispatcher" + echo >&2 " keepproxy" echo >&2 " keepstore" - echo >&2 " websocket" echo >&2 " keepweb" - echo >&2 " workbench2" - echo >&2 " keepproxy" echo >&2 " shell" + echo >&2 " webshell" + echo >&2 " websocket" echo >&2 " workbench" - echo >&2 " dispatcher" + echo >&2 " workbench2" echo >&2 " Defaults to applying them all" echo >&2 " -h, --help Display this help and exit" echo >&2 " -v, --vagrant Run in vagrant and use the /vagrant shared dir" @@ -70,7 +71,7 @@ arguments() { for i in ${2//,/ } do # Verify the role exists - if [[ ! "database,api,controller,keepstore,websocket,keepweb,workbench2,keepproxy,shell,workbench,dispatcher" == *"$i"* ]]; then + if [[ ! "database,api,controller,keepstore,websocket,keepweb,workbench2,webshell,keepproxy,shell,workbench,dispatcher" == *"$i"* ]]; then echo "The role '${i}' is not a valid role" usage exit 1 @@ -100,7 +101,7 @@ arguments() { } CONFIG_FILE="${SCRIPT_DIR}/local.params" -CONFIG_DIR="config_examples/single_host/multiple_hostnames" +CONFIG_DIR="local_config_dir" LOG_LEVEL="info" CONTROLLER_EXT_SSL_PORT=443 TESTS_DIR="tests" @@ -127,10 +128,12 @@ WORKBENCH1_EXT_SSL_PORT=443 WORKBENCH2_EXT_SSL_PORT=3001 RELEASE="production" -VERSION="latest" -ARVADOS_TAG="v1.1.4" +VERSION="2.1.2-1" + +# Formulas versions +ARVADOS_TAG="master" POSTGRES_TAG="v0.41.6" -NGINX_TAG="v2.5.0" +NGINX_TAG="temp-fix-missing-statements-in-pillar" DOCKER_TAG="v1.0.0" LOCALE_TAG="v0.3.4" LETSENCRYPT_TAG="v2.1.0" @@ -154,6 +157,13 @@ else exit 1 fi +if [ ! -d ${CONFIG_DIR} ]; then + echo >&2 "Please create a '${CONFIG_DIR}' with initial values, as described in" + echo >&2 " * https://doc.arvados.org/install/salt-single-host.html#single_host, or" + echo >&2 " * https://doc.arvados.org/install/salt-multi-host.html#multi_host_multi_hostnames" + exit 1 +fi + if grep -q 'fixme_or_this_wont_work' ${CONFIG_FILE} ; then echo >&2 "The config file ${CONFIG_FILE} has some parameters that need to be modified." echo >&2 "Please, fix them and re-run the provision script." @@ -166,6 +176,11 @@ if ! grep -E '^[[:alnum:]]{5}$' <<<${CLUSTER} ; then exit 1 fi +# Only used in single_host/single_name deploys +if [ "x${HOSTNAME_EXT}" = "x" ] ; then + HOSTNAME_EXT="${CLUSTER}.${DOMAIN}" +fi + apt-get update apt-get install -y curl git jq @@ -211,9 +226,11 @@ if [ "x${BRANCH}" != "x" ]; then fi if [ "x${VAGRANT}" = "xyes" ]; then - SOURCE_PILLARS_DIR="/vagrant/${CONFIG_DIR}/pillars" - SOURCE_TESTS_DIR="/vagrant/${TESTS_DIR}" + EXTRA_STATES_DIR="/home/vagrant/${CONFIG_DIR}/states" + SOURCE_PILLARS_DIR="/home/vagrant/${CONFIG_DIR}/pillars" + SOURCE_TESTS_DIR="/home/vagrant/${TESTS_DIR}" else + EXTRA_STATES_DIR="${SCRIPT_DIR}/${CONFIG_DIR}/states" SOURCE_PILLARS_DIR="${SCRIPT_DIR}/${CONFIG_DIR}/pillars" SOURCE_TESTS_DIR="${SCRIPT_DIR}/${TESTS_DIR}" fi @@ -222,7 +239,11 @@ SOURCE_STATES_DIR="${EXTRA_STATES_DIR}" # Replace variables (cluster, domain, etc) in the pillars, states and tests # to ease deployment for newcomers -for f in "${SOURCE_PILLARS_DIR}"/*; do +if [ ! -d "${SOURCE_PILLARS_DIR}" ]; then + echo "${SOURCE_PILLARS_DIR} does not exist or is not a directory. Exiting." + exit 1 +fi +for f in $(ls "${SOURCE_PILLARS_DIR}"/*); do sed "s#__ANONYMOUS_USER_TOKEN__#${ANONYMOUS_USER_TOKEN}#g; s#__BLOB_SIGNING_KEY__#${BLOB_SIGNING_KEY}#g; s#__CONTROLLER_EXT_SSL_PORT__#${CONTROLLER_EXT_SSL_PORT}#g; @@ -252,16 +273,22 @@ for f in "${SOURCE_PILLARS_DIR}"/*; do s#__KEEPSTORE1_INT_IP__#${KEEPSTORE1_INT_IP}#g; s#__KEEPWEB_INT_IP__#${KEEPWEB_INT_IP}#g; s#__WEBSHELL_INT_IP__#${WEBSHELL_INT_IP}#g; + s#__SHELL_INT_IP__#${SHELL_INT_IP}#g; s#__WORKBENCH1_INT_IP__#${WORKBENCH1_INT_IP}#g; s#__WORKBENCH2_INT_IP__#${WORKBENCH2_INT_IP}#g; s#__DATABASE_INT_IP__#${DATABASE_INT_IP}#g; + s#__SHELL_INT_IP__#${SHELL_INT_IP}#g; s#__WORKBENCH_SECRET_KEY__#${WORKBENCH_SECRET_KEY}#g" \ "${f}" > "${P_DIR}"/$(basename "${f}") done +if [ "x${TEST}" = "xyes" ] && [ ! -d "${SOURCE_TESTS_DIR}" ]; then + echo "You requested to run tests, but ${SOURCE_TESTS_DIR} does not exist or is not a directory. Exiting." + exit 1 +fi mkdir -p /tmp/cluster_tests # Replace cluster and domain name in the test files -for f in "${SOURCE_TESTS_DIR}"/*; do +for f in $(ls "${SOURCE_TESTS_DIR}"/*); do sed "s#__CLUSTER__#${CLUSTER}#g; s#__CONTROLLER_EXT_SSL_PORT__#${CONTROLLER_EXT_SSL_PORT}#g; s#__DOMAIN__#${DOMAIN}#g; @@ -279,7 +306,7 @@ chmod 755 /tmp/cluster_tests/run-test.sh if [ -d "${SOURCE_STATES_DIR}" ]; then mkdir -p "${F_DIR}"/extra/extra - for f in "${SOURCE_STATES_DIR}"/*; do + for f in $(ls "${SOURCE_STATES_DIR}"/*); do sed "s#__ANONYMOUS_USER_TOKEN__#${ANONYMOUS_USER_TOKEN}#g; s#__CLUSTER__#${CLUSTER}#g; s#__BLOB_SIGNING_KEY__#${BLOB_SIGNING_KEY}#g; @@ -312,6 +339,7 @@ if [ -d "${SOURCE_STATES_DIR}" ]; then s#__WEBSOCKET_EXT_SSL_PORT__#${WEBSOCKET_EXT_SSL_PORT}#g; s#__WORKBENCH1_EXT_SSL_PORT__#${WORKBENCH1_EXT_SSL_PORT}#g; s#__WORKBENCH2_EXT_SSL_PORT__#${WORKBENCH2_EXT_SSL_PORT}#g; + s#__SHELL_INT_IP__#${SHELL_INT_IP}#g; s#__WORKBENCH_SECRET_KEY__#${WORKBENCH_SECRET_KEY}#g" \ "${f}" > "${F_DIR}/extra/extra"/$(basename "${f}") done @@ -338,7 +366,7 @@ EOFPSLS # States, extra states if [ -d "${F_DIR}"/extra/extra ]; then - for f in "${F_DIR}"/extra/extra/*.sls; do + for f in $(ls "${F_DIR}"/extra/extra/*.sls); do echo " - extra.$(basename ${f} | sed 's/.sls$//g')" >> ${S_DIR}/top.sls done fi @@ -352,7 +380,7 @@ if [ -z "${ROLES}" ]; then grep -q "letsencrypt" ${S_DIR}/top.sls || echo " - letsencrypt" >> ${S_DIR}/top.sls fi echo " - postgres" >> ${S_DIR}/top.sls - echo " - docker" >> ${S_DIR}/top.sls + echo " - docker.software" >> ${S_DIR}/top.sls echo " - arvados" >> ${S_DIR}/top.sls # Pillars @@ -398,13 +426,16 @@ else grep -q "nginx_passenger" ${P_DIR}/top.sls || echo " - nginx_passenger" >> ${P_DIR}/top.sls grep -q "nginx_${R}_configuration" ${P_DIR}/top.sls || echo " - nginx_${R}_configuration" >> ${P_DIR}/top.sls ;; - "controller" | "websocket" | "workbench" | "workbench2" | "keepweb" | "keepproxy") + "controller" | "websocket" | "workbench" | "workbench2" | "webshell" | "keepweb" | "keepproxy") # States grep -q "nginx.passenger" ${S_DIR}/top.sls || echo " - nginx.passenger" >> ${S_DIR}/top.sls if [ "x${USE_LETSENCRYPT}" = "xyes" ]; then grep -q "letsencrypt" ${S_DIR}/top.sls || echo " - letsencrypt" >> ${S_DIR}/top.sls fi - grep -q "arvados.${R}" ${S_DIR}/top.sls || echo " - arvados.${R}" >> ${S_DIR}/top.sls + # webshell role is just a nginx vhost, so it has no state + if [ "${R}" != "webshell" ]; then + grep -q "arvados.${R}" ${S_DIR}/top.sls || echo " - arvados.${R}" >> ${S_DIR}/top.sls + fi # Pillars grep -q "nginx_passenger" ${P_DIR}/top.sls || echo " - nginx_passenger" >> ${P_DIR}/top.sls grep -q "nginx_${R}_configuration" ${P_DIR}/top.sls || echo " - nginx_${R}_configuration" >> ${P_DIR}/top.sls @@ -415,15 +446,14 @@ else ;; "shell") # States - grep -q "docker" ${S_DIR}/top.sls || echo " - docker" >> ${S_DIR}/top.sls + grep -q "docker" ${S_DIR}/top.sls || echo " - docker.software" >> ${S_DIR}/top.sls grep -q "arvados.${R}" ${S_DIR}/top.sls || echo " - arvados.${R}" >> ${S_DIR}/top.sls # Pillars grep -q "" ${P_DIR}/top.sls || echo " - docker" >> ${P_DIR}/top.sls - grep -q "nginx_webshell_configuration" ${P_DIR}/top.sls || echo " - nginx_webshell_configuration" >> ${P_DIR}/top.sls ;; "dispatcher") # States - grep -q "docker" ${S_DIR}/top.sls || echo " - docker" >> ${S_DIR}/top.sls + grep -q "docker" ${S_DIR}/top.sls || echo " - docker.software" >> ${S_DIR}/top.sls grep -q "arvados.${R}" ${S_DIR}/top.sls || echo " - arvados.${R}" >> ${S_DIR}/top.sls # Pillars # ATM, no specific pillar needed