Commit 54db6015 authored by Łukasz Nowak's avatar Łukasz Nowak Committed by Matevz Golob

caddy-frontend: Just read last validation state

Instead of expensive and long checking of the configuration during promise run
read last stored state.

This decouples configuration validation calculation from promise check. The
validation information is updated often (on each configuration change, on each
reload, etc) and every 2 hours.
parent 87c805d6
...@@ -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 = ade2eb66b2123d7f8ff5df5a37720dbe md5sum = d2dda14597c061960f0b9d38ec0d8313
[template-apache-replicate] [template-apache-replicate]
filename = instance-apache-replicate.cfg.in filename = instance-apache-replicate.cfg.in
......
...@@ -618,11 +618,22 @@ extra-context = ...@@ -618,11 +618,22 @@ extra-context =
key lazy_command caddy-configuration:frontend-graceful-command key lazy_command caddy-configuration:frontend-graceful-command
# Promises checking configuration: # Promises checking configuration:
[promise-helper-last-configuration-state]
< = jinja2-template-base
template = {{ parameter_dict['template_empty'] }}
rendered = ${directory:bin}/frontend-read-last-configuration-state
mode = 0700
content =
#!/bin/sh
exit `cat ${frontend-caddy-validate:last_state_file}`
context =
key content :content
[promise-frontend-caddy-configuration] [promise-frontend-caddy-configuration]
<= promise-plugin-base <= promise-plugin-base
module = validate_frontend_configuration module = validate_frontend_configuration
name = frontend-caddy-configuration-promise.py name = frontend-caddy-configuration-promise.py
config-verification-script = ${caddy-configuration:frontend-configuration-verification} config-verification-script = ${promise-helper-last-configuration-state:rendered}
[promise-caddy-frontend-v4-https] [promise-caddy-frontend-v4-https]
<= promise-plugin-base <= promise-plugin-base
......
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