Merge branch '17603-nginx-webshell-vhost-fix'
authorJavier Bértoli <jbertoli@curii.com>
Fri, 28 May 2021 21:21:50 +0000 (18:21 -0300)
committerJavier Bértoli <jbertoli@curii.com>
Fri, 28 May 2021 21:21:50 +0000 (18:21 -0300)
closes #17603
Arvados-DCO-1.1-Signed-off-by: Javier Bértoli <jbertoli@curii.com>

1  2 
doc/install/salt-multi-host.html.textile.liquid
tools/salt-install/local.params.example.multiple_hosts
tools/salt-install/provision.sh

index 9322f698636beb4a6004aea857c7143939fd9573,04ef9e8684fed19bdd66db9779e361054f7b5e20..ed57807c727df9cca9833ec3ae4fb8f3017cfaae
@@@ -39,6 -39,7 +39,7 @@@ We suggest distributing the Arvados com
  # WORKBENCH node:
  ## arvados workbench
  ## arvados workbench2
+ ## arvados webshell
  # KEEPPROXY node:
  ## arvados keepproxy
  ## arvados keepweb
@@@ -56,19 -57,11 +57,19 @@@ Check "the Arvados terraform documentat
  
  h2(#multi_host). Multi host install using the provision.sh script
  
 -This is a package-based installation method. The Salt scripts are available from the "tools/salt-install":https://github.com/arvados/arvados/tree/master/tools/salt-install directory in the Arvados git repository.
 +{% if site.current_version %}
 +{% assign branchname = site.current_version | slice: 1, 5 | append: '-dev' %}
 +{% else %}
 +{% assign branchname = 'master' %}
 +{% endif %}
  
 -This procedure will install all the main Arvados components to get you up and running in a multi host environment.
 +This is a package-based installation method. Start with the @provision.sh@ script which is available by cloning the @{{ branchname }}@ branch from "https://git.arvados.org/arvados.git":https://git.arvados.org/arvados.git .  The @provision.sh@ script and its supporting files can be found in the "arvados/tools/salt-install":https://git.arvados.org/arvados.git/tree/refs/heads/{{ branchname }}:/tools/salt-install directory in the Arvados git repository.
  
 -We suggest you to use the @provision.sh@ script to deploy Arvados, which is implemented with the @arvados-formula@ in a Saltstack master-less setup. After setting up a few variables in a config file (next step), you'll be ready to run it and get Arvados deployed.
 +This procedure will install all the main Arvados components to get you up and running in a multi-host environment.
 +
 +The @provision.sh@ script will help you deploy Arvados by preparing your environment to be able to run the installer, then running it. The actual installer is located at "arvados-formula":https://git.arvados.org/arvados-formula.git/tree/refs/heads/{{ branchname }} and will be cloned during the running of the @provision.sh@ script.  The installer is built using "Saltstack":https://saltproject.io/ and @provision.sh@ performs the install using master-less mode.
 +
 +After setting up a few variables in a config file (next step), you'll be ready to run it and get Arvados deployed.
  
  h3(#create_a_compute_image). Create a compute image
  
@@@ -153,7 -146,7 +154,7 @@@ ssh user@host sudo ./provision.sh --con
  #. Workbench
  <notextile>
  <pre><code>scp -r provision.sh local* user@host:
- ssh user@host sudo ./provision.sh --config local.params --roles workbench,workbench2
+ ssh user@host sudo ./provision.sh --config local.params --roles workbench,workbench2,webshell
  </code></pre>
  </notextile>
  
@@@ -171,7 -164,7 +172,7 @@@ ssh user@host sudo ./provision.sh --con
  </code></pre>
  </notextile>
  
 -h2(#initial_user). Initial user and login 
 +h2(#initial_user). Initial user and login
  
  At this point you should be able to log into the Arvados cluster. The initial URL will be:
  
index 86f28be37c1bc1c5c66942f09c090cd4df401a36,af2de2e72a870de57dc35fd76d85693d21e7a314..f5e40ff153f92889f6293398e7bc2350c3356561
@@@ -26,17 -26,21 +26,21 @@@ WORKBENCH2_EXT_SSL_PORT=44
  
  # Internal IPs for the configuration
  CLUSTER_INT_CIDR=10.0.0.0/16
+ # Note the IPs in this example are shared between roles, as suggested in
+ # https://doc.arvados.org/main/install/salt-multi-host.html
  CONTROLLER_INT_IP=10.0.0.1
  WEBSOCKET_INT_IP=10.0.0.1
  KEEP_INT_IP=10.0.0.2
+ # Both for collections and downloads
+ KEEPWEB_INT_IP=10.0.0.2
  KEEPSTORE0_INT_IP=10.0.0.3
  KEEPSTORE1_INT_IP=10.0.0.4
- # Both for collections and downloads
- KEEPWEB_INT_IP=10.0.0.5
- WEBSHELL_INT_IP=10.0.0.6
- WORKBENCH1_INT_IP=10.0.0.7
- WORKBENCH2_INT_IP=10.0.0.7
- DATABASE_INT_IP=10.0.0.8
+ WORKBENCH1_INT_IP=10.0.0.5
+ WORKBENCH2_INT_IP=10.0.0.5
+ WEBSHELL_INT_IP=10.0.0.5
+ DATABASE_INT_IP=10.0.0.6
+ SHELL_INT_IP=10.0.0.7
  
  INITIAL_USER="admin"
  INITIAL_USER_PASSWORD="password"
@@@ -62,15 -66,6 +66,15 @@@ DATABASE_PASSWORD=please_set_this_to_so
  # variable to "no", provide and upload your own certificates to the instances and
  # modify the 'nginx_*' salt pillars accordingly
  USE_LETSENCRYPT="yes"
 +USE_LETSENCRYPT_IAM_USER="yes"
 +# For collections, we need to obtain a wildcard certificate for
 +# '*.collections.<cluster>.<domain>'. This is only possible through a DNS-01 challenge.
 +# For that reason, you'll need to provide AWS credentials with permissions to manage
 +# RRs in the route53 zone for the cluster.
 +# WARNING!: If AWS credentials files already exist in the hosts, they won't be replaced.
 +LE_AWS_REGION="us-east-1"
 +LE_AWS_ACCESS_KEY_ID="AKIABCDEFGHIJKLMNOPQ"
 +LE_AWS_SECRET_ACCESS_KEY="thisistherandomstringthatisyoursecretkey"
  
  # The directory to check for the config files (pillars, states) you want to use.
  # There are a few examples under 'config_examples'.
index dd03a8f749389484b74fedfb7c30277e36e0c609,89616528d61a1e5429dd8191daaf87f81fb3d14e..49c817d90f8b9699e78cfce5b4a0ffbd3f019cde
@@@ -28,14 -28,15 +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 +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
@@@ -126,17 -127,11 +127,17 @@@ WEBSOCKET_EXT_SSL_PORT=800
  WORKBENCH1_EXT_SSL_PORT=443
  WORKBENCH2_EXT_SSL_PORT=3001
  
 -RELEASE="production"
 -VERSION="2.1.2-1"
 -
 -# Formulas versions
 +# For a stable release, change RELEASE "production" and VERSION to the
 +# package version (including the iteration, e.g. X.Y.Z-1) of the
 +# release.
 +RELEASE="development"
 +VERSION="latest"
 +
 +# The arvados-formula version.  For a stable release, this should be a
 +# branch name (e.g. X.Y-dev) or tag for the release.
  ARVADOS_TAG="master"
 +
 +# Other formula versions we depend on
  POSTGRES_TAG="v0.41.6"
  NGINX_TAG="temp-fix-missing-statements-in-pillar"
  DOCKER_TAG="v1.0.0"
@@@ -259,9 -254,6 +260,9 @@@ for f in $(ls "${SOURCE_PILLARS_DIR}"/*
         s#__INITIAL_USER_EMAIL__#${INITIAL_USER_EMAIL}#g;
         s#__INITIAL_USER_PASSWORD__#${INITIAL_USER_PASSWORD}#g;
         s#__INITIAL_USER__#${INITIAL_USER}#g;
 +       s#__LE_AWS_REGION__#${LE_AWS_REGION}#g;
 +       s#__LE_AWS_SECRET_ACCESS_KEY__#${LE_AWS_SECRET_ACCESS_KEY}#g;
 +       s#__LE_AWS_ACCESS_KEY_ID__#${LE_AWS_ACCESS_KEY_ID}#g;
         s#__DATABASE_PASSWORD__#${DATABASE_PASSWORD}#g;
         s#__KEEPWEB_EXT_SSL_PORT__#${KEEPWEB_EXT_SSL_PORT}#g;
         s#__KEEP_EXT_SSL_PORT__#${KEEP_EXT_SSL_PORT}#g;
         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;
  if [ -z "${ROLES}" ]; then
    # States
    echo "    - nginx.passenger" >> ${S_DIR}/top.sls
 +  # Currently, only available on config_examples/multi_host/aws
    if [ "x${USE_LETSENCRYPT}" = "xyes" ]; then
 -    grep -q "letsencrypt" ${S_DIR}/top.sls || echo "    - letsencrypt" >> ${S_DIR}/top.sls
 +    if [ "x${USE_LETSENCRYPT_IAM_USER}" = "xyes" ]; then
 +      grep -q "aws_credentials" ${S_DIR}/top.sls || echo "    - aws_credentials" >> ${S_DIR}/top.sls
 +    fi
 +    grep -q "letsencrypt"     ${S_DIR}/top.sls || echo "    - letsencrypt" >> ${S_DIR}/top.sls
    fi
    echo "    - postgres" >> ${S_DIR}/top.sls
    echo "    - docker.software" >> ${S_DIR}/top.sls
    echo "    - nginx_workbench2_configuration" >> ${P_DIR}/top.sls
    echo "    - nginx_workbench_configuration" >> ${P_DIR}/top.sls
    echo "    - postgresql" >> ${P_DIR}/top.sls
 +  # Currently, only available on config_examples/multi_host/aws
    if [ "x${USE_LETSENCRYPT}" = "xyes" ]; then
 -    grep -q "letsencrypt" ${P_DIR}/top.sls || echo "    - letsencrypt" >> ${P_DIR}/top.sls
 +    if [ "x${USE_LETSENCRYPT_IAM_USER}" = "xyes" ]; then
 +      grep -q "aws_credentials" ${P_DIR}/top.sls || echo "    - aws_credentials" >> ${P_DIR}/top.sls
 +    fi
 +    grep -q "letsencrypt"     ${P_DIR}/top.sls || echo "    - letsencrypt" >> ${P_DIR}/top.sls
    fi
  else
    # If we add individual roles, make sure we add the repo first
          grep -q "nginx.passenger" ${S_DIR}/top.sls || echo "    - nginx.passenger" >> ${S_DIR}/top.sls
          ### If we don't install and run LE before arvados-api-server, it fails and breaks everything
          ### after it so we add this here, as we are, after all, sharing the host for api and controller
 +        # Currently, only available on config_examples/multi_host/aws
          if [ "x${USE_LETSENCRYPT}" = "xyes" ]; then
 -          grep -q "letsencrypt" ${S_DIR}/top.sls || echo "    - letsencrypt" >> ${S_DIR}/top.sls
 +          if [ "x${USE_LETSENCRYPT_IAM_USER}" = "xyes" ]; then
 +            grep -q "aws_credentials" ${S_DIR}/top.sls || echo "    - aws_credentials" >> ${S_DIR}/top.sls
 +          fi
 +          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
          # Pillars
 +        grep -q "aws_credentials" ${P_DIR}/top.sls          || echo "    - aws_credentials" >> ${P_DIR}/top.sls
          grep -q "docker" ${P_DIR}/top.sls                   || echo "    - docker" >> ${P_DIR}/top.sls
          grep -q "postgresql" ${P_DIR}/top.sls               || echo "    - postgresql" >> ${P_DIR}/top.sls
          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
 +        # Currently, only available on config_examples/multi_host/aws
          if [ "x${USE_LETSENCRYPT}" = "xyes" ]; then
 -          grep -q "letsencrypt" ${S_DIR}/top.sls || echo "    - letsencrypt" >> ${S_DIR}/top.sls
 +          if [ "x${USE_LETSENCRYPT_IAM_USER}" = "xyes" ]; then
 +            grep -q "aws_credentials" ${S_DIR}/top.sls || echo "    - aws_credentials" >> ${S_DIR}/top.sls
 +          fi
 +          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
 +        # Currently, only available on config_examples/multi_host/aws
          if [ "x${USE_LETSENCRYPT}" = "xyes" ]; then
 -          grep -q "letsencrypt" ${P_DIR}/top.sls || echo "    - letsencrypt" >> ${P_DIR}/top.sls
 +          if [ "x${USE_LETSENCRYPT_IAM_USER}" = "xyes" ]; then
 +            grep -q "aws_credentials" ${P_DIR}/top.sls || echo "    - aws_credentials" >> ${P_DIR}/top.sls
 +          fi
 +          grep -q "letsencrypt"     ${P_DIR}/top.sls || echo "    - letsencrypt" >> ${P_DIR}/top.sls
            grep -q "letsencrypt_${R}_configuration" ${P_DIR}/top.sls || echo "    - letsencrypt_${R}_configuration" >> ${P_DIR}/top.sls
          fi
        ;;
          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