Merge pull request #119 from grobinson-blockchain/master

Auto-restart NGINX and use pillars to set conf path when building from source
This commit is contained in:
Forrest 2016-06-05 12:20:00 -07:00
commit a35b606d9c
5 changed files with 11 additions and 5 deletions

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

View File

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

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

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 %}

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