Commit b05948b3 authored by Thomas Gambier's avatar Thomas Gambier 🚴🏼

Add monitor and promise to backupserver software release

parent 0e116576
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
# #
############################### ###############################
[variables]
status_dirbasename = status
statistic_dirbasename = statistic
[directory] [directory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc etc = $${buildout:directory}/etc
...@@ -22,14 +26,15 @@ cron-lines = $${:etc}/cron.lines ...@@ -22,14 +26,15 @@ cron-lines = $${:etc}/cron.lines
crontabs = $${:etc}/crontabs crontabs = $${:etc}/crontabs
cronstamps = $${:etc}/cronstamps cronstamps = $${:etc}/cronstamps
backup = $${:srv}/backup backup = $${:srv}/backup
status = $${:srv}/status status = $${:srv}/$${variables:status_dirbasename}
statistic = $${:srv}/statistic statistic = $${:srv}/$${variables:statistic_dirbasename}
backupscript = $${:etc}/backup backupscript = $${:etc}/backup
www = $${:srv}/www www = $${:srv}/www
home = $${:etc}/home home = $${:etc}/home
promises = $${:etc}/promise promises = $${:etc}/promise
ssl = $${:etc}/ssl ssl = $${:etc}/ssl
ssh = $${:home}/.ssh ssh = $${:home}/.ssh
plugin = $${:etc}/plugin
################################# #################################
# Cron service # Cron service
...@@ -46,7 +51,8 @@ logfile = $${directory:log}/crond.log ...@@ -46,7 +51,8 @@ logfile = $${directory:log}/crond.log
################################# #################################
# Go throught slave list to set their configuration # Go throught slave list to set their configuration
{% for slave_instance in slave_instance_list -%} {% for slave_instance in slave_instance_list -%}
{% set slave_reference = slave_instance.get('slave_reference') -%} {% set orig_slave_reference = slave_instance.get('slave_reference') -%}
{% set slave_reference = orig_slave_reference.replace(' ', '_') -%}
{% set frequency = slave_instance.get('frequency', '') -%} {% set frequency = slave_instance.get('frequency', '') -%}
{% set hostname = slave_instance.get('hostname', '') -%} {% set hostname = slave_instance.get('hostname', '') -%}
{% set connection = slave_instance.get('connection', '') -%} {% set connection = slave_instance.get('connection', '') -%}
...@@ -92,11 +98,29 @@ storage-path = {{ '$${' ~ slave_reference }}-backup-private_key:public_key} ...@@ -92,11 +98,29 @@ storage-path = {{ '$${' ~ slave_reference }}-backup-private_key:public_key}
# Publish slave {{ slave_reference }} information # Publish slave {{ slave_reference }} information
[{{ slave_reference }}-backup-publish] [{{ slave_reference }}-backup-publish]
recipe = slapos.cookbook:publish recipe = slapos.cookbook:publish
-slave-reference = {{ slave_reference }} -slave-reference = {{ orig_slave_reference }}
authorized_key = {{ '$${' ~ slave_reference }}-backup-read-public_key:readline} authorized_key = {{ '$${' ~ slave_reference }}-backup-read-public_key:readline}
rss = https://[$${nginx-configuration:ip}]:$${nginx-configuration:port}/{{ '$${' ~ slave_reference }}-backup-script:status_name}.rss rss = https://[$${nginx-configuration:ip}]:$${nginx-configuration:port}/{{ '$${' ~ slave_reference }}-backup-script:status_name}.rss
{% do part_list.append("%s-backup-publish" % slave_reference) -%} {% do part_list.append("%s-backup-publish" % slave_reference) -%}
[{{ slave_reference }}-promise-check-backup]
recipe = slapos.cookbook:promise.plugin
eggs =
slapos.toolbox
output = $${directory:plugin}/{{ slave_reference }}_check_backup.py
content =
from slapos.promise.plugin.backupserver_check_backup import RunPromise
config-status_dirbasename = $${variables:status_dirbasename}
config-status_name = {{ '$${' ~ slave_reference }}-backup-script:status_name}
config-status_fullpath = {{ '$${' ~ slave_reference }}-backup-script:status_log}
config-script_fullpath = {{ '$${' ~ slave_reference }}-backup-script:output
config-cron_frequency = {{ frequency }}
config-monitor_url = $${monitor-publish:monitor-base-url}
config-statistic_dirbasename = $${variables:statistic_dirbasename}
config-statistic_name = {{ '$${' ~ slave_reference }}-backup-script:statistic_name}
mode = 600
{% do part_list.append("%s-promise-check-backup" % slave_reference) -%}
[{{ slave_reference }}-backup-script] [{{ slave_reference }}-backup-script]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${template-backup-script:output} url = ${template-backup-script:output}
...@@ -148,6 +172,7 @@ frequency = */5 * * * * ...@@ -148,6 +172,7 @@ frequency = */5 * * * *
[publish-global-rss] [publish-global-rss]
recipe = slapos.cookbook:publish recipe = slapos.cookbook:publish
<= monitor-publish
rss = https://[$${nginx-configuration:ip}]:$${nginx-configuration:port}/$${update-rss-script:global_rss} rss = https://[$${nginx-configuration:ip}]:$${nginx-configuration:port}/$${update-rss-script:global_rss}
{% set crontab_line_list_string = " ".join(crontab_line_list) -%} {% set crontab_line_list_string = " ".join(crontab_line_list) -%}
...@@ -187,14 +212,30 @@ ssl_key = $${directory:ssl}/nginx.key ...@@ -187,14 +212,30 @@ ssl_key = $${directory:ssl}/nginx.key
ssl_csr = $${directory:ssl}/nginx.csr ssl_csr = $${directory:ssl}/nginx.csr
ssl_crt = $${directory:ssl}/nginx.crt ssl_crt = $${directory:ssl}/nginx.crt
#################################
# Monitoring
#################################
[monitor-instance-parameter]
monitor-httpd-port = 9687
[monitor-conf-parameters]
private-path-list +=
$${directory:statistic}
$${directory:status}
# Add parts generated by template # Add parts generated by template
[buildout] [buildout]
extends =
${monitor-template:rendered}
parts = parts =
dcron-service dcron-service
nginx-service nginx-service
nginx-listen-promise nginx-listen-promise
activate-crontab-file activate-crontab-file
publish-global-rss publish-global-rss
monitor-base
{% for part in part_list -%} {% for part in part_list -%}
{{ ' %s' % part }} {{ ' %s' % part }}
{% endfor -%} {% endfor -%}
......
...@@ -15,9 +15,11 @@ extends = ...@@ -15,9 +15,11 @@ extends =
../../component/findutils/buildout.cfg ../../component/findutils/buildout.cfg
# ../../stack/flask.cfg # ../../stack/flask.cfg
../../stack/slapos.cfg ../../stack/slapos.cfg
../../stack/monitor/buildout.cfg
parts = parts =
extra-eggs extra-eggs
monitor-extra-eggs
rdiff-backup rdiff-backup
# duplicity # duplicity
dcron dcron
...@@ -34,6 +36,11 @@ parts = ...@@ -34,6 +36,11 @@ parts =
template-crontab-line template-crontab-line
slapos-cookbook slapos-cookbook
[monitor-extra-eggs]
recipe = zc.recipe.egg
eggs =
${monitor-eggs:eggs}
[extra-eggs] [extra-eggs]
recipe = zc.recipe.egg recipe = zc.recipe.egg
interpreter = pythonforrssgen interpreter = pythonforrssgen
...@@ -106,7 +113,7 @@ mode = 0644 ...@@ -106,7 +113,7 @@ mode = 0644
[template-pullrdiffbackup] [template-pullrdiffbackup]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-pullrdiffbackup.cfg.in url = ${:_profile_base_location_}/instance-pullrdiffbackup.cfg.in
md5sum = a2fb7b0cdd944be99da4122eb6f07749 md5sum = d6713aaf8ce2d517c9c10b3e74a0599c
output = ${buildout:directory}/template-pullrdiffbackup.cfg output = ${buildout:directory}/template-pullrdiffbackup.cfg
mode = 0644 mode = 0644
...@@ -129,3 +136,7 @@ gunicorn = 19.1.1 ...@@ -129,3 +136,7 @@ gunicorn = 19.1.1
plone.recipe.command = 1.1 plone.recipe.command = 1.1
slapos.recipe.template = 2.4.2 slapos.recipe.template = 2.4.2
PyRSS2Gen = 1.1 PyRSS2Gen = 1.1
apache-libcloud = 2.3.0
gitdb2 = 2.0.5
smmap2 = 2.0.5
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