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