20688: Update single host/multiple hostname template
[arvados.git] / tools / salt-install / config_examples / single_host / multiple_hostnames / pillars / nginx_workbench2_configuration.sls
index 50c960cbcb3dfd836eec32155eb7318be3574cda..081be151efd18025c523f8d6af277ffd727edd08 100644 (file)
@@ -1,18 +1,14 @@
 ---
 # Copyright (C) The Arvados Authors. All rights reserved.
 #
-# SPDX-License-Identifier: Apache-2.0
+# SPDX-License-Identifier: AGPL-3.0
 
-{%- if grains.os_family in ('RedHat',) %}
-  {%- set group = 'nginx' %}
-{%- else %}
-  {%- set group = 'www-data' %}
-{%- endif %}
+{%- import_yaml "ssl_key_encrypted.sls" as ssl_key_encrypted_pillar %}
 
 ### ARVADOS
 arvados:
   config:
-    group: {{ group }}
+    group: www-data
 
 ### NGINX
 nginx:
@@ -25,11 +21,9 @@ nginx:
         overwrite: true
         config:
           - server:
-            - server_name: workbench2.__CLUSTER__.__DOMAIN__
+            - server_name: workbench2.__DOMAIN__
             - listen:
               - 80
-            - location /.well-known:
-              - root: /var/www
             - location /:
               - return: '301 https://$host$request_uri'
 
@@ -37,22 +31,21 @@ nginx:
         enabled: true
         overwrite: true
         requires:
-          file: extra_custom_certs_file_copy_arvados-workbench2.pem
+          __CERT_REQUIRES__
         config:
           - server:
-            - server_name: workbench2.__CLUSTER__.__DOMAIN__
+            - server_name: workbench2.__DOMAIN__
             - listen:
               - __CONTROLLER_EXT_SSL_PORT__ http2 ssl
-            - index: index.html index.htm
+
             - location /:
-              - root: /var/www/arvados-workbench2/workbench2
-              - try_files: '$uri $uri/ /index.html'
-              - 'if (-f $document_root/maintenance.html)':
-                - return: 503
-            - location /config.json:
-              - return: {{ "200 '" ~ '{"API_HOST":"__CLUSTER__.__DOMAIN__:__CONTROLLER_EXT_SSL_PORT__"}' ~ "'" }}
+              - return: '301 https://workbench.__DOMAIN__$request_uri'
+
             - include: snippets/ssl_hardening_default.conf
-            - ssl_certificate: /etc/nginx/ssl/arvados-workbench2.pem
-            - ssl_certificate_key: /etc/nginx/ssl/arvados-workbench2.key
-            - access_log: /var/log/nginx/workbench2.__CLUSTER__.__DOMAIN__.access.log combined
-            - error_log: /var/log/nginx/workbench2.__CLUSTER__.__DOMAIN__.error.log
+            - ssl_certificate: __CERT_PEM__
+            - ssl_certificate_key: __CERT_KEY__
+            {%- if ssl_key_encrypted_pillar.ssl_key_encrypted.enabled %}
+            - ssl_password_file: {{ '/run/arvados/' | path_join(ssl_key_encrypted_pillar.ssl_key_encrypted.privkey_password_filename) }}
+            {%- endif %}
+            - access_log: /var/log/nginx/workbench2.__DOMAIN__.access.log combined
+            - error_log: /var/log/nginx/workbench2.__DOMAIN__.error.log