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 ...@@ -59,7 +59,7 @@ mode = 0644
[template-apache-frontend] [template-apache-frontend]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-apache-frontend.cfg url = ${:_profile_base_location_}/instance-apache-frontend.cfg
md5sum = f0a507fed2b1dcab5530c892adce8327 #md5sum = f0a507fed2b1dcab5530c892adce8327
output = ${buildout:directory}/template-apache-frontend.cfg output = ${buildout:directory}/template-apache-frontend.cfg
mode = 0644 mode = 0644
...@@ -72,7 +72,7 @@ mode = 0644 ...@@ -72,7 +72,7 @@ mode = 0644
[template-slave-list] [template-slave-list]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/apache-custom-slave-list.cfg.in url = ${:_profile_base_location_}/templates/apache-custom-slave-list.cfg.in
md5sum = f002a8fc8fc5d18adbd8ac1ee054e852 #md5sum = f002a8fc8fc5d18adbd8ac1ee054e852
mode = 640 mode = 640
[template-slave-configuration] [template-slave-configuration]
...@@ -139,11 +139,17 @@ mode = 640 ...@@ -139,11 +139,17 @@ mode = 640
[template-squid-configuration] [template-squid-configuration]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/squid.conf.jinja2 url = ${:_profile_base_location_}/templates/squid.conf.jinja2
md5sum = 484fee19b2ca102f2baf3bd04893dd2c #md5sum = 484fee19b2ca102f2baf3bd04893dd2c
mode = 640 mode = 640
[template-empty] [template-empty]
recipe = slapos.recipe.build:download recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/empty.in url = ${:_profile_base_location_}/templates/empty.in
md5sum = c2314c3a9c3412a38d14b312d3df83c1 md5sum = c2314c3a9c3412a38d14b312d3df83c1
mode = 640
[template-wrapper]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/templates/wrapper.in
#md5sum = c2314c3a9c3412a38d14b312d3df83c1
mode = 640 mode = 640
\ No newline at end of file
...@@ -292,6 +292,8 @@ pid-file = $${directory:run}/httpd.pid ...@@ -292,6 +292,8 @@ pid-file = $${directory:run}/httpd.pid
protected-path = / protected-path = /
access-control-string = none access-control-string = none
cached-rewrite-file = $${directory:etc}/apache_rewrite_cached.txt 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 # Apache for cache configuration
cache-access-log = $${directory:log}/frontend-apache-access-cached.log cache-access-log = $${directory:log}/frontend-apache-access-cached.log
...@@ -381,7 +383,7 @@ name = apache ...@@ -381,7 +383,7 @@ name = apache
log = $${apache-configuration:error-log} $${apache-configuration:access-log} log = $${apache-configuration:error-log} $${apache-configuration:access-log}
frequency = daily frequency = daily
rotatep-num = 30 rotatep-num = 30
post = ${buildout:bin-directory}/killpidfromfile $${apache-configuration:pid-file} SIGUSR1 post = $${apache-configuration:frontend-graceful-command}
sharedscripts = true sharedscripts = true
notifempty = true notifempty = true
create = true create = true
...@@ -393,7 +395,7 @@ name = apache-cached ...@@ -393,7 +395,7 @@ name = apache-cached
log = $${apache-configuration:cache-error-log} $${apache-configuration:cache-access-log} log = $${apache-configuration:cache-error-log} $${apache-configuration:cache-access-log}
frequency = daily frequency = daily
rotatep-num = 30 rotatep-num = 30
post = ${buildout:bin-directory}/killpidfromfile $${apache-configuration:cache-pid-file} SIGUSR1 post = $${apache-configuration:cached-graceful-command}
sharedscripts = true sharedscripts = true
notifempty = true notifempty = true
create = true create = true
...@@ -471,14 +473,20 @@ port = $${apache-configuration:cache-port} ...@@ -471,14 +473,20 @@ port = $${apache-configuration:cache-port}
# End of Squid part # End of Squid part
[frontend-apache-graceful] [frontend-apache-graceful]
recipe = slapos.cookbook:wrapper < = jinja2-template-base
command-line = ${buildout:bin-directory}/killpidfromfile $${apache-configuration:pid-file} SIGUSR1 template = ${template-wrapper:target}
wrapper-path = $${directory:etc-run}/frontend-apache-graceful rendered = $${directory:etc-run}/frontend-apache-safe-graceful
mode = 0700
extra-context =
key content apache-configuration:frontend-graceful-command
[cached-apache-graceful] [cached-apache-graceful]
recipe = slapos.cookbook:wrapper < = jinja2-template-base
command-line = ${buildout:bin-directory}/killpidfromfile $${apache-configuration:cache-pid-file} SIGUSR1 template = ${template-wrapper:target}
wrapper-path = $${directory:etc-run}/cached-apache-graceful rendered = $${directory:etc-run}/cached-apache-safe-graceful
mode = 0700
extra-context =
key content apache-configuration:cached-graceful-command
[promise-apache-frontend-v4-https] [promise-apache-frontend-v4-https]
recipe = slapos.cookbook:check_port_listening recipe = slapos.cookbook:check_port_listening
......
...@@ -53,7 +53,7 @@ log = {{slave_parameter_dict.get('access_log')}} {{slave_parameter_dict.get('err ...@@ -53,7 +53,7 @@ log = {{slave_parameter_dict.get('access_log')}} {{slave_parameter_dict.get('err
backup = {{ '${' + slave_directory_section + ':log-folder}' }} backup = {{ '${' + slave_directory_section + ':log-folder}' }}
frequency = daily frequency = daily
rotatep-num = 30 rotatep-num = 30
post = ${buildout:bin-directory}/killpidfromfile {{ apache_configuration.get('pid-file') }} SIGUSR1 post = {{ apache_configuration.get('frontend-graceful-command') }}
sharedscripts = true sharedscripts = true
notifempty = true notifempty = true
create = 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