erp5: add periodicity for tidstorage/mariadb backup.

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