erp5: add periodicity for tidstorage/mariadb backup.

Also move mariadb buildout instance profile to dynamic template.
parent 761c9b69
......@@ -154,23 +154,10 @@ md5sum = 8db483ef7c3da79a1cb5ea07ba79a0ed
mode = 755
[template-mariadb]
< = template-jinja2-base
filename = instance-mariadb.cfg
md5sum = 34f851101ce6f187296f38648f5bbae0
extra-context =
key coreutils_location coreutils:location
key dcron_location dcron:location
key findutils_location findutils:location
key gettext_location gettext:location
key grep_location grep:location
key gzip_location gzip:location
key logrotate_location logrotate:location
key mariadb_location mariadb:location
key mariadb_resiliency_after_import_script mariadb-resiliency-after-import-script:target
key perl_location perl:location
key perl_siteprefix perl:siteprefix
key sed_location sed:location
key xtrabackup_location xtrabackup:location
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-mariadb.cfg.in
md5sum = 48e8816d7d0c9e17585398fcf8e70347
mode = 640
[template-zope]
recipe = slapos.recipe.build:download
......@@ -192,7 +179,7 @@ extra-context =
[template-tidstorage]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-tidstorage.cfg.in
md5sum = 9918eef66c4d13e8ae54f1c5baf793a5
md5sum = 20ee9db93c57425319cd4b385d327d39
mode = 640
[template-cloudooo]
......@@ -212,7 +199,7 @@ mode = 640
# XXX: "template.cfg" is hardcoded in instanciation recipe
filename = template.cfg
template = ${:_profile_base_location_}/instance.cfg.in
md5sum = 2ed28d874b5494521cb874a2474af7c5
md5sum = 9ced9ebba770ba0b4e6ffe74c65770f5
extra-context =
key apache_location apache:location
key aspell_location aspell:location
......@@ -227,9 +214,11 @@ extra-context =
key dmtx_utils_location dmtx-utils:location
key erp5_location erp5:location
key file_location file:location
key findutils_location findutils:location
key fontconfig_location fontconfig:location
key fonts_location fonts:location
key freetype_location freetype:location
key gettext_location gettext:location
key git_location git:location
key glib_location glib:location
key glu_location glu:location
......@@ -255,8 +244,11 @@ extra-context =
key local_bt5_repository local-bt5-repository:list
key logrotate_location logrotate:location
key mariadb_location mariadb:location
key mariadb_resiliency_after_import_script mariadb-resiliency-after-import-script:target
key mesa_location mesa:location
key openssl_location openssl:location
key perl_location perl:location
key perl_siteprefix perl:siteprefix
key poppler_location poppler:location
key sed_location sed:location
key stunnel_location stunnel:location
......@@ -264,7 +256,7 @@ extra-context =
key template_erp5_cluster template-erp5-cluster:target
key template_erp5_single template-erp5-single:target
key template_kumofs template-kumofs:rendered
key template_mariadb template-mariadb:rendered
key template_mariadb template-mariadb:target
key template_memcached template-memcached:rendered
key template_tidstorage template-tidstorage:target
key template_varnish template-varnish:target
......@@ -276,6 +268,7 @@ extra-context =
key wget_location wget:location
key xdamage_location xdamage:location
key xfixes_location xfixes:location
key xtrabackup_location xtrabackup:location
key zlib_location zlib:location
[template-memcached]
......@@ -298,7 +291,7 @@ mode = 640
[template-erp5-cluster]
recipe = slapos.recipe.build:download
url = ${:_profile_base_location_}/instance-erp5-cluster.cfg.in
md5sum = 1fafb23019043c069bf6e43d61010a54
md5sum = 2ff90bb68761b4930f92321f3b6ba590
mode = 640
[template-varnish]
......
......@@ -29,6 +29,7 @@ partition-id = ${slap-connection:partition-id}
<=request-common
name = MariaDB DataBase
software-type = mariadb
config-mariadb-json = ${slap-parameter:mariadb-json}
sla-computer_guid = ${slap-parameter:mariadb-computer-guid}
[request-cloudooo]
......
{% if software_type == slap_software_type -%}
{% set json = json_module.loads(parameter_dict.get('mariadb-json', '{}')) -%}
{% set backup_periodicity = json.get('backup-periodicity', '0 22 * * *') -%}
{% set bin_directory = parameter_dict['buildout-bin-directory'] -%}
[buildout]
parts =
publish-mariadb-url
......@@ -37,7 +42,7 @@ command = mysqldump
recipe = slapos.cookbook:cron.d
cron-entries = ${cron:cron-entries}
name = mariadb-backup
frequency = 0 22 * * *
frequency = ${slap-parameter:backup-periodicity}
{# When binlogs are enabled:
# flush-logs: used so no manipulation on binlogs is needed to restore from
# full + binlogs. The first binlog after a dump starts from dump snapshot and
......@@ -53,7 +58,7 @@ file-glob = ??????????????.sql.gz
recipe = slapos.cookbook:cron.d
cron-entries = ${cron:cron-entries}
name = mariadb-backup-expire
frequency = 0 22 * * *
frequency = {{ backup_periodicity }}
command = {{ findutils_location }}/bin/find "${directory:mariadb-backup-full}" -maxdepth 1 -name "${cron-entry-mariadb-backup:file-glob}" -daystart -mtime +7 -delete
[mariadb-instance]
......@@ -240,3 +245,4 @@ port = ${mariadb-instance:port}
[slap-parameter]
test-database-amount = 100
{%- endif %}
......@@ -8,6 +8,7 @@ Note: all port counters are pre-incremented. No idea why base port is skipped.
{% set current_apache_port = apache_port_base | int -%}
{% set current_haproxy_port = haproxy_port_base | int -%}
{% set json = json_module.loads(slapparameter_dict['json']) -%}
{% set backup_periodicity = json.get('backup-periodicity', 'daily') -%}
{% set bin_directory = parameter_dict['buildout-bin-directory'] -%}
{#
XXX: This template only supports exactly one IPv4 and one IPv6 per
......@@ -560,7 +561,7 @@ repozo-wrapper = ${buildout:bin-directory}/tidstorage-repozo
< = cron-base
recipe = slapos.cookbook:cron.d
name = tidstorage
frequency = 0 0 * * *
frequency = {{ backup_periodicity }}
command = ${tidstorage:repozo-wrapper}
[logrotate-entry-tidstorage]
......
......@@ -124,6 +124,29 @@ extra-context =
# Must match the key id in [switch-softwaretype] which uses this section.
raw software_type varnish
[dynamic-template-mariadb]
< = jinja2-template-base
template = {{ template_mariadb }}
filename = instance-mariadb.cfg
extra-context =
raw coreutils_location {{ coreutils_location }}
raw dcron_location {{ dcron_location }}
raw findutils_location {{ findutils_location }}
raw gettext_location {{ gettext_location }}
raw grep_location {{ grep_location }}
raw gzip_location {{ gzip_location }}
raw logrotate_location {{ logrotate_location }}
raw mariadb_location {{ mariadb_location }}
raw mariadb_resiliency_after_import_script {{ mariadb_resiliency_after_import_script }}
raw perl_location {{ perl_location }}
raw perl_siteprefix {{ perl_siteprefix }}
raw sed_location {{ sed_location }}
raw xtrabackup_location {{ xtrabackup_location }}
raw buildout-bin-directory {{ buildout_bin_directory }}
import json_module json
# Must match the key id in [switch-softwaretype] which uses this section.
raw software_type mariadb
[dynamic-template-zope-parameters]
apache = {{ apache_location }}
aspell = {{ aspell_location }}
......@@ -227,7 +250,7 @@ kumofs = {{ template_kumofs }}
memcached = {{ template_memcached }}
cloudooo = ${dynamic-template-cloudooo:rendered}
zope = ${dynamic-template-zope:rendered}
mariadb = {{ template_mariadb }}
mariadb = ${dynamic-template-mariadb:rendered}
tidstorage = ${dynamic-template-tidstorage:rendered}
varnish = ${dynamic-template-varnish:rendered}
......
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