Commit 37afcb43 authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Łukasz Nowak

caddy-frontend: Make nginx like caddy

parent fc9dd002
...@@ -22,7 +22,7 @@ md5sum = c801b7f9f11f0965677c22e6bbe9281b ...@@ -22,7 +22,7 @@ md5sum = c801b7f9f11f0965677c22e6bbe9281b
[template-apache-frontend] [template-apache-frontend]
filename = instance-apache-frontend.cfg.in filename = instance-apache-frontend.cfg.in
md5sum = 822e78eea24952ed1f748118a499f1d9 md5sum = 97cecc896403991753cfd75e2962250c
[template-apache-replicate] [template-apache-replicate]
filename = instance-apache-replicate.cfg.in filename = instance-apache-replicate.cfg.in
...@@ -108,6 +108,10 @@ md5sum = ebe5d3d19923eb812a40019cb11276d8 ...@@ -108,6 +108,10 @@ md5sum = ebe5d3d19923eb812a40019cb11276d8
filename = templates/caddy-graceful-script.sh.in filename = templates/caddy-graceful-script.sh.in
md5sum = 455f8765a3afd39fb78562fb9e326c42 md5sum = 455f8765a3afd39fb78562fb9e326c42
[template-nginx-graceful-script]
filename = templates/nginx-graceful-script.sh.in
md5sum = 43e8ca96f2e64d21c8fb1e96282c1469
[caddyprofiledeps-setup] [caddyprofiledeps-setup]
filename = setup.py filename = setup.py
md5sum = d9b6476bb0b36cf463fddb00d41dfbaa md5sum = d9b6476bb0b36cf463fddb00d41dfbaa
......
...@@ -93,6 +93,7 @@ monitor_template = ${monitor-template:output} ...@@ -93,6 +93,7 @@ monitor_template = ${monitor-template:output}
template_cached_slave_virtualhost = ${template-cached-slave-virtualhost:target} template_cached_slave_virtualhost = ${template-cached-slave-virtualhost:target}
template_caddy_frontend_configuration = ${template-caddy-frontend-configuration:target} template_caddy_frontend_configuration = ${template-caddy-frontend-configuration:target}
template_caddy_graceful_script = ${template-caddy-graceful-script:target} template_caddy_graceful_script = ${template-caddy-graceful-script:target}
template_nginx_graceful_script = ${template-nginx-graceful-script:target}
template_caddy_lazy_script_call = ${template-caddy-lazy-script-call:target} template_caddy_lazy_script_call = ${template-caddy-lazy-script-call:target}
template_default_slave_virtualhost = ${template-default-slave-virtualhost:target} template_default_slave_virtualhost = ${template-default-slave-virtualhost:target}
template_empty = ${template-empty:target} template_empty = ${template-empty:target}
...@@ -227,6 +228,10 @@ filename = apache-lazy-script-call.sh.in ...@@ -227,6 +228,10 @@ filename = apache-lazy-script-call.sh.in
<=download-template <=download-template
filename = caddy-graceful-script.sh.in filename = caddy-graceful-script.sh.in
[template-nginx-graceful-script]
<=download-template
filename = nginx-graceful-script.sh.in
[template-nginx-eventsource-slave-virtualhost] [template-nginx-eventsource-slave-virtualhost]
<=download-template <=download-template
filename = nginx-eventsource-slave.conf.in filename = nginx-eventsource-slave.conf.in
......
...@@ -525,6 +525,17 @@ extra-context = ...@@ -525,6 +525,17 @@ extra-context =
key directory_bin directory:bin key directory_bin directory:bin
key caddy_graceful_reload_command caddy-configuration:frontend-graceful-command key caddy_graceful_reload_command caddy-configuration:frontend-graceful-command
[frontend-nginx-graceful]
< = jinja2-template-base
template = {{ parameter_dict['template_nginx_graceful_script'] }}
rendered = ${directory:etc-run}/frontend-nginx-safe-graceful
mode = 0700
extra-context =
key directory_run directory:run
key directory_etc directory:etc
key directory_bin directory:bin
key nginx_graceful_reload_command nginx-configuration:nginx-graceful-command
[frontend-caddy-lazy-graceful] [frontend-caddy-lazy-graceful]
< = jinja2-template-base < = jinja2-template-base
template = {{ parameter_dict['template_caddy_lazy_script_call'] }} template = {{ parameter_dict['template_caddy_lazy_script_call'] }}
...@@ -702,14 +713,6 @@ nginx-configuration-verification = ${nginx-wrapper:wrapper-path} -validate ...@@ -702,14 +713,6 @@ nginx-configuration-verification = ${nginx-wrapper:wrapper-path} -validate
ssl_certificate = ${ca-frontend:cert-file} ssl_certificate = ${ca-frontend:cert-file}
ssl_key = ${ca-frontend:key-file} ssl_key = ${ca-frontend:key-file}
[frontend-nginx-graceful]
< = jinja2-template-base
template = {{ parameter_dict['template_wrapper'] }}
rendered = ${directory:etc-run}/frontend-nginx-safe-graceful
mode = 0700
extra-context =
key content nginx-configuration:nginx-graceful-command
[promise-nginx-configuration] [promise-nginx-configuration]
< = jinja2-template-base < = jinja2-template-base
template = {{ parameter_dict['template_wrapper'] }} template = {{ parameter_dict['template_wrapper'] }}
......
#!/bin/sh
RUN_DIR={{ directory_run }}
ETC_DIR={{ directory_etc }}
BIN_DIR={{ directory_bin }}
NGINX_SIGNATURE_FILE=$RUN_DIR/nginx_configuration.signature
NNGINX_SIGNATURE_FILE=$RUN_DIR/nnginx_configuration.signature
touch $NGINX_SIGNATURE_FILE
sha256sum $ETC_DIR/nginx.cfg $ETC_DIR/nginx-slave-conf.d/*.conf | sort -k 66 > $NNGINX_SIGNATURE_FILE
# If no diff, no restart for now
if diff "$NGINX_SIGNATURE_FILE" "$NNGINX_SIGNATURE_FILE"; then
echo "Nothing Changed, so nothing to reload"
exit 0
fi
echo "Reloading nginx.."
{{ nginx_graceful_reload_command }}
mv "$NNGINX_SIGNATURE_FILE" "$NGINX_SIGNATURE_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