X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/332a26ebf92320cf4c3c9a02cf3d82870dc742bf..35bf3afb8b312dcc30fe3b61042779d33bf1db10:/tools/salt-install/provision.sh diff --git a/tools/salt-install/provision.sh b/tools/salt-install/provision.sh index 19ec6eccbe..0ecb7217d7 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 @@ -99,8 +100,8 @@ arguments() { done } -CONFIG="${SCRIPT_DIR}/local.params" -CONFIG_DIR="config_examples/single_host/multiple_hostnames" +CONFIG_FILE="${SCRIPT_DIR}/local.params" +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" @@ -148,7 +151,16 @@ arguments ${@} if [ -s ${CONFIG_FILE} ]; then source ${CONFIG_FILE} else - echo >&2 "Please create a '${CONFIG_FILE}' file with initial values, as described in FIXME_URL_TO_DESCR" + echo >&2 "Please create a '${CONFIG_FILE}' file 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 [ ! -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 @@ -164,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 @@ -209,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 @@ -220,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; @@ -257,9 +280,13 @@ for f in "${SOURCE_PILLARS_DIR}"/*; do "${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; @@ -277,7 +304,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; @@ -336,7 +363,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 @@ -350,7 +377,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 @@ -396,7 +423,7 @@ 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 @@ -413,15 +440,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