Commit ae8dd586 by Thomas Gambier Committed by Romain Courteaud

[backupserver] add monitor and promise

parent e080857e
......@@ -6,6 +6,10 @@
#
###############################
[variables]
status_dirbasename = status
statistic_dirbasename = statistic
[directory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc
......@@ -22,14 +26,15 @@ cron-lines = $${:etc}/cron.lines
crontabs = $${:etc}/crontabs
cronstamps = $${:etc}/cronstamps
backup = $${:srv}/backup
status = $${:srv}/status
statistic = $${:srv}/statistic
status = $${:srv}/$${variables:status_dirbasename}
statistic = $${:srv}/$${variables:statistic_dirbasename}
backupscript = $${:etc}/backup
www = $${:srv}/www
home = $${:etc}/home
promises = $${:etc}/promise
ssl = $${:etc}/ssl
ssh = $${:home}/.ssh
plugin = $${:etc}/plugin
#################################
# Cron service
......@@ -46,7 +51,8 @@ logfile = $${directory:log}/crond.log
#################################
# Go throught slave list to set their configuration
{% 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 hostname = slave_instance.get('hostname', '') -%}
{% set connection = slave_instance.get('connection', '') -%}
......@@ -92,11 +98,29 @@ storage-path = {{ '$${' ~ slave_reference }}-backup-private_key:public_key}
# Publish slave {{ slave_reference }} information
[{{ slave_reference }}-backup-publish]
recipe = slapos.cookbook:publish
-slave-reference = {{ slave_reference }}
-slave-reference = {{ orig_slave_reference }}
authorized_key = {{ '$${' ~ slave_reference }}-backup-read-public_key:readline}
rss = https://[$${nginx-configuration:ip}]:$${nginx-configuration:port}/{{ '$${' ~ slave_reference }}-backup-script:status_name}.rss
{% 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]
recipe = slapos.recipe.template
url = ${template-backup-script:output}
......@@ -148,6 +172,7 @@ frequency = */5 * * * *
[publish-global-rss]
recipe = slapos.cookbook:publish
<= monitor-publish
rss = https://[$${nginx-configuration:ip}]:$${nginx-configuration:port}/$${update-rss-script:global_rss}
{% set crontab_line_list_string = " ".join(crontab_line_list) -%}
......@@ -187,14 +212,30 @@ ssl_key = $${directory:ssl}/nginx.key
ssl_csr = $${directory:ssl}/nginx.csr
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
[buildout]
extends =
${monitor-template:rendered}
parts =
dcron-service
nginx-service
nginx-listen-promise
activate-crontab-file
publish-global-rss
monitor-base
{% for part in part_list -%}
{{ ' %s' % part }}
{% endfor -%}
......
......@@ -15,9 +15,11 @@ extends =
../../component/findutils/buildout.cfg
# ../../stack/flask.cfg
../../stack/slapos.cfg
../../stack/monitor/buildout.cfg
parts =
extra-eggs
monitor-extra-eggs
rdiff-backup
# duplicity
dcron
......@@ -34,6 +36,11 @@ parts =
template-crontab-line
slapos-cookbook
[monitor-extra-eggs]
recipe = zc.recipe.egg
eggs =
${monitor-eggs:eggs}
[extra-eggs]
recipe = zc.recipe.egg
interpreter = pythonforrssgen
......@@ -106,7 +113,7 @@ mode = 0644
[template-pullrdiffbackup]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-pullrdiffbackup.cfg.in
md5sum = a2fb7b0cdd944be99da4122eb6f07749
md5sum = 537ab12f3885660e59d280ee40e379ac
output = ${buildout:directory}/template-pullrdiffbackup.cfg
mode = 0644
......@@ -123,3 +130,7 @@ gunicorn = 19.1.1
plone.recipe.command = 1.1
slapos.recipe.template = 2.4.2
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 sign in to comment