19015: installer fix: work around a Passenger issue with the detection of RVM
[arvados.git] / tools / salt-install / config_examples / single_host / multiple_hostnames / pillars / nginx_passenger.sls
index 6faafb5b562f743106ad4fcd67d3ad65c4cabf07..e51ec21eb919278215d37bc37f46755017a7ea36 100644 (file)
@@ -3,19 +3,19 @@
 #
 # SPDX-License-Identifier: AGPL-3.0
 
-{%- if grains.os_family in ('RedHat',) %}
-  {%- set passenger_pkg = 'nginx-mod-http-passenger' %}
-  {%- set passenger_mod = '/usr/lib64/nginx/modules/ngx_http_passenger_module.so' %}
-  {%- set passenger_ruby = '/usr/local/rvm/rubies/ruby-2.7.2/bin/ruby' %}
-{%- else %}
-  {%- set passenger_pkg = 'libnginx-mod-http-passenger' %}
-  {%- set passenger_mod = '/usr/lib/nginx/modules/ngx_http_passenger_module.so' %}
-  {%- set passenger_ruby = '/usr/bin/ruby' %}
-{%- endif %}
+{%- set passenger_pkg = 'nginx-mod-http-passenger'
+                          if grains.osfinger in ('CentOS Linux-7') else
+                        'libnginx-mod-http-passenger' %}
+{%- set passenger_mod = '/usr/lib64/nginx/modules/ngx_http_passenger_module.so'
+                          if grains.osfinger in ('CentOS Linux-7',) else
+                        '/usr/lib/nginx/modules/ngx_http_passenger_module.so' %}
+{%- set passenger_ruby = '/usr/local/rvm/rubies/ruby-2.7.2/bin/ruby'
+                           if grains.osfinger in ('CentOS Linux-7', 'Ubuntu-18.04', 'Debian-10') else
+                         '/usr/bin/ruby' %}
 
 ### NGINX
 nginx:
-  install_from_phusionpassenger: true
+  __NGINX_INSTALL_SOURCE__: true
   lookup:
     passenger_package: {{ passenger_pkg }}
   ### PASSENGER
@@ -25,11 +25,17 @@ nginx:
   ### SERVER
   server:
     config:
+      # Needed for RVM, harmless otherwise. Cf. https://dev.arvados.org/issues/19015
+      env: GEM_HOME
+      # As we now differentiate where passenger is required or not, we need to
+      # load this module conditionally, so we add this conditional just to use
+      # the same pillar file
+      {% if "install_from_phusionpassenger" == "__NGINX_INSTALL_SOURCE__" %}
       # This is required to get the passenger module loaded
       # In Debian it can be done with this
       # include: 'modules-enabled/*.conf'
       load_module: {{ passenger_mod }}
-
+      {% endif %}
       worker_processes: 4
 
   ### SNIPPETS
@@ -62,10 +68,6 @@ nginx:
       # replace with the IP address of your resolver
       # - resolver: 127.0.0.1
 
-    arvados-snakeoil.conf:
-      - ssl_certificate: /etc/ssl/private/arvados-snakeoil-cert.pem
-      - ssl_certificate_key: /etc/ssl/private/arvados-snakeoil-cert.key
-
   ### SITES
   servers:
     managed: