Commit c8e6aaf4 authored by Vincent Pelletier's avatar Vincent Pelletier

stack/erp5: Add executable to automate mariadb replication bootstrapping

Experimental. Not automatically executed.

Restores given backup, configures service as a slave to given master,
starts replication.

Like for "normal" backup restoration, any running mariadb is killed,
started with backup-restoration-friendly parameters, and killed again once
restored.

As there is AFAIK no way to ask supervisor to start even one of our own
services, this script unfortunately leaves the partition in a
not-immediately useful state.
parent 8a3037ed
......@@ -167,6 +167,10 @@ stop-on-error = true
update-command = ${:command}
command = grep parts ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link
[mariadb-start-clone-from-backup]
<= download-base
mode = 755
[mariadb-resiliency-after-import-script]
<= download-base
mode = 755
......@@ -276,6 +280,7 @@ context =
key mariadb_location mariadb:location
key mariadb_resiliency_after_import_script mariadb-resiliency-after-import-script:target
key mariadb_slow_query_report_script mariadb-slow-query-report-script:target
key mariadb_start_clone_from_backup mariadb-start-clone-from-backup:target
key matplotlibrc_location matplotlibrc:location
key mesa_location mesa:location
key onlyoffice_x2t_location onlyoffice-x2t:location
......
......@@ -21,9 +21,13 @@ md5sum = c1f1083bf6c911a0e65dcb841fba327d
filename = mysql-querydigest.sh.in
md5sum = cfe6ab8ae54a521ecb269e9d9762cbeb
[mariadb-start-clone-from-backup]
filename = instance-mariadb-start-clone-from-backup.sh.in
md5sum = 1af531c51f575a1d1362f2ca2d61620d
[template-mariadb]
filename = instance-mariadb.cfg.in
md5sum = 87b046afe5f3fb44e69b185876af4717
md5sum = 8ea5033142f450a2e90431817771cb44
[template-kumofs]
filename = instance-kumofs.cfg.in
......@@ -67,7 +71,7 @@ md5sum = 0969fbb25b05c02ef3c2d437b2f4e1a0
[template]
filename = instance.cfg.in
md5sum = f95174eee2de45d1e3ccb1d5f88355f1
md5sum = 36bba080d1bc65ea846c249dfb3c1770
[monitor-template-dummy]
filename = dummy.cfg
......
......@@ -263,6 +263,19 @@ rendered = ${directory:srv}/exporter.exclude
[dash]
dash = {{ dumps(dash) }}
[{{ section('start-clone-from-backup') }}]
< = jinja2-template-executable
template = {{ parameter_dict['mariadb-start-clone-from-backup'] }}
rendered = ${directory:bin}/start-clone-from-backup
context =
key dash dash:dash
key client binary-wrap-mysql:wrapper-path
key data_directory directory:mariadb-data
key pid_file my-cnf-parameters:pid-file
key server mysqld:rendered
key update update-mysql:output
key socket my-cnf-parameters:socket
[{{ section('resiliency-after-import-script') }}]
# Generate after import script used by importer instance of webrunner
< = jinja2-template-executable
......
......@@ -183,6 +183,7 @@ link-binary = {{ dumps(mariadb_link_binary) }}
bin-directory = {{ bin_directory }}
mariadb-resiliency-after-import-script = {{ mariadb_resiliency_after_import_script }}
mariadb-slow-query-report-script = {{ mariadb_slow_query_report_script }}
mariadb-start-clone-from-backup = {{ mariadb_start_clone_from_backup }}
promise-check-slow-queries-digest-result = {{ bin_directory }}/check-slow-queries-digest-result
percona-tools-location = {{ percona_toolkit_location }}
template-monitor = {{ template_monitor }}
......
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