From e6d97b351fc91324b52b0633227003040b419da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Nowak?= <luke@nexedi.com> Date: Fri, 29 May 2020 16:36:00 +0200 Subject: [PATCH] caddy-frontend: Improve buildout.hash.cfg --- software/caddy-frontend/buildout.hash.cfg | 38 +++++++++---------- software/caddy-frontend/common.cfg | 34 +++-------------- .../instance-apache-frontend.cfg.in | 17 ++++----- 3 files changed, 32 insertions(+), 57 deletions(-) diff --git a/software/caddy-frontend/buildout.hash.cfg b/software/caddy-frontend/buildout.hash.cfg index 8c883a96d..0d6bc100e 100644 --- a/software/caddy-frontend/buildout.hash.cfg +++ b/software/caddy-frontend/buildout.hash.cfg @@ -22,22 +22,22 @@ md5sum = c801b7f9f11f0965677c22e6bbe9281b [template-apache-frontend] filename = instance-apache-frontend.cfg.in -md5sum = cbdf668a230bf6e95b52cb94111f94e0 +md5sum = 9409c580ce469dd31e8b7b05a1e59ae7 [template-caddy-replicate] filename = instance-apache-replicate.cfg.in md5sum = a544bf7586f5945bbf108abe9818c7dd [template-slave-list] -filename = templates/apache-custom-slave-list.cfg.in +_update_hash_filename_ = templates/apache-custom-slave-list.cfg.in md5sum = 83992a72b440e422e6d6dae54990f3b1 [template-replicate-publish-slave-information] -filename = templates/replicate-publish-slave-information.cfg.in +_update_hash_filename_ = templates/replicate-publish-slave-information.cfg.in md5sum = 7e3ee70c447f8203273d78f66ab519c3 [template-caddy-frontend-configuration] -filename = templates/Caddyfile.in +_update_hash_filename_ = templates/Caddyfile.in md5sum = f0faf6d2e6c187df7e25bf717676f9df [caddy-backend-url-validator] @@ -45,63 +45,63 @@ filename = templates/caddy-backend-url-validator.in md5sum = 0979a03476e86bf038516c9565dadc17 [template-not-found-html] -filename = templates/notfound.html +_update_hash_filename_ = templates/notfound.html md5sum = f20d6c3d2d94fb685f8d26dfca1e822b [template-default-slave-virtualhost] -filename = templates/default-virtualhost.conf.in +_update_hash_filename_ = templates/default-virtualhost.conf.in md5sum = 7e26935bb6daf00d8fc01d97eebc7abd [template-cached-slave-virtualhost] -filename = templates/cached-virtualhost.conf.in +_update_hash_filename_ = templates/cached-virtualhost.conf.in md5sum = a73839d777fbd548286bbeccf47be335 [template-log-access] -filename = templates/template-log-access.conf.in +_update_hash_filename_ = templates/template-log-access.conf.in md5sum = f8068179333ce19e95df561c70073857 [template-empty] -filename = templates/empty.in +_update_hash_filename_ = templates/empty.in md5sum = c2314c3a9c3412a38d14b312d3df83c1 [template-wrapper] -filename = templates/wrapper.in +_update_hash_filename_ = templates/wrapper.in md5sum = 8cde04bfd0c0e9bd56744b988275cfd8 [template-trafficserver-records-config] -filename = templates/trafficserver/records.config.jinja2 +_update_hash_filename_ = templates/trafficserver/records.config.jinja2 md5sum = 3a4e378932ffc7768426bb7a897e2c45 [template-trafficserver-storage-config] -filename = templates/trafficserver/storage.config.jinja2 +_update_hash_filename_ = templates/trafficserver/storage.config.jinja2 md5sum = baf7b89cc9ab5506100b0c900808c1ea [template-trafficserver-logging-config] -filename = templates/trafficserver/logging.config.jinja2 +_update_hash_filename_ = templates/trafficserver/logging.config.jinja2 md5sum = 6aed31174dc262ced02f31624321df41 [template-nginx-eventsource-slave-virtualhost] -filename = templates/nginx-eventsource-slave.conf.in +_update_hash_filename_ = templates/nginx-eventsource-slave.conf.in md5sum = 217a6c801b8330b0b825f7b8b4c77184 [template-caddy-lazy-script-call] -filename = templates/apache-lazy-script-call.sh.in +_update_hash_filename_ = templates/apache-lazy-script-call.sh.in md5sum = b9f73f6323f9fceea054c46c854d2862 [template-graceful-script] -filename = templates/graceful-script.sh.in +_update_hash_filename_ = templates/graceful-script.sh.in md5sum = 061cc244558fd3af2b6bacf17cae5555 [template-validate-script] -filename = templates/validate-script.sh.in +_update_hash_filename_ = templates/validate-script.sh.in md5sum = f26e11574f266c7437c9c89e3c93825a [template-configuration-state-script] -filename = templates/configuration-state-script.sh.in +_update_hash_filename_ = templates/configuration-state-script.sh.in md5sum = 4d2537d2698d32a7e909989f8778d144 [template-rotate-script] -filename = templates/rotate-script.sh.in +_update_hash_filename_ = templates/rotate-script.sh.in md5sum = 8c150e1e6c993708d31936742f3a7302 [caddyprofiledeps-setup] diff --git a/software/caddy-frontend/common.cfg b/software/caddy-frontend/common.cfg index 0149fa0c1..60410fe3f 100644 --- a/software/caddy-frontend/common.cfg +++ b/software/caddy-frontend/common.cfg @@ -120,13 +120,9 @@ template_empty = ${template-empty:target} template_log_access = ${template-log-access:target} template_not_found_html = ${template-not-found-html:target} template_slave_list = ${template-slave-list:target} -template_trafficserver_records_config = ${template-trafficserver-records-config:location} -template_trafficserver_records_config_filename = ${template-trafficserver-records-config:filename} -template_trafficserver_records_config_location = ${template-trafficserver-records-config:location} -template_trafficserver_storage_config_filename = ${template-trafficserver-storage-config:filename} -template_trafficserver_storage_config_location = ${template-trafficserver-storage-config:location} -template_trafficserver_logging_config_filename = ${template-trafficserver-logging-config:filename} -template_trafficserver_logging_config_location = ${template-trafficserver-logging-config:location} +template_trafficserver_records_config = ${template-trafficserver-records-config:target} +template_trafficserver_storage_config = ${template-trafficserver-storage-config:target} +template_trafficserver_logging_config = ${template-trafficserver-logging-config:target} template_wrapper = ${template-wrapper:output} [template] @@ -154,8 +150,7 @@ mode = 0644 [caddy-backend-url-validator] recipe = slapos.recipe.template -url = ${:_profile_base_location_}/templates/${:filename} -filename = caddy-backend-url-validator.in +url = ${:_profile_base_location_}/${:filename} output = ${buildout:directory}/caddy-backend-url-validator mode = 0750 @@ -171,40 +166,32 @@ mode = 0644 [download-template] recipe = slapos.recipe.build:download -url = ${:_profile_base_location_}/templates/${:filename} +url = ${:_profile_base_location_}/${:_update_hash_filename_} mode = 640 [template-slave-list] <=download-template -filename = apache-custom-slave-list.cfg.in [template-replicate-publish-slave-information] <=download-template -filename = replicate-publish-slave-information.cfg.in [template-caddy-frontend-configuration] <=download-template -filename = Caddyfile.in [template-not-found-html] <=download-template -filename = notfound.html [template-default-slave-virtualhost] <=download-template -filename = default-virtualhost.conf.in [template-cached-slave-virtualhost] <=download-template -filename = cached-virtualhost.conf.in [template-log-access] <=download-template -filename = template-log-access.conf.in [template-empty] <=download-template -filename = empty.in [template-wrapper] recipe = slapos.recipe.template @@ -214,35 +201,24 @@ mode = 0644 [template-trafficserver-records-config] <=download-template -url = ${:_profile_base_location_}/templates/trafficserver/${:filename} -filename = records.config.jinja2 [template-trafficserver-storage-config] <=download-template -url = ${:_profile_base_location_}/templates/trafficserver/${:filename} -filename = storage.config.jinja2 [template-trafficserver-logging-config] <=download-template -url = ${:_profile_base_location_}/templates/trafficserver/${:filename} -filename = logging.config.jinja2 [template-rotate-script] <=download-template -filename = rotate-script.sh.in [template-caddy-lazy-script-call] <=download-template -filename = apache-lazy-script-call.sh.in [template-graceful-script] <=download-template -filename = graceful-script.sh.in [template-validate-script] <=download-template -filename = validate-script.sh.in [template-configuration-state-script] <=download-template -filename = configuration-state-script.sh.in diff --git a/software/caddy-frontend/instance-apache-frontend.cfg.in b/software/caddy-frontend/instance-apache-frontend.cfg.in index b1a2dbc0a..8fc838796 100644 --- a/software/caddy-frontend/instance-apache-frontend.cfg.in +++ b/software/caddy-frontend/instance-apache-frontend.cfg.in @@ -15,7 +15,6 @@ parts = caucase-updater caucase-updater-promise frontend-caddy-graceful - not-found-html port-redirection promise-frontend-caddy-configuration promise-caddy-frontend-v4-https @@ -338,10 +337,10 @@ hash-existing-files = ${buildout:directory}/software_release/buildout.cfg hash-files = ${caddy-wrapper:rendered} [not-found-html] -recipe = slapos.cookbook:symbolic.link -target-directory = ${caddy-directory:document-root} -link-binary = - {{ parameter_dict['template_not_found_html'] }} +recipe = plone.recipe.command +update-command = ${:command} +filename = notfound.html +command = ln -sf {{ parameter_dict['template_not_found_html'] }} ${caddy-directory:document-root}/${:filename} [caddy-directory] recipe = slapos.cookbook:mkdirectory @@ -362,7 +361,7 @@ access-log = ${directory:log}/frontend-access.log error-log = ${directory:log}/frontend-error.log pid-file = ${directory:run}/httpd.pid frontend-graceful-command = ${frontend-caddy-validate:rendered} && kill -USR1 $(cat ${:pid-file}) -not-found-file = ${caddy-directory:document-root}/notfound.html +not-found-file = ${caddy-directory:document-root}/${not-found-html:filename} master-certificate = ${caddy-directory:master-autocert-dir}/master.pem # Communication with ATS cache-port = ${trafficserver-variable:input-port} @@ -463,19 +462,19 @@ context = [trafficserver-records-config] < = trafficserver-jinja2-template-base -template = {{ parameter_dict['template_trafficserver_records_config_location'] }}/{{ parameter_dict['template_trafficserver_records_config_filename'] }} +template = {{ parameter_dict['template_trafficserver_records_config'] }} filename = records.config extra-context = import os_module os [trafficserver-storage-config] < = trafficserver-jinja2-template-base -template = {{ parameter_dict['template_trafficserver_storage_config_location'] }}/{{ parameter_dict['template_trafficserver_storage_config_filename'] }} +template = {{ parameter_dict['template_trafficserver_storage_config'] }} filename = storage.config [trafficserver-logging-config] < = trafficserver-jinja2-template-base -template = {{ parameter_dict['template_trafficserver_logging_config_location'] }}/{{ parameter_dict['template_trafficserver_logging_config_filename'] }} +template = {{ parameter_dict['template_trafficserver_logging_config'] }} filename = logging.config [trafficserver-remap-config] -- 2.30.9