Commit fca591cd authored by Alain Takoudjou's avatar Alain Takoudjou

repman: run mariadb service using supervisord controller, add script for restart mariadb

parent 45d67909
......@@ -14,11 +14,11 @@
# not need these here).
[instance.cfg]
filename = instance.cfg.in
md5sum = b38fb4c5cdba2223c84d62ef60513e49
md5sum = 8f3e5d9c0de16006cb36f0b8121fc11a
[instance-repman.cfg]
_update_hash_filename_ = instance-repman.cfg.jinja2.in
md5sum = e50536613b175a2e25a041c61adeb59f
md5sum = 2688b8aa946d4878d3f1c4fa08375cfe
[config-toml.in]
_update_hash_filename_ = templates/config.toml.in
......@@ -26,7 +26,7 @@ md5sum = 1efa65af63b14ca2dd1b8c692b2af80e
[config-cluster-toml.in]
_update_hash_filename_ = templates/cluster-config.toml.in
md5sum = 39fb83a9b542b9809948cab98aefa2e7
md5sum = 45f4628a5660b663dfdd9037e803d884
[nginx.conf.in]
_update_hash_filename_ = templates/nginx.conf.in
......@@ -34,7 +34,7 @@ md5sum = 0eeb24c6aa0760f0d33c4cc2828ddf30
[template-mariadb.cfg]
_update_hash_filename_ = instance-mariadb.cfg.jinja2.in
md5sum = d32a50db737a9131de7f3eb27f704232
md5sum = 10dea9ec48ce889315202d112a66f121
[template-my-cnf]
_update_hash_filename_ = templates/my.cnf.in
......
......@@ -141,13 +141,22 @@ environ =
{{ variable }}
{%- endfor %}
[{{ section('ca-mysqld') }}]
[ca-mysqld]
<= certificate-authority
recipe = slapos.cookbook:certificate_authority.request
key-file = ${my-cnf-parameters:ssl-key}
cert-file = ${my-cnf-parameters:ssl-crt}
executable = ${mysqld:rendered}
wrapper = ${directory:services}/mariadb
wrapper = ${directory:controller}/mariadb
{% import "supervisord_lib" as supervisord_lib with context %}
{{ supervisord_lib.supervisord("mariadb-controller", buildout_bin_directory, supervisord_conf, use_service_hash=False) }}
{% do part_list.append("mariadb-controller-service") -%}
{% set maradb_program_dict = {"name": "mariadb", "command": "${ca-mysqld:wrapper}",
"stopwaitsecs": 86400, "environment": []} %}
{{ supervisord_lib.supervisord_program("mariadb-controller", "mariadb", maradb_program_dict) }}
{% do part_list.append("mariadb-controller-mariadb") %}
[odbc-ini-text]
text = {{ dumps(slapparameter_dict.get('odbc-ini', '').encode('base64')) }}
......@@ -216,6 +225,7 @@ bin = ${buildout:directory}/bin
etc = ${buildout:directory}/etc
scripts = ${:etc}/run
services = ${:etc}/service
controller = ${:etc}/controller
plugin = ${:etc}/plugin
srv = ${buildout:directory}/srv
tmp = ${buildout:directory}/tmp
......@@ -241,7 +251,7 @@ log-dir = ${directory:mysql}/.system/logs
tmp-dir = ${directory:tmp}
mysqld-socket = ${my-cnf-parameters:socket}
socat-port = {{ port + 1 }}
restart-script = ${mysqld-restart-script:path}
restart-script = ${mysqld-restart-script:rendered}
socat-location = {{ parameter_dict['socat-location'] }}
mysql-location = {{ parameter_dict['mariadb-location'] }}
ip = {{ ip }}
......@@ -262,11 +272,12 @@ frequency = * * * * *
command = ${dbjobs-executable:rendered}
[mysqld-restart-script]
recipe = plone.recipe.command
command =
echo "NOT IMPLEMENTED FOR NOW" > ${:path}
update-command = ${:command}
path = ${directory:bin}/mysqld_restart
< = jinja2-template-executable
rendered = ${directory:bin}/mysqld_restart
template = inline:#!/bin/sh
${mariadb-controller-bin:wrapper-path} restart mariadb
sleep 1
${mariadb-controller-bin:wrapper-path} status
# Donwnload mariadb configuration from repman
[{{ section('install-mysql-config') }}]
......
......@@ -113,7 +113,7 @@ proxysql-servers = {{ ipv4 }}
password = ${repman-parameter:password}
proxysql-partition = ${buildout:directory}
proxy-tags = {{ parameter_dict.get("proxy-tags", "pkg,masterslave,linux,noreadwritesplit") }}
logical-backup-cron = {{ parameter_dict.get("logical-backup-cron", "0 1 * * 6") }}
logical-backup-cron = {{ parameter_dict.get("logical-backup-cron", "0 22 * * *") }}
physical-backup-cron = {{ parameter_dict.get("physical-backup-cron", "0 0 * * *") }}
proxy-cpu-cores = {{ parameter_dict.get("proxy-cpu-cores", 2) }}
proxy-memory = {{ parameter_dict.get("proxy-memory", 1) }}
......
......@@ -27,15 +27,21 @@ recipe = slapos.recipe.template:jinja2
mode = 0644
extensions = jinja2.ext.do
rendered= ${buildout:directory}/${:_buildout_section_name_}
supervisord-lib = {{ supervisord_lib }}
import-list =
file supervisord_lib :supervisord-lib
context =
key slapparameter_dict slap-configuration:configuration
key computer_id slap-configuration:computer
key ipv4_set slap-configuration:ipv4
key ipv6_set slap-configuration:ipv6
raw bin_directory {{ buildout_directory }}
raw buildout_directory {{ buildout_directory }}
raw buildout_bin_directory {{ buildout_bin_directory }}
raw eggs_directory {{ buildout_egg_directory }}
raw develop_eggs_directory {{ buildout_develop_directory }}
raw mariadb_location {{ mariadb_location }}
raw supervisord_lib {{ supervisord_lib }}
raw supervisord_conf {{ supervisord_conf }}
raw template_monitor {{ template_monitor_cfg }}
# program binaries
......
......@@ -19,6 +19,7 @@ extends =
../../component/proxysql/buildout.cfg
../../component/socat/buildout.cfg
../../component/rsync/buildout.cfg
../../stack/supervisord/buildout.cfg
../../stack/monitor/buildout.cfg
../../stack/slapos.cfg
......@@ -29,7 +30,7 @@ parts =
template-mariadb.cfg
template-mysqld-wrapper
gowork
restic
[mariadb]
# Compile dir is for plugins, there's no plugin yet
......@@ -50,6 +51,7 @@ context =
key buildout_egg_directory buildout:eggs-directory
key buildout_develop_directory buildout:develop-eggs-directory
key buildout_directory buildout:directory
key buildout_bin_directory buildout:bin-directory
key dbjobs_in dbjobs-in:target
key dash_location dash:location
key jq_location jq-binary:location
......@@ -67,6 +69,8 @@ context =
key rsync_location rsync:location
key restic_bin_location restic:location
key socat_location socat:location
key supervisord_lib supervisord-library:target
key supervisord_conf supervisord-conf:target
key template_repman_manager_sh repman-manager-sh.in:target
key template_mariadb template-mariadb.cfg:target
key template_mariadb_initial_setup template-mariadb-initial-setup:target
......
......@@ -26,7 +26,7 @@ monitoring-scheduler = true
scheduler-db-servers-logical-backup = true
scheduler-db-servers-logical-backup-cron = "0 {{ parameter_dict['logical-backup-cron'] }}"
scheduler-db-servers-logs = true
scheduler-db-servers-logs-cron = "0 0 * * * *"
scheduler-db-servers-logs-cron = "0 0 23 * * *"
scheduler-db-servers-logs-table-keep = 4
scheduler-db-servers-logs-table-rotate = true
scheduler-db-servers-logs-table-rotate-cron = "0 0 23 * * *"
......
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