Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Leo Le Bouter
slapos
Commits
5bac3501
Commit
5bac3501
authored
Feb 05, 2019
by
Alain Takoudjou
Committed by
Łukasz Nowak
Feb 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caddy-fronted: migrate promises to new format
parent
d91a00ec
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
89 deletions
+126
-89
software/caddy-frontend/buildout.hash.cfg
software/caddy-frontend/buildout.hash.cfg
+2
-2
software/caddy-frontend/instance-apache-frontend.cfg.in
software/caddy-frontend/instance-apache-frontend.cfg.in
+82
-67
software/caddy-frontend/templates/apache-custom-slave-list.cfg.in
.../caddy-frontend/templates/apache-custom-slave-list.cfg.in
+42
-20
No files found.
software/caddy-frontend/buildout.hash.cfg
View file @
5bac3501
...
@@ -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 =
da7b5804d50c727412885e8b818ca433
md5sum =
6fd023f0d29421d8579f0b3351473bb0
[template-apache-replicate]
[template-apache-replicate]
filename = instance-apache-replicate.cfg.in
filename = instance-apache-replicate.cfg.in
...
@@ -30,7 +30,7 @@ md5sum = 86f15c85054800a55a7093d37b03cdce
...
@@ -30,7 +30,7 @@ md5sum = 86f15c85054800a55a7093d37b03cdce
[template-slave-list]
[template-slave-list]
filename = templates/apache-custom-slave-list.cfg.in
filename = templates/apache-custom-slave-list.cfg.in
md5sum =
5b91c0079b42780054da004f8fc6f26b
md5sum =
439a4e415bef9d44b37bee4d5e4aa924
[template-slave-configuration]
[template-slave-configuration]
filename = templates/custom-virtualhost.conf.in
filename = templates/custom-virtualhost.conf.in
...
...
software/caddy-frontend/instance-apache-frontend.cfg.in
View file @
5bac3501
...
@@ -75,6 +75,7 @@ run = ${:var}/run
...
@@ -75,6 +75,7 @@ run = ${:var}/run
service = ${:etc}/service
service = ${:etc}/service
etc-run = ${:etc}/run
etc-run = ${:etc}/run
promise = ${:etc}/promise
promise = ${:etc}/promise
plugin = ${:etc}/plugin
logrotate-backup = ${:backup}/logrotate
logrotate-backup = ${:backup}/logrotate
logrotate-entries = ${:etc}/logrotate.d
logrotate-entries = ${:etc}/logrotate.d
...
@@ -194,6 +195,7 @@ extra-context =
...
@@ -194,6 +195,7 @@ extra-context =
section caddy_configuration caddy-configuration
section caddy_configuration caddy-configuration
section nginx_configuration nginx-configuration
section nginx_configuration nginx-configuration
key monitor_base_url monitor-instance-parameter:monitor-base-url
key monitor_base_url monitor-instance-parameter:monitor-base-url
key plugin_directory directory:plugin
key promise_directory directory:promises
key promise_directory directory:promises
key report_directory directory:bin
key report_directory directory:bin
key bin_directory :bin_directory
key bin_directory :bin_directory
...
@@ -510,11 +512,21 @@ filename = plugin.config
...
@@ -510,11 +512,21 @@ filename = plugin.config
context =
context =
key content trafficserver-variable:plugin-config
key content trafficserver-variable:plugin-config
[promise-plugin-base]
recipe = slapos.cookbook:promise.plugin
eggs =
slapos.toolbox
content =
from slapos.promise.plugin.${:module} import RunPromise
output = ${directory:plugin}/${:name}
[trafficserver-promise-listen-port]
[trafficserver-promise-listen-port]
recipe = slapos.cookbook:check_port_listening
<= promise-plugin-base
path = ${directory:promise}/trafficserver-port-listening
module = check_port_listening
hostname = ${trafficserver-variable:local-ip}
name = trafficserver-port-listening.py
port = ${trafficserver-variable:input-port}
config-hostname = ${trafficserver-variable:local-ip}
config-port = ${trafficserver-variable:input-port}
[trafficserver-line]
[trafficserver-line]
recipe = slapos.cookbook:wrapper
recipe = slapos.cookbook:wrapper
...
@@ -523,18 +535,10 @@ wrapper-path = ${directory:bin}/traffic_line
...
@@ -523,18 +535,10 @@ wrapper-path = ${directory:bin}/traffic_line
environment = TS_ROOT=${buildout:directory}
environment = TS_ROOT=${buildout:directory}
[trafficserver-promise-cache-availability]
[trafficserver-promise-cache-availability]
recipe = collective.recipe.template
<= promise-plugin-base
input =
module = trafficserver_cache_availability
inline:#!${buildout:executable}
name = trafficserver-cache-availability.py
import subprocess
config-wrapper-path = ${trafficserver-line:wrapper-path}
import sys
traffic_line = "${trafficserver-line:wrapper-path}"
result = float(subprocess.check_output([traffic_line, '-r', 'proxy.node.cache.percent_free' ]))
if result != 0: sys.exit(0)
sys.stderr.write("Cache not available, availability: %s" % result)
sys.exit(127)
output = ${directory:promise}/trafficserver-cache-availability
mode = 700
### End of ATS sections
### End of ATS sections
...
@@ -607,45 +611,52 @@ extra-context =
...
@@ -607,45 +611,52 @@ extra-context =
# Promises checking configuration:
# Promises checking configuration:
[promise-frontend-caddy-configuration]
[promise-frontend-caddy-configuration]
recipe = slapos.cookbook:wrapper
<= promise-plugin-base
command-line = ${caddy-configuration:frontend-configuration-verification}
module = validate_frontend_configuration
wrapper-path = ${directory:promise}/frontend-caddy-configuration-promise
name = frontend-caddy-configuration-promise.py
config-verification-script = ${caddy-configuration:frontend-configuration-verification}
[promise-caddy-frontend-v4-https]
[promise-caddy-frontend-v4-https]
recipe = slapos.cookbook:check_port_listening
<= promise-plugin-base
path = ${directory:promise}/caddy_frontend_ipv4_https
module = check_port_listening
hostname = {{ instance_parameter['ipv4-random'] }}
name = caddy_frontend_ipv4_https.py
port = ${configuration:port}
config-hostname = {{ instance_parameter['ipv4-random'] }}
config-port = ${configuration:port}
[promise-caddy-frontend-v4-http]
[promise-caddy-frontend-v4-http]
recipe = slapos.cookbook:check_port_listening
<= promise-plugin-base
path = ${directory:promise}/caddy_frontend_ipv4_http
module = check_port_listening
hostname = {{ instance_parameter['ipv4-random'] }}
name = caddy_frontend_ipv4_http.py
port = ${configuration:plain_http_port}
config-hostname = {{ instance_parameter['ipv4-random'] }}
config-port = ${configuration:plain_http_port}
[promise-caddy-frontend-v6-https]
[promise-caddy-frontend-v6-https]
recipe = slapos.cookbook:check_port_listening
<= promise-plugin-base
path = ${directory:promise}/caddy_frontend_ipv6_https
module = check_port_listening
hostname = {{ instance_parameter['ipv6-random'] }}
name = caddy_frontend_ipv6_https.py
port = ${configuration:port}
config-hostname = {{ instance_parameter['ipv6-random'] }}
config-port = ${configuration:port}
[promise-caddy-frontend-v6-http]
[promise-caddy-frontend-v6-http]
recipe = slapos.cookbook:check_port_listening
<= promise-plugin-base
path = ${directory:promise}/caddy_frontend_ipv6_http
module = check_port_listening
hostname = {{ instance_parameter['ipv6-random'] }}
name = caddy_frontend_ipv6_http.py
port = ${configuration:plain_http_port}
config-hostname = {{ instance_parameter['ipv6-random'] }}
config-port = ${configuration:plain_http_port}
[promise-caddy-frontend-cached]
[promise-caddy-frontend-cached]
recipe = slapos.cookbook:check_port_listening
<= promise-plugin-base
path = ${directory:promise}/caddy_cached
module = check_port_listening
hostname = {{ instance_parameter['ipv4-random'] }}
name = caddy_cached.py
port = ${caddy-configuration:cache-through-port}
config-hostname = {{ instance_parameter['ipv4-random'] }}
config-port = ${caddy-configuration:cache-through-port}
[promise-caddy-frontend-ssl-cached]
[promise-caddy-frontend-ssl-cached]
recipe = slapos.cookbook:check_port_listening
<= promise-plugin-base
path = ${directory:promise}/caddy_ssl_cached
module = check_port_listening
hostname = {{ instance_parameter['ipv4-random'] }}
name = caddy_ssl_cached.py
port = ${caddy-configuration:ssl-cache-through-port}
config-hostname = {{ instance_parameter['ipv4-random'] }}
config-port = ${caddy-configuration:ssl-cache-through-port}
[promise-caddy-is-process-older-than-dependency-set]
[promise-caddy-is-process-older-than-dependency-set]
recipe = slapos.cookbook:wrapper
recipe = slapos.cookbook:wrapper
...
@@ -707,11 +718,10 @@ context =
...
@@ -707,11 +718,10 @@ context =
raw content show:cache-stats
raw content show:cache-stats
[monitor-verify-re6st-connectivity]
[monitor-verify-re6st-connectivity]
recipe = slapos.cookbook:check_url_available
<= promise-plugin-base
path = ${directory:promise}/re6st-connectivity
module = check_url_available
url = ${configuration:re6st-verification-url}
name = re6st-connectivity.py
dash_path = {{ parameter_dict['dash'] }}/bin/dash
config-url = ${configuration:re6st-verification-url}
curl_path = {{ parameter_dict['curl'] }}/bin/curl
#######################
#######################
# Nginx
# Nginx
...
@@ -772,33 +782,38 @@ ssl_certificate = ${ca-frontend:cert-file}
...
@@ -772,33 +782,38 @@ ssl_certificate = ${ca-frontend:cert-file}
ssl_key = ${ca-frontend:key-file}
ssl_key = ${ca-frontend:key-file}
[promise-nginx-configuration]
[promise-nginx-configuration]
recipe = slapos.cookbook:wrapper
<= promise-plugin-base
command-line = ${nginx-configuration:nginx-configuration-verification}
module = validate_frontend_configuration
wrapper-path = ${directory:promise}/nginx-configuration-promise
name = nginx-configuration-promise.py
config-verification-script = ${nginx-configuration:nginx-configuration-verification}
[promise-nginx-frontend-v4-https]
[promise-nginx-frontend-v4-https]
recipe = slapos.cookbook:check_port_listening
<= promise-plugin-base
path = ${directory:promise}/nginx_frontend_ipv4_https
module = check_port_listening
hostname = {{ instance_parameter['ipv4-random'] }}
name = nginx_frontend_ipv4_https.py
port = ${configuration:nginx_port}
config-hostname = {{ instance_parameter['ipv4-random'] }}
config-port = ${configuration:nginx_port}
[promise-nginx-frontend-v4-http]
[promise-nginx-frontend-v4-http]
recipe = slapos.cookbook:check_port_listening
<= promise-plugin-base
path = ${directory:promise}/nginx_frontend_ipv4_http
module = check_port_listening
hostname = {{ instance_parameter['ipv4-random'] }}
name = nginx_frontend_ipv4_http.py
port = ${configuration:plain_nginx_port}
config-hostname = {{ instance_parameter['ipv4-random'] }}
config-port = ${configuration:plain_nginx_port}
[promise-nginx-frontend-v6-https]
[promise-nginx-frontend-v6-https]
recipe = slapos.cookbook:check_port_listening
<= promise-plugin-base
path = ${directory:promise}/nginx_frontend_ipv6_https
module = check_port_listening
hostname = {{ instance_parameter['ipv6-random'] }}
name = nginx_frontend_ipv6_https.py
port = ${configuration:nginx_port}
config-hostname = {{ instance_parameter['ipv6-random'] }}
config-port = ${configuration:nginx_port}
[promise-nginx-frontend-v6-http]
[promise-nginx-frontend-v6-http]
recipe = slapos.cookbook:check_port_listening
<= promise-plugin-base
path = ${directory:promise}/nginx_frontend_ipv6_http
module = check_port_listening
hostname = {{ instance_parameter['ipv6-random'] }}
name = nginx_frontend_ipv6_http.py
port = ${configuration:plain_nginx_port}
config-hostname = {{ instance_parameter['ipv6-random'] }}
config-port = ${configuration:plain_nginx_port}
[promise-nginx-is-process-older-than-dependency-set]
[promise-nginx-is-process-older-than-dependency-set]
recipe = slapos.cookbook:wrapper
recipe = slapos.cookbook:wrapper
...
...
software/caddy-frontend/templates/apache-custom-slave-list.cfg.in
View file @
5bac3501
...
@@ -44,6 +44,14 @@ certs = {{ custom_ssl_directory }}/certs/
...
@@ -44,6 +44,14 @@ certs = {{ custom_ssl_directory }}/certs/
newcerts = {{ custom_ssl_directory }}/newcerts/
newcerts = {{ custom_ssl_directory }}/newcerts/
crl = {{ custom_ssl_directory }}/crl/
crl = {{ custom_ssl_directory }}/crl/
[promise-plugin-base]
recipe = slapos.cookbook:promise.plugin
eggs =
slapos.toolbox
content =
from slapos.promise.plugin.${:module} import RunPromise
output = {{ plugin_directory }}/${:name}
{# Loop thought slave list to set up slaves #}
{# Loop thought slave list to set up slaves #}
{% for slave_instance in slave_instance_list %}
{% for slave_instance in slave_instance_list %}
{% set slave_reference = slave_instance.get('slave_reference') %}
{% set slave_reference = slave_instance.get('slave_reference') %}
...
@@ -276,28 +284,36 @@ extra-context =
...
@@ -276,28 +284,36 @@ extra-context =
{% set check_error_log_section_title = 'check-%s-error-log-last-hour' % slave_instance.get('slave_reference') %}
{% set check_error_log_section_title = 'check-%s-error-log-last-hour' % slave_instance.get('slave_reference') %}
{% do part_list.append(check_error_log_section_title) %}
{% do part_list.append(check_error_log_section_title) %}
[{{ check_error_log_section_title }}]
[{{ check_error_log_section_title }}]
recipe = slapos.cookbook:wrapper
<= promise-plugin-base
command-line = {{ bin_directory }}/check-error-on-apache-log -l {{ slave_instance.get('error_log') }} -d 3600
module = check_error_on_http_log
filename = {{ check_error_log_section_title }}
name = {{ check_error_log_section_title }}.py
wrapper-path = {{ promise_directory }}/${:filename}
config-log-file = {{ slave_instance.get('error_log') }}
config-maximum-delay = 3600
# promise frequency in minutes (2 times/day)
config-frequency = 720
{% set check_error_log_section_title = 'check-%s-error-log-last-day' % slave_instance.get('slave_reference') %}
{% set check_error_log_section_title = 'check-%s-error-log-last-day' % slave_instance.get('slave_reference') %}
{% do part_list.append(check_error_log_section_title) %}
{% do part_list.append(check_error_log_section_title) %}
[{{ check_error_log_section_title }}]
[{{ check_error_log_section_title }}]
recipe = slapos.cookbook:wrapper
<= promise-plugin-base
command-line = {{ bin_directory }}/check-error-on-apache-log -l {{ slave_instance.get('error_log') }} -d 86400
module = check_error_on_http_log
filename = {{ check_error_log_section_title }}
name = {{ check_error_log_section_title }}.py
wrapper-path = {{ promise_directory }}/${:filename}
config-log-file = {{ slave_instance.get('error_log') }}
config-maximum-delay = 86400
# promise frequency in minutes (2 times/day)
config-frequency = 720
{% set monitor_ipv6_test = slave_instance.get('monitor-ipv6-test', '') %}
{% set monitor_ipv6_test = slave_instance.get('monitor-ipv6-test', '') %}
{% if monitor_ipv6_test %}
{% if monitor_ipv6_test %}
{% set monitor_ipv6_section_title = 'check-%s-ipv6-packet-list-test' % slave_instance.get('slave_reference') %}
{% set monitor_ipv6_section_title = 'check-%s-ipv6-packet-list-test' % slave_instance.get('slave_reference') %}
{% do part_list.append(monitor_ipv6_section_title) %}
{% do part_list.append(monitor_ipv6_section_title) %}
[{{ monitor_ipv6_section_title }}]
[{{ monitor_ipv6_section_title }}]
recipe = slapos.cookbook:wrapper
<= promise-plugin-base
command-line = {{ dumps(bin_directory ~ '/is-icmp-packet-lost -a ' ~ monitor_ipv6_test) }}
module = check_icmp_packet_lost
filename = {{ monitor_ipv6_section_title }}
name = {{ monitor_ipv6_section_title }}.py
wrapper-path = {{ promise_directory }}/${:filename}
config-address = {{ dumps(monitor_ipv6_test) }}
# promise frequency in minutes (2 times/day)
config-frequency = 720
{% endif %}
{% endif %}
{% set monitor_ipv4_test = slave_instance.get('monitor-ipv4-test', '') %}
{% set monitor_ipv4_test = slave_instance.get('monitor-ipv4-test', '') %}
...
@@ -305,10 +321,13 @@ wrapper-path = {{ promise_directory }}/${:filename}
...
@@ -305,10 +321,13 @@ wrapper-path = {{ promise_directory }}/${:filename}
{% set monitor_ipv4_section_title = 'check-%s-ipv4-packet-list-test' % slave_instance.get('slave_reference') %}
{% set monitor_ipv4_section_title = 'check-%s-ipv4-packet-list-test' % slave_instance.get('slave_reference') %}
{% do part_list.append(monitor_ipv4_section_title) %}
{% do part_list.append(monitor_ipv4_section_title) %}
[{{ monitor_ipv4_section_title }}]
[{{ monitor_ipv4_section_title }}]
recipe = slapos.cookbook:wrapper
<= promise-plugin-base
command-line = {{ dumps(bin_directory ~ '/is-icmp-packet-lost -4 -a ' ~ monitor_ipv4_test) }}
module = check_icmp_packet_lost
filename = {{ monitor_ipv4_section_title }}
name = {{ monitor_ipv4_section_title }}.py
wrapper-path = {{ promise_directory }}/${:filename}
config-address = {{ dumps(monitor_ipv4_test) }}
config-ipv4 = true
# promise frequency in minutes (2 times/day)
config-frequency = 720
{% endif %}
{% endif %}
{% set re6st_optimal_test = '' ~ slave_instance.get('re6st-optimal-test', '') %}
{% set re6st_optimal_test = '' ~ slave_instance.get('re6st-optimal-test', '') %}
...
@@ -322,10 +341,13 @@ wrapper-path = {{ promise_directory }}/${:filename}
...
@@ -322,10 +341,13 @@ wrapper-path = {{ promise_directory }}/${:filename}
{% do part_list.append(re6st_optimal_test_section_title) %}
{% do part_list.append(re6st_optimal_test_section_title) %}
[{{ re6st_optimal_test_section_title }}]
[{{ re6st_optimal_test_section_title }}]
recipe = slapos.cookbook:wrapper
<= promise-plugin-base
command-line = {{ dumps(bin_directory ~ '/check-re6st-optimal-status -4 ' ~ re6st_ipv4 ~ ' -6 ' ~ re6st_ipv6) }}
module = check_re6st_optimal_status
filename = {{ re6st_optimal_test_section_title }}
name = {{ re6st_optimal_test_section_title }}.py
wrapper-path = {{ promise_directory }}/${:filename}
config-ipv4 = {{ dumps(re6st_ipv4) }}
config-ipv6 = {{ dumps(re6st_ipv6) }}
# promise frequency in minutes (2 times/day)
config-frequency = 720
{% endif %}
{% endif %}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment