Merge branch '20511-aborted-boot'
[arvados.git] / tools / salt-install / config_examples / multi_host / aws / pillars / nginx_passenger.sls
1 ---
2 # Copyright (C) The Arvados Authors. All rights reserved.
3 #
4 # SPDX-License-Identifier: AGPL-3.0
5
6 {%- set passenger_pkg = 'nginx-mod-http-passenger'
7                           if grains.osfinger in ('CentOS Linux-7') else
8                         'libnginx-mod-http-passenger' %}
9 {%- set passenger_mod = '/usr/lib64/nginx/modules/ngx_http_passenger_module.so'
10                           if grains.osfinger in ('CentOS Linux-7',) else
11                         '/usr/lib/nginx/modules/ngx_http_passenger_module.so' %}
12 {%- set passenger_ruby = '/usr/local/rvm/wrappers/default/ruby'
13                            if grains.osfinger in ('CentOS Linux-7', 'Ubuntu-18.04', 'Debian-10') else
14                          '/usr/bin/ruby' %}
15
16 ### NGINX
17 nginx:
18   __NGINX_INSTALL_SOURCE__: true
19   lookup:
20     passenger_package: {{ passenger_pkg }}
21   ### PASSENGER
22   passenger:
23     passenger_ruby: {{ passenger_ruby }}
24     passenger_max_pool_size: {{ "__CONTROLLER_NGINX_WORKERS__" or grains['num_cpus'] }}
25     {%- set max_reqs = "__CONTROLLER_MAX_CONCURRENT_REQUESTS__" %}
26     {%- if max_reqs != "" and max_reqs is number %}
27     # Default is 100 -- Configuring this a bit higher than API.MaxConcurrentRequests
28     # to be able to handle /metrics requests even on heavy load situations.
29     passenger_max_request_queue_size: {{ (max_reqs * 1.1)|round|int }}
30     {%- endif %}
31
32   ### SERVER
33   server:
34     config:
35       # Needed for RVM, harmless otherwise. Cf. https://dev.arvados.org/issues/19015
36       env: GEM_HOME
37       # As we now differentiate where passenger is required or not, we need to
38       # load this module conditionally, so we add this conditional just to use
39       # the same pillar file
40       {% if "install_from_phusionpassenger" == "__NGINX_INSTALL_SOURCE__" %}
41       # This is required to get the passenger module loaded
42       # In Debian it can be done with this
43       # include: 'modules-enabled/*.conf'
44       load_module: {{ passenger_mod }}
45       {% endif %}
46       worker_processes: {{ "__CONTROLLER_NGINX_WORKERS__" or grains['num_cpus'] }}
47       worker_rlimit_nofile: 4096
48       events:
49         worker_connections: 1024
50
51   ### SNIPPETS
52   snippets:
53     # Based on https://ssl-config.mozilla.org/#server=nginx&version=1.14.2&config=intermediate&openssl=1.1.1d&guideline=5.4
54     ssl_hardening_default.conf:
55       - ssl_session_timeout: 1d
56       - ssl_session_cache: 'shared:arvadosSSL:10m'
57       - ssl_session_tickets: 'off'
58
59       # intermediate configuration
60       - ssl_protocols: TLSv1.2 TLSv1.3
61       - ssl_ciphers: ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384
62       - ssl_prefer_server_ciphers: 'off'
63
64       # HSTS (ngx_http_headers_module is required) (63072000 seconds)
65       - add_header: 'Strict-Transport-Security "max-age=63072000" always'
66
67       # OCSP stapling
68       - ssl_stapling: 'on'
69       - ssl_stapling_verify: 'on'
70
71       # verify chain of trust of OCSP response using Root CA and Intermediate certs
72       # - ssl_trusted_certificate /path/to/root_CA_cert_plus_intermediates
73
74       # curl https://ssl-config.mozilla.org/ffdhe2048.txt > /path/to/dhparam
75       # - ssl_dhparam: /path/to/dhparam
76
77       # replace with the IP address of your resolver
78       # - resolver: 127.0.0.1
79
80   ### SITES
81   servers:
82     managed:
83       # Remove default webserver
84       default:
85         enabled: false