Browse Source

Merge pull request #119 from grobinson-blockchain/master

Auto-restart NGINX and use pillars to set conf path when building from source
tags/v0.55.0
Forrest 8 years ago
parent
commit
a35b606d9c
5 changed files with 11 additions and 5 deletions
  1. +4
    -2
      nginx/ng/files/nginx.service
  2. +0
    -1
      nginx/ng/map.jinja
  3. +2
    -2
      nginx/ng/src.sls
  4. +4
    -0
      nginx/ng/vhosts_config.sls
  5. +1
    -0
      pillar.example

+ 4
- 2
nginx/ng/files/nginx.service View File

@@ -7,9 +7,11 @@ Type=forking
PIDFile=/run/nginx.pid
ExecStartPre=/usr/sbin/nginx -t
ExecStart=/usr/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecReload=/usr/sbin/nginx -s reload
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=on-failure
RestartSec=10s
PrivateTmp=true

[Install]
WantedBy=multi-user.target
WantedBy=multi-user.target

+ 0
- 1
nginx/ng/map.jinja View File

@@ -81,7 +81,6 @@
'source_hash': '8ed647c3dd65bc4ced03b0e0f6bf9e633eff6b01bac772bcf97077d58bc2be4d',
'source': {
'opts': {},
'modules': {}
},
'package': {
'opts': {},

+ 2
- 2
nginx/ng/src.sls View File

@@ -29,7 +29,7 @@ nginx_download:

nginx_configure:
cmd.run:
- name: ./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf {{ nginx.source.opts | join(' ') }}
- name: ./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path={{ nginx.lookup.conf_file or '/etc/nginx/nginx.conf' }} {{ nginx.source.opts | join(' ') }}
- cwd: /tmp/nginx-{{ nginx.source_version }}
- require:
- archive: nginx_download
@@ -59,4 +59,4 @@ nginx_link:
- require:
- cmd: nginx_install
- onchanges:
- cmd: nginx_install
- cmd: nginx_install

+ 4
- 0
nginx/ng/vhosts_config.sls View File

@@ -94,6 +94,10 @@ nginx_vhost_available_dir:
- template: jinja
- context:
config: {{ settings.config|json() }}
{% if 'overwrite' in vhost and vhost.overwrite == False %}
- unless:
- test -e {{ vhost_curpath(vhost) }}
{% endif %}
{% do vhost_states.append(conf_state_id) %}
{% endif %}


+ 1
- 0
pillar.example View File

@@ -90,6 +90,7 @@ nginx:
enabled_dir: /tmp/sites-enabled # an alternate directory (not sites-enabled) where this vhost may be found
disabled_name: mysite.aint_on # an alternative disabled name to be use when not symlinking
enabled: True
overwrite: True # overwrite an existing vhost file or not
# May be a list of config options or None, if None, no vhost file will be managed/templated
# Take server directives as lists of dictionaries. If the dictionary value is another list of

Loading…
Cancel
Save