Commit 637eb6bc authored by Cédric Le Ninivin's avatar Cédric Le Ninivin

apache-frontend: check configuration file before reloading apache

parent 29591f85
......@@ -59,7 +59,7 @@ mode = 0644
[template-apache-frontend]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-apache-frontend.cfg
md5sum = f0a507fed2b1dcab5530c892adce8327
#md5sum = f0a507fed2b1dcab5530c892adce8327
output = ${buildout:directory}/template-apache-frontend.cfg
mode = 0644
......@@ -72,7 +72,7 @@ mode = 0644
[template-slave-list]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/apache-custom-slave-list.cfg.in
md5sum = f002a8fc8fc5d18adbd8ac1ee054e852
#md5sum = f002a8fc8fc5d18adbd8ac1ee054e852
mode = 640
[template-slave-configuration]
......@@ -139,7 +139,7 @@ mode = 640
[template-squid-configuration]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/squid.conf.jinja2
md5sum = 484fee19b2ca102f2baf3bd04893dd2c
#md5sum = 484fee19b2ca102f2baf3bd04893dd2c
mode = 640
[template-empty]
......@@ -147,3 +147,9 @@ recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/empty.in
md5sum = c2314c3a9c3412a38d14b312d3df83c1
mode = 640
[template-wrapper]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/wrapper.in
#md5sum = c2314c3a9c3412a38d14b312d3df83c1
mode = 640
\ No newline at end of file
......@@ -292,6 +292,8 @@ pid-file = $${directory:run}/httpd.pid
protected-path = /
access-control-string = none
cached-rewrite-file = $${directory:etc}/apache_rewrite_cached.txt
frontend-graceful-command = ${apache-2.2:location}/bin/httpd -Sf $${:frontend-configuration}; if [ $? -eq 0 ]; then kill -USR1 $(cat $${:pid-file}); fi
cached-graceful-command = ${apache-2.2:location}/bin/httpd -Sf $${:cached-configuration}; if [ $? -eq 0 ]; then kill -USR1 $(cat $${apache-configuration:cache-pid-file}); fi
# Apache for cache configuration
cache-access-log = $${directory:log}/frontend-apache-access-cached.log
......@@ -381,7 +383,7 @@ name = apache
log = $${apache-configuration:error-log} $${apache-configuration:access-log}
frequency = daily
rotatep-num = 30
post = ${buildout:bin-directory}/killpidfromfile $${apache-configuration:pid-file} SIGUSR1
post = $${apache-configuration:frontend-graceful-command}
sharedscripts = true
notifempty = true
create = true
......@@ -393,7 +395,7 @@ name = apache-cached
log = $${apache-configuration:cache-error-log} $${apache-configuration:cache-access-log}
frequency = daily
rotatep-num = 30
post = ${buildout:bin-directory}/killpidfromfile $${apache-configuration:cache-pid-file} SIGUSR1
post = $${apache-configuration:cached-graceful-command}
sharedscripts = true
notifempty = true
create = true
......@@ -471,14 +473,20 @@ port = $${apache-configuration:cache-port}
# End of Squid part
[frontend-apache-graceful]
recipe = slapos.cookbook:wrapper
command-line = ${buildout:bin-directory}/killpidfromfile $${apache-configuration:pid-file} SIGUSR1
wrapper-path = $${directory:etc-run}/frontend-apache-graceful
< = jinja2-template-base
template = ${template-wrapper:target}
rendered = $${directory:etc-run}/frontend-apache-safe-graceful
mode = 0700
extra-context =
key content apache-configuration:frontend-graceful-command
[cached-apache-graceful]
recipe = slapos.cookbook:wrapper
command-line = ${buildout:bin-directory}/killpidfromfile $${apache-configuration:cache-pid-file} SIGUSR1
wrapper-path = $${directory:etc-run}/cached-apache-graceful
< = jinja2-template-base
template = ${template-wrapper:target}
rendered = $${directory:etc-run}/cached-apache-safe-graceful
mode = 0700
extra-context =
key content apache-configuration:cached-graceful-command
[promise-apache-frontend-v4-https]
recipe = slapos.cookbook:check_port_listening
......
......@@ -53,7 +53,7 @@ log = {{slave_parameter_dict.get('access_log')}} {{slave_parameter_dict.get('err
backup = {{ '${' + slave_directory_section + ':log-folder}' }}
frequency = daily
rotatep-num = 30
post = ${buildout:bin-directory}/killpidfromfile {{ apache_configuration.get('pid-file') }} SIGUSR1
post = {{ apache_configuration.get('frontend-graceful-command') }}
sharedscripts = true
notifempty = true
create = true
......
#!/bin/sh
{{ content }}
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment