Commit a725eecb authored by Rafael Monnerat's avatar Rafael Monnerat

wip

parent 5af1d94a
...@@ -19,7 +19,7 @@ md5sum = f686f765e55d1dce2e55a400f0714b3e ...@@ -19,7 +19,7 @@ md5sum = f686f765e55d1dce2e55a400f0714b3e
[template-apache-frontend] [template-apache-frontend]
filename = instance-apache-frontend.cfg filename = instance-apache-frontend.cfg
md5sum = ea599162be999680cd43d4605762219f md5sum = 86f9ace5eb5ac28dbc173e1803952f03
[template-apache-replicate] [template-apache-replicate]
filename = instance-apache-replicate.cfg.in filename = instance-apache-replicate.cfg.in
...@@ -27,7 +27,7 @@ md5sum = 9b17c835bcd927269cf510bf612f5985 ...@@ -27,7 +27,7 @@ md5sum = 9b17c835bcd927269cf510bf612f5985
[template-slave-list] [template-slave-list]
filename = templates/apache-custom-slave-list.cfg.in filename = templates/apache-custom-slave-list.cfg.in
md5sum = 5d9ac851493534c90397d453497c21b4 md5sum = 4010f7366262d00c33f9e7f53f63d42e
[template-slave-configuration] [template-slave-configuration]
filename = templates/custom-virtualhost.conf.in filename = templates/custom-virtualhost.conf.in
...@@ -43,7 +43,7 @@ md5sum = 070658d10546b5a69fe291e0da876e62 ...@@ -43,7 +43,7 @@ md5sum = 070658d10546b5a69fe291e0da876e62
[template-custom-slave-list] [template-custom-slave-list]
filename = templates/apache-custom-slave-list.cfg.in filename = templates/apache-custom-slave-list.cfg.in
md5sum = 5d9ac851493534c90397d453497c21b4 md5sum = 4010f7366262d00c33f9e7f53f63d42e
[template-not-found-html] [template-not-found-html]
filename = templates/notfound.html filename = templates/notfound.html
...@@ -93,6 +93,10 @@ md5sum = a5186f666acb2f040ede04c91e60408f ...@@ -93,6 +93,10 @@ md5sum = a5186f666acb2f040ede04c91e60408f
filename = templates/nginx-notebook-slave.conf.in filename = templates/nginx-notebook-slave.conf.in
md5sum = 82d74a7f2aceb2b4a7acc6259291b7f2 md5sum = 82d74a7f2aceb2b4a7acc6259291b7f2
[template-apache-lazy-script-call.sh.in] [template-apache-lazy-script-call]
filename = templates/apache-lazy-script-call.sh.in filename = templates/apache-lazy-script-call.sh.in
md5sum = f519bea5b54448c5ad486c4ef6c0fb23 md5sum = f94ba895196706c80a19b2981e2a1c5a
[template-apache-graceful-script]
filename = templates/apache-graceful-script.sh.in
md5sum = 6541deeee97730c8a032b70a7a6e89a0
...@@ -145,6 +145,9 @@ mode = 0644 ...@@ -145,6 +145,9 @@ mode = 0644
<=download-template <=download-template
filename = apache-lazy-script-call.sh.in filename = apache-lazy-script-call.sh.in
[template-apache-graceful-script]
<=download-template
filename = apache-graceful-script.sh.in
[template-nginx-eventsource-slave-virtualhost] [template-nginx-eventsource-slave-virtualhost]
<=download-template <=download-template
......
...@@ -172,8 +172,6 @@ extra-context = ...@@ -172,8 +172,6 @@ extra-context =
key nginx_configuration_directory apache-directory:nginx-slave-configuration key nginx_configuration_directory apache-directory:nginx-slave-configuration
key apache_cached_configuration_directory apache-directory:slave-with-cache-configuration key apache_cached_configuration_directory apache-directory:slave-with-cache-configuration
key slave_with_cache_configuration_directory apache-directory:slave-with-cache-configuration key slave_with_cache_configuration_directory apache-directory:slave-with-cache-configuration
key cached_port apache-configuration:cache-through-port
key ssl_cached_port apache-configuration:ssl-cache-through-port
key http_port instance-parameter:configuration.plain_http_port key http_port instance-parameter:configuration.plain_http_port
key https_port instance-parameter:configuration.port key https_port instance-parameter:configuration.port
key nginx_http_port instance-parameter:configuration.plain_nginx_port key nginx_http_port instance-parameter:configuration.plain_nginx_port
...@@ -185,7 +183,6 @@ extra-context = ...@@ -185,7 +183,6 @@ extra-context =
key apache_log_directory apache-directory:slave-log key apache_log_directory apache-directory:slave-log
key local_ipv4 instance-parameter:ipv4-random key local_ipv4 instance-parameter:ipv4-random
key global_ipv6 slap-network-information:global-ipv6 key global_ipv6 slap-network-information:global-ipv6
key cache_port apache-configuration:cache-port
key varnginx directory:varnginx key varnginx directory:varnginx
key empty_template software-release-path:template-empty key empty_template software-release-path:template-empty
key template_custom_slave_configuration software-release-path:template-slave-configuration key template_custom_slave_configuration software-release-path:template-slave-configuration
...@@ -194,6 +191,7 @@ extra-context = ...@@ -194,6 +191,7 @@ extra-context =
key template_eventsource_slave_configuration software-release-path:template-nginx-eventsource-slave-virtualhost key template_eventsource_slave_configuration software-release-path:template-nginx-eventsource-slave-virtualhost
key template_notebook_slave_configuration software-release-path:template-nginx-notebook-slave-virtualhost key template_notebook_slave_configuration software-release-path:template-nginx-notebook-slave-virtualhost
raw software_type single-custom-personal raw software_type single-custom-personal
key frontend_lazy_graceful_reload frontend-apache-lazy-graceful:rendered
section logrotate_dict logrotate section logrotate_dict logrotate
section frontend_configuration frontend-configuration section frontend_configuration frontend-configuration
section apache_configuration apache-configuration section apache_configuration apache-configuration
...@@ -372,7 +370,7 @@ name = apache ...@@ -372,7 +370,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 = $${apache-configuration:frontend-graceful-command} post = $${frontend-apache-lazy-graceful:rendered} &
sharedscripts = true sharedscripts = true
notifempty = true notifempty = true
create = true create = true
...@@ -500,26 +498,34 @@ mode = 700 ...@@ -500,26 +498,34 @@ mode = 700
### End of ATS sections ### End of ATS sections
### Apaches Graceful and promises ### Apaches Graceful and promises
[frontend-apache-graceful] [frontend-apache-graceful-bin]
< = jinja2-template-base < = jinja2-template-base
template = ${template-wrapper:output} template = ${template-wrapper:output}
rendered = $${directory:etc-run}/frontend-apache-safe-graceful rendered = $${directory:bin}/frontend-apache-safe-graceful
mode = 0700 mode = 0700
extra-context = extra-context =
key content apache-configuration:frontend-graceful-command key content apache-configuration:frontend-graceful-command
[frontend-apache-graceful]
< = jinja2-template-base
template = ${template-apache-graceful-script:target}
rendered = $${directory:etc-run}/frontend-apache-safe-graceful
mode = 0700
extra-context =
key directory_run directory:run
key directory_etc directory:etc
key apache_graceful_reload_command apache-configuration:frontend-graceful-command
[frontend-apache-lazy-graceful] [frontend-apache-lazy-graceful]
< = jinja2-template-base < = jinja2-template-base
template = ${template-apache-lazy-script-call:output} template = ${template-apache-lazy-script-call:target}
rendered = $${directory:bin}/frontend-apache-lazy-graceful rendered = $${directory:bin}/frontend-apache-lazy-graceful
mode = 0700 mode = 0700
pid-file = $${directory:run}/lazy-graceful.pid
extra-context = extra-context =
key pid_file :pid-file
raw wait_time 60 raw wait_time 60
key content apache-configuration:frontend-graceful-command key lazy_command apache-configuration:frontend-graceful-command
# Promises checking configuration: # Promises checking configuration:
[promise-frontend-apache-configuration] [promise-frontend-apache-configuration]
......
...@@ -2,6 +2,9 @@ ...@@ -2,6 +2,9 @@
{% set cached_server_dict = {} -%} {% set cached_server_dict = {} -%}
{% set part_list = [] -%} {% set part_list = [] -%}
{% set cache_port = apache_configuration.get('cache-port') %}
{% set cached_port = apache_configuration.get('cache-through-port') %}
{% set ssl_cached_port = apache_configuration.get('ssl-cache-through-port') %}
{% set cache_access = "http://%s:%s" % (local_ipv4, cache_port) -%} {% set cache_access = "http://%s:%s" % (local_ipv4, cache_port) -%}
{% set ssl_cache_access = "http://%s:%s/HTTPS" % (local_ipv4, cache_port) -%} {% set ssl_cache_access = "http://%s:%s/HTTPS" % (local_ipv4, cache_port) -%}
{% set TRUE_VALUES = ['y', 'yes', '1', 'true'] -%} {% set TRUE_VALUES = ['y', 'yes', '1', 'true'] -%}
...@@ -27,7 +30,7 @@ context = ...@@ -27,7 +30,7 @@ context =
{{ key }} = {{ value }} {{ key }} = {{ value }}
{% endfor %} {% endfor %}
post = {{ apache_configuration.get('frontend-graceful-command') }} post = {{ frontend_lazy_graceful_reload }} &
frequency = daily frequency = daily
rotatep-num = 30 rotatep-num = 30
sharedscripts = true sharedscripts = true
......
#!/bin/sh
RUN_DIR={{ directory_run }}
ETC_DIR={{ directory_etc }}
APACHE_SIGNATURE_FILE=$RUN_DIR/apache_configuration.signature
NAPACHE_SIGNATURE_FILE=$RUN_DIR/napache_configuration.signature
touch $APACHE_SIGNATURE_FILE
sha256sum $ETC_DIR/apache*.conf $ETC_DIR/apache-*.d/*.conf | sort -k 66 > $NAPACHE_SIGNATURE_FILE
# If no diff, no restart for now
if diff "$APACHE_SIGNATURE_FILE" "$NAPACHE_SIGNATURE_FILE"; then
echo "Nothing Changed, so nothing to reload"
exit 0
fi
echo "Reloading apache.."
{{ apache_graceful_reload_command }}
mv "$NAPACHE_SIGNATURE_FILE" "$APACHE_SIGNATURE_FILE"
#!/bin/bash #!/bin/bash
PID=$$ PID=$$
PIDFILE=~/my.pid PIDFILE={{ pid_file }}
if [ ! -f $PIDFILE ]; then if [ ! -f $PIDFILE ]; then
echo $PID >> $PIDFILE echo $PID > $PIDFILE
sleep {{ wait_time }}
{{ lazy_command }}
else else
ps --pid `cat $PIDFILE` &>/dev/null ps --pid `cat $PIDFILE` &>/dev/null
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
echo "Skipped" echo "Skipped"
else else
echo $PID >> $PIDFILE echo $PID > $PIDFILE
sleep {{ wait_time }} sleep {{ wait_time }}
{{ lazy_command }} {{ lazy_command }}
fi fi
......
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