Changeset - 150ae0c46506
[Not reviewed]
0 4 0
Branko Majic (branko) - 6 years ago 2020-05-07 22:39:09
branko@majic.rs
MAR-149: Sort dictionaries in all templates in order to have predicatable order while iterating them (resolves idempotence issues in such cases).
4 files changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
roles/php_website/templates/fpm_site.conf.j2
Show inline comments
 
@@ -6,27 +6,27 @@ user = {{ user }}
 
group = {{ user }}
 

	
 
; Listen on a dedicated UNIX socket.
 
listen = /run/php/{{ fqdn }}.sock
 

	
 
; Set-up UNIX socket permissions (allow web server to connect).
 
listen.owner = www-data
 
listen.group = www-data
 
listen.mode = 0660
 

	
 
; Configure how processes are managed and how many are launched.
 
pm = dynamic
 
pm.max_children = 5
 
pm.start_servers = 2
 
pm.min_spare_servers = 1
 
pm.max_spare_servers = 3
 

	
 
; Chdir to this directory at the start.
 
chdir = /
 

	
 
; Redirect worker stdout/stder into main error log. This will also allow Nginx
 
; to log errors in site-specific log file.
 
catch_workers_output = yes
 

	
 
{% for var, val in additional_fpm_config.items() %}
 
{% for var, val in additional_fpm_config | dictsort %}
 
{{ var }} = {{ val }}
 
{% endfor %}
roles/wsgi_website/templates/environment.sh.j2
Show inline comments
 
{% for var, val in environment_variables.items() %}
 
{% for var, val in environment_variables | dictsort %}
 
export {{ var }}='{{ val }}'
 
{% endfor %}
roles/wsgi_website/templates/nginx_site.j2
Show inline comments
 
@@ -38,41 +38,41 @@ server {
 

	
 
    {% if rewrites -%}
 
    # Site rewrites.
 
    {% for rewrite in rewrites -%}
 
    rewrite {{ rewrite }};
 
    {% endfor -%}
 
    {% endif %}
 

	
 
    {% if static_locations -%}
 
    # Static locations
 
    {% for location in static_locations -%}
 
    location {{ location }} {
 
        try_files $uri $uri/ =404;
 
    }
 
    {% endfor -%}
 
    {% endif %}
 

	
 
    # Pass remaining requests to the WSGI server.
 
    location / {
 
        proxy_set_header X-Forwarded-Proto $scheme;
 
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 
        proxy_set_header Host $http_host;
 
        proxy_redirect off;
 

	
 
    {% for header, value in proxy_headers.items() -%}
 
    {% for header, value in proxy_headers | dictsort -%}
 
    proxy_set_header {{ header }} {{ value }};
 
    {% endfor -%}
 

	
 
        proxy_pass http://unix:/run/wsgi/{{ fqdn }}.sock;
 
    }
 

	
 
    {% if environment_indicator -%}
 
    # Show environment indicator on HTML pages.
 
    sub_filter_types text/html;
 
    sub_filter_once on;
 
    sub_filter "</body>" "<div id='website-environment' style='background-color: {{ environment_indicator.background_colour }}; width: 100%; text-align: center; position: fixed; bottom: 5px; color: {{ environment_indicator.text_colour }}; font-weight: bold; z-index: 999999;'>{{ environment_indicator.text }}</div></body>";
 
    {% endif -%}
 

	
 
    access_log /var/log/nginx/{{ fqdn }}-access.log;
 
    error_log /var/log/nginx/{{ fqdn }}-error.log;
 
}
roles/wsgi_website/templates/systemd_wsgi_website.service.j2
Show inline comments
 
[Unit]
 
Description=Website {{ fqdn }}
 
Requires={{ fqdn }}.socket
 
After=network.target
 

	
 
[Service]
 
User={{ user }}
 
Group={{ user }}
 
WorkingDirectory={{ home }}/code
 
ExecStart={{ home }}/virtualenv/bin/gunicorn --bind unix:/run/wsgi/{{ fqdn }}.sock {% if use_paste %}--paste {{home}}/code/{{ wsgi_application }}{% else %}{{ wsgi_application }}{% endif %}
 

	
 
{% for var, val in environment_variables.items() %}
 
{% for var, val in environment_variables | dictsort %}
 
Environment="{{ var }}={{ val }}"
 
{% endfor %}
 

	
 
ExecReload=/bin/kill -s HUP $MAINPID
 
ExecStop=/bin/kill -s TERM $MAINPID
 
PrivateTmp=true
 
UMask=0007
 

	
 
[Install]
 
WantedBy=multi-user.target
0 comments (0 inline, 0 general)