[ARVADOS] created: 2.1.0-2393-g267c02294

Git user git at public.arvados.org
Thu Apr 28 13:23:44 UTC 2022


        at  267c02294d7d5c1f161921f9dade6b692a7029a2 (commit)


commit 267c02294d7d5c1f161921f9dade6b692a7029a2
Author: Ward Vandewege <ward at curii.com>
Date:   Wed Apr 27 17:56:26 2022 -0400

    19015: installer fix: work around a Passenger issue with the detection of RVM
    
    This fixes the on-demand building of passenger_native_support.so when
    RVM is in use.
    
    Arvados-DCO-1.1-Signed-off-by: Ward Vandewege <ward at curii.com>

diff --git a/tools/salt-install/config_examples/multi_host/aws/pillars/nginx_passenger.sls b/tools/salt-install/config_examples/multi_host/aws/pillars/nginx_passenger.sls
index fbd42bd7a..2b6b96c3a 100644
--- a/tools/salt-install/config_examples/multi_host/aws/pillars/nginx_passenger.sls
+++ b/tools/salt-install/config_examples/multi_host/aws/pillars/nginx_passenger.sls
@@ -25,6 +25,8 @@ 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
diff --git a/tools/salt-install/config_examples/multi_host/aws/states/passenger_rvm.sls b/tools/salt-install/config_examples/multi_host/aws/states/passenger_rvm.sls
new file mode 100644
index 000000000..cb6799f2d
--- /dev/null
+++ b/tools/salt-install/config_examples/multi_host/aws/states/passenger_rvm.sls
@@ -0,0 +1,43 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+{%- if grains.os_family in ('RedHat',) %}
+  {%- set group = 'nginx' %}
+{%- else %}
+  {%- set group = 'www-data' %}
+{%- endif %}
+
+# Make sure that /var/www/.passenger exists with the proper ownership
+# so that passenger can build passenger_native_support.so
+extra_var_www_passenger:
+  file.directory:
+    - name: /var/www/.passenger
+    - user: {{ group }}
+    - group: {{ group }}
+    - mode: '0755'
+    - makedirs: True
+
+{%- if grains.osfinger in ('CentOS Linux-7', 'Ubuntu-18.04', 'Debian-10') %}
+# Work around passenger issue when RVM is in use, cf
+# https://dev.arvados.org/issues/19015
+extra_nginx_set_gem_home:
+  file.managed:
+    - name: /etc/systemd/system/nginx.service.d/override.conf
+    - mode: '0644'
+    - user: root
+    - group: root
+    - makedirs: True
+    - replace: False
+    - contents: |
+        [Service]
+        ExecStart=
+        ExecStart=/bin/bash -a -c "GEM_HOME=`/usr/local/rvm/bin/rvm-exec default env |grep GEM_HOME=|cut -f2 -d=` && /usr/sbin/nginx -g 'daemon on; master_process on;'"
+  cmd.run:
+    - name: systemctl daemon-reload
+    - require:
+      - file: extra_nginx_set_gem_home
+      - file: extra_var_www_passenger
+    - onchanges:
+      - file: extra_nginx_set_gem_home
+{%- endif -%}
diff --git a/tools/salt-install/config_examples/single_host/multiple_hostnames/pillars/nginx_passenger.sls b/tools/salt-install/config_examples/single_host/multiple_hostnames/pillars/nginx_passenger.sls
index dbf21c265..e51ec21eb 100644
--- a/tools/salt-install/config_examples/single_host/multiple_hostnames/pillars/nginx_passenger.sls
+++ b/tools/salt-install/config_examples/single_host/multiple_hostnames/pillars/nginx_passenger.sls
@@ -25,6 +25,8 @@ 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
diff --git a/tools/salt-install/config_examples/single_host/multiple_hostnames/states/passenger_rvm.sls b/tools/salt-install/config_examples/single_host/multiple_hostnames/states/passenger_rvm.sls
new file mode 100644
index 000000000..cb6799f2d
--- /dev/null
+++ b/tools/salt-install/config_examples/single_host/multiple_hostnames/states/passenger_rvm.sls
@@ -0,0 +1,43 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+{%- if grains.os_family in ('RedHat',) %}
+  {%- set group = 'nginx' %}
+{%- else %}
+  {%- set group = 'www-data' %}
+{%- endif %}
+
+# Make sure that /var/www/.passenger exists with the proper ownership
+# so that passenger can build passenger_native_support.so
+extra_var_www_passenger:
+  file.directory:
+    - name: /var/www/.passenger
+    - user: {{ group }}
+    - group: {{ group }}
+    - mode: '0755'
+    - makedirs: True
+
+{%- if grains.osfinger in ('CentOS Linux-7', 'Ubuntu-18.04', 'Debian-10') %}
+# Work around passenger issue when RVM is in use, cf
+# https://dev.arvados.org/issues/19015
+extra_nginx_set_gem_home:
+  file.managed:
+    - name: /etc/systemd/system/nginx.service.d/override.conf
+    - mode: '0644'
+    - user: root
+    - group: root
+    - makedirs: True
+    - replace: False
+    - contents: |
+        [Service]
+        ExecStart=
+        ExecStart=/bin/bash -a -c "GEM_HOME=`/usr/local/rvm/bin/rvm-exec default env |grep GEM_HOME=|cut -f2 -d=` && /usr/sbin/nginx -g 'daemon on; master_process on;'"
+  cmd.run:
+    - name: systemctl daemon-reload
+    - require:
+      - file: extra_nginx_set_gem_home
+      - file: extra_var_www_passenger
+    - onchanges:
+      - file: extra_nginx_set_gem_home
+{%- endif -%}
diff --git a/tools/salt-install/config_examples/single_host/single_hostname/pillars/nginx_passenger.sls b/tools/salt-install/config_examples/single_host/single_hostname/pillars/nginx_passenger.sls
index c25720c60..2b764eb2c 100644
--- a/tools/salt-install/config_examples/single_host/single_hostname/pillars/nginx_passenger.sls
+++ b/tools/salt-install/config_examples/single_host/single_hostname/pillars/nginx_passenger.sls
@@ -25,6 +25,8 @@ 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
diff --git a/tools/salt-install/config_examples/single_host/single_hostname/states/passenger_rvm.sls b/tools/salt-install/config_examples/single_host/single_hostname/states/passenger_rvm.sls
new file mode 100644
index 000000000..cb6799f2d
--- /dev/null
+++ b/tools/salt-install/config_examples/single_host/single_hostname/states/passenger_rvm.sls
@@ -0,0 +1,43 @@
+# Copyright (C) The Arvados Authors. All rights reserved.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+{%- if grains.os_family in ('RedHat',) %}
+  {%- set group = 'nginx' %}
+{%- else %}
+  {%- set group = 'www-data' %}
+{%- endif %}
+
+# Make sure that /var/www/.passenger exists with the proper ownership
+# so that passenger can build passenger_native_support.so
+extra_var_www_passenger:
+  file.directory:
+    - name: /var/www/.passenger
+    - user: {{ group }}
+    - group: {{ group }}
+    - mode: '0755'
+    - makedirs: True
+
+{%- if grains.osfinger in ('CentOS Linux-7', 'Ubuntu-18.04', 'Debian-10') %}
+# Work around passenger issue when RVM is in use, cf
+# https://dev.arvados.org/issues/19015
+extra_nginx_set_gem_home:
+  file.managed:
+    - name: /etc/systemd/system/nginx.service.d/override.conf
+    - mode: '0644'
+    - user: root
+    - group: root
+    - makedirs: True
+    - replace: False
+    - contents: |
+        [Service]
+        ExecStart=
+        ExecStart=/bin/bash -a -c "GEM_HOME=`/usr/local/rvm/bin/rvm-exec default env |grep GEM_HOME=|cut -f2 -d=` && /usr/sbin/nginx -g 'daemon on; master_process on;'"
+  cmd.run:
+    - name: systemctl daemon-reload
+    - require:
+      - file: extra_nginx_set_gem_home
+      - file: extra_var_www_passenger
+    - onchanges:
+      - file: extra_nginx_set_gem_home
+{%- endif -%}
diff --git a/tools/salt-install/provision.sh b/tools/salt-install/provision.sh
index 669d04d92..ad01c691b 100755
--- a/tools/salt-install/provision.sh
+++ b/tools/salt-install/provision.sh
@@ -565,6 +565,7 @@ if [ -z "${ROLES}" ]; then
   echo "    - arvados" >> ${S_DIR}/top.sls
   echo "    - extra.shell_sudo_passwordless" >> ${S_DIR}/top.sls
   echo "    - extra.shell_cron_add_login_sync" >> ${S_DIR}/top.sls
+  echo "    - extra.passenger_rvm" >> ${S_DIR}/top.sls
 
   # Pillars
   echo "    - docker" >> ${P_DIR}/top.sls
@@ -657,6 +658,7 @@ else
         else
           echo "    - nginx.passenger" >> ${S_DIR}/top.sls
         fi
+        echo "    - extra.passenger_rvm" >> ${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
         if [ "${SSL_MODE}" = "lets-encrypt" ]; then

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list