Commit a27c7329 authored by Alain Takoudjou's avatar Alain Takoudjou

repman: allow to deploy multiple proxysql, prepare for proxy with sphinx

parent 43c34306
...@@ -14,11 +14,15 @@ ...@@ -14,11 +14,15 @@
# not need these here). # not need these here).
[instance.cfg] [instance.cfg]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = b41f521b5f7980c64260ed0e5c494450 md5sum = b6798777834fdc4789591b9a53048e9c
[instance-repman.cfg] [instance-repman.cfg]
_update_hash_filename_ = instance-repman.cfg.jinja2.in _update_hash_filename_ = instance-repman.cfg.jinja2.in
md5sum = 657ecdb1dfbbcf53e4e7932b3b5708c4 md5sum = e89737ecaa9308baa792d01f8f130667
[instance-proxy.cfg]
_update_hash_filename_ = instance-proxy.cfg.jinja2.in
md5sum = a8560b62fa3e8907a9483bb55ce02ebf
[config-toml.in] [config-toml.in]
_update_hash_filename_ = templates/config.toml.in _update_hash_filename_ = templates/config.toml.in
......
{% set publish_dict = {} -%}
{% set part_list = [] -%}
{% set ip = (ipv6_set | list)[0] -%}
{% set ipv4 = (ipv4_set | list)[0] -%}
{% set name = slapparameter_dict['proxy-name'] -%}
{% set monitor_password = slapparameter_dict['monitor-passwd'] -%}
{% set repman_url = slapparameter_dict['repman-url'] -%}
{% set proxy_port = slapparameter_dict.get('proxy-port', 6032) -%}
{% set proxy_admin_port = slapparameter_dict.get('proxy-admin-port', 7032) -%}
{% set cluster_list = [] -%}
{% do cluster_list.append({'name':name, 'host': ipv4, 'port': proxy_admin_port}) -%}
[directory]
recipe = slapos.cookbook:mkdirectory
home = ${buildout:directory}
etc = ${:home}/etc
var = ${:home}/var
run = ${:var}/run
srv = ${:home}/srv
scripts = ${:etc}/run
service = ${:etc}/service
controller = ${:etc}/controller
promise = ${:etc}/promise
log = ${:var}/log
tmp = ${:home}/tmp
data = ${:home}/proxy
{% import "supervisord_lib" as supervisord_lib with context %}
{% set proxysql_controller = "proxysql-ctl" -%}
{{ supervisord_lib.supervisord(proxysql_controller, buildout_bin_directory, supervisord_conf, use_service_hash=False) }}
{% do part_list.append("supervisord-proxysql-ctl") -%}
[download-proxy-config]
recipe = slapos.recipe.template:jinja2
template = inline:#!{{ bash_bin }}
NAME=$1
HOST=$2
PORT=$3
CONFIG=$4
if [ -z "$CONFIG" ]; then
CONFIG="${directory:etc}/proxysql-$NAME.cnf"
fi
mkdir -p ${directory:tmp}/proxies
cd ${directory:tmp}/proxies
{{ curl_bin }} -o proxy-$NAME.tar.gz {{ repman_url }}/api/clusters/$NAME/servers/$HOST/$PORT/config
tar -xzf proxy-$NAME.tar.gz
cp conf/proxysql.cnf $CONFIG
rendered = ${directory:bin}/update-proxysql-config
mode = 755
# Manage Replication Manager clusters
# Donwnload proxysql configuration from repman
[config-proxysql]
recipe = plone.recipe.command
# if Repman is not started, cannot download config from server
stop-on-error = false
config = ${directory:etc}/proxysql.cnf
data = ${directory:data}
command =
${download-proxy-config:rendered} {{ name }} {{ ipv4 }} {{ proxy_admin_port }} ${:config}
update-command = ${:command}
[proxysql-wrapper]
recipe = slapos.cookbook:wrapper
command-line =
{{ proxysql_location }}/bin/proxysql -f
-c ${config-proxysql:config}
-D ${config-proxysql:data}
--reload
# -S /tmp/proxysql_admin.sock
wrapper-path = ${directory:controller}/proxysql-{{ name }}
wait-for-files =
${config-proxysql:config}
# ${repman:bootstrap}/{{ name }}_bootstrapped
depends =
${proxysql-admin-promise:recipe}
${proxysql-promise:recipe}
${proxysql-ipv6-promise:recipe}
[proxysql-admin-promise]
<= monitor-promise-base
module = check_port_listening
name = proxysql-admin-port-listening.py
config-hostname= {{ ipv4 }}
config-port = {{ proxy_admin_port }}
[proxysql-promise]
<= monitor-promise-base
module = check_port_listening
name = proxysql-port-listening.py
config-hostname= {{ ipv4 }}
config-port = {{ proxy_port }}
[proxysql-ipv6-promise]
<= monitor-promise-base
module = check_port_listening
name = proxysql-ipv6-port-listening.py
config-hostname= {{ ip }}
config-port = {{ proxy_port }}
{% set service_name = "proxy-" ~ name -%}
{% set proxysql_dict = {"name": service_name, "command": "${proxysql-wrapper:wrapper-path}",
"stopwaitsecs": 60, "environment": [],
"stdout_logfile": "${directory:log}/" ~ service_name ~ ".log",
"stderr_logfile": "${directory:log}/" ~ service_name ~ ".log" } %}
{{ supervisord_lib.supervisord_program(service_name, proxysql_dict) }}
{% do part_list.append("supervisord-" ~ service_name) %}
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration
computer = ${slap-connection:computer-id}
partition = ${slap-connection:partition-id}
url = ${slap-connection:server-url}
key = ${slap-connection:key-file}
cert = ${slap-connection:cert-file}
[publish-connection-parameter]
recipe = slapos.cookbook:publish.serialised
<= monitor-publish
proxy-port = {{ proxy_port }}
proxy-admin-port = {{ proxy_admin_port }}
ipv4 = {{ ipv4 }}
ipv6 = {{ ip }}
partition-path = ${buildout:directory}
[monitor-instance-parameter]
monitor-httpd-port = 8060
cors-domains = {{ slapparameter_dict.get('monitor-cors-domains', 'monitor.app.officejs.com') }}
username = admin
password = {{ monitor_password }}
[template-proxysql-need-stop-start]
recipe = slapos.recipe.template:jinja2
rendered = ${directory:bin}/proxysql_check_stop_start
template = {{ template_proxy_need_stopstart }}
mode = 755
cluster-list = {{ dumps(cluster_list) }}
context =
key proxysql_controller {{proxysql_controller}}-bin:wrapper-path
key get_proxy_config download-proxy-config:rendered
key cluster_list :cluster-list
raw repman_url {{ repman_url }}
raw jq_bin {{ jq_bin }}
raw bash_bin {{ bash_bin }}
raw curl_bin {{ curl_bin }}
[proxy-need-stop-start]
recipe = slapos.cookbook:cron.d
cron-entries = ${cron:cron-entries}
name = proxysql-need-stop-start
frequency = * * * * *
command = ${template-proxysql-need-stop-start:rendered}
#############################
#
# Deploy replication-manager instance
#
#############################
[buildout]
extends =
{{ template_monitor }}
parts =
monitor-base
publish-connection-parameter
proxy-need-stop-start
# Complete parts with sections
{{ part_list | join('\n ') }}
eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
...@@ -221,6 +221,23 @@ ...@@ -221,6 +221,23 @@
"type": "string", "type": "string",
"default": "0 1 * * *" "default": "0 1 * * *"
}, },
"proxy-type": {
"title": "Proxy to deploy",
"description": "Type of proxy to deploy with the cluster",
"type": "string",
"default": "proxysql",
"enum": [
"proxysql",
"sphinx"
]
},
"proxy-amount": {
"title": "Proxy Instances Amount",
"description": "Number of Proxy instances de deploy",
"type": "integer",
"default": 1,
"minimum": 1
},
"proxy-cpu-cores": { "proxy-cpu-cores": {
"title": "Proxy Cpu cores", "title": "Proxy Cpu cores",
"description": "Proxy Cpu cores. Default: 2", "description": "Proxy Cpu cores. Default: 2",
......
...@@ -26,11 +26,6 @@ data = ${:var}/lib ...@@ -26,11 +26,6 @@ data = ${:var}/lib
nginx-prefix = ${:var}/nginx nginx-prefix = ${:var}/nginx
tmp = ${:home}/tmp tmp = ${:home}/tmp
{% import "supervisord_lib" as supervisord_lib with context %}
{% set proxysql_controller = "proxysql-ctl" -%}
{{ supervisord_lib.supervisord(proxysql_controller, buildout_bin_directory, supervisord_conf, use_service_hash=False) }}
{% do part_list.append("supervisord-proxysql-ctl") -%}
[request-common] [request-common]
recipe = slapos.cookbook:request.serialised recipe = slapos.cookbook:request.serialised
software-url = ${slap-connection:software-release-url} software-url = ${slap-connection:software-release-url}
...@@ -40,24 +35,6 @@ cert-file = ${slap-connection:cert-file} ...@@ -40,24 +35,6 @@ cert-file = ${slap-connection:cert-file}
computer-id = ${slap-connection:computer-id} computer-id = ${slap-connection:computer-id}
partition-id = ${slap-connection:partition-id} partition-id = ${slap-connection:partition-id}
[download-proxy-config]
recipe = slapos.recipe.template:jinja2
template = inline:#!{{ bash_bin }}
NAME=$1
HOST=$2
PORT=$3
CONFIG=$4
if [ -z "$CONFIG" ]; then
CONFIG="${repman:proxies}/proxysql-$NAME.cnf"
fi
mkdir -p ${repman:config-tmp}/proxies
cd ${repman:config-tmp}/proxies
{{ curl_bin }} -o proxies-$NAME.tar.gz ${nginx-parameter:repman-url}/api/clusters/$NAME/servers/$HOST/$PORT/config
tar -xzf proxies-$NAME.tar.gz
cp conf/proxysql.cnf $CONFIG
rendered = ${directory:bin}/update-proxysql-config
mode = 755
{% do mariadb_dict.__setitem__('computer-memory-percent-threshold', 80) -%} {% do mariadb_dict.__setitem__('computer-memory-percent-threshold', 80) -%}
{% set default_parameter_dict = {"cluster1": {"name": "cluster1", "db-prefered-master": "", {% set default_parameter_dict = {"cluster1": {"name": "cluster1", "db-prefered-master": "",
"database-amount": 2, "proxysql-user": "external", "database-amount": 2, "proxysql-user": "external",
...@@ -67,8 +44,14 @@ mode = 755 ...@@ -67,8 +44,14 @@ mode = 755
{% do mariadb_dict.__setitem__('innodb-file-per-table', parameter_dict.get('innodb-file-per-table', 1)) -%} {% do mariadb_dict.__setitem__('innodb-file-per-table', parameter_dict.get('innodb-file-per-table', 1)) -%}
{% do mariadb_dict.__setitem__('use-ipv6', parameter_dict.get('use-ipv6', True)) -%} {% do mariadb_dict.__setitem__('use-ipv6', parameter_dict.get('use-ipv6', True)) -%}
{% set database_list = parameter_dict.get('database-list', [{'name': 'repdb', 'user': 'user', 'password': 'insecure'}]) -%} {% set proxy_amount = parameter_dict.get('proxy-amount', 1) -%}
{% set proxy_type = parameter_dict.get('proxy-type', 'proxysql') -%}
{% set proxy_port = 6032 + 100*loop.index0 -%}
{% set proxy_config_dict = {'ip': [], 'ipv6': [], 'partition': [],
'port': proxy_port, 'admin-port': proxy_port + 1000} -%}
# Request mariadb instances # Request mariadb instances
{% set database_list = parameter_dict.get('database-list', [{'name': 'repdb', 'user': 'user', 'password': 'insecure'}]) -%}
{% set db_amount = parameter_dict.get('database-amount', 2) -%} {% set db_amount = parameter_dict.get('database-amount', 2) -%}
{% if db_amount < 2 -%} {% if db_amount < 2 -%}
{% set db_amount = 2 -%} {% set db_amount = 2 -%}
...@@ -76,8 +59,8 @@ mode = 755 ...@@ -76,8 +59,8 @@ mode = 755
{% for i in range(0, db_amount) -%} {% for i in range(0, db_amount) -%}
{% do mariadb_dict.__setitem__('tcp-port', 2099 + (i * 100)) -%} {% do mariadb_dict.__setitem__('tcp-port', 2099 + (i * 100)) -%}
{% set section = 'request-mariadb-' ~ i -%} {% set section = 'request-mariadb-' ~ name ~ i -%}
{% set dbname = 'Mariadb-' ~ i -%} {% set dbname = 'Mariadb-' ~ name ~ '-' ~ i -%}
[{{ section }}] [{{ section }}]
<= request-common <= request-common
...@@ -107,31 +90,48 @@ return = ...@@ -107,31 +90,48 @@ return =
{% do mariadb_server_list.append('${' ~ section ~ ':connection-database-host}') -%} {% do mariadb_server_list.append('${' ~ section ~ ':connection-database-host}') -%}
{% do receiver_port_list.append('${' ~ section ~ ':connection-receiver-port}') -%} {% do receiver_port_list.append('${' ~ section ~ ':connection-receiver-port}') -%}
{% do mariadb_path_list.append('${' ~ section ~ ':connection-partition-path}') -%} {% do mariadb_path_list.append('${' ~ section ~ ':connection-partition-path}') -%}
{% do monitor_base_url_dict.__setitem__('mariadb' ~ i, '${' ~ section ~ ':connection-monitor-base-url}') -%} {% do monitor_base_url_dict.__setitem__('mariadb' ~ name ~ '-' ~ i, '${' ~ section ~ ':connection-monitor-base-url}') -%}
{% endfor -%}
{% for i in range(0, proxy_amount) -%}
{% set section = "request-proxy-" ~ name ~ '-' ~ i -%}
{% set proxy_name = "Proxy-" ~ name ~ '-' ~ i -%}
[{{ section }}]
<= request-common
software-type = proxydb
name = {{ proxy_name }}
#sla-computer_guid =
config-monitor-passwd = ${publish-early:monitor-password}
config-repman-url = ${nginx-parameter:backend-url}
config-repman-secure-url = ${nginx-parameter:backend-ssl-url}
config-proxy-name = {{ name }}
config-type = {{ parameter_dict.get('proxy-type', "proxysql") }}
config-proxy-port = {{ proxy_config_dict['port'] }}
config-admin-proxy-port = {{ proxy_config_dict['admin-port'] }}
config-bootstraped = false
return =
partition-path
monitor-base-url
ipv4
ipv6
{% do part_list.append(section) -%}
{% do proxy_config_dict['ip'].append('${' ~ section ~ ':connection-ipv4}') -%}
{% do proxy_config_dict['ipv6'].append('${' ~ section ~ ':connection-ipv6}') -%}
{% do proxy_config_dict['partition'].append('${' ~ section ~ ':connection-partition-path}') -%}
{% do monitor_base_url_dict.__setitem__('proxy' ~ name ~ '-' ~ i, '${' ~ section ~ ':connection-monitor-base-url}') -%}
{% endfor -%} {% endfor -%}
# Manage Replication Manager clusters # Manage Replication Manager clusters
[{{name}}-admin-port]
recipe = slapos.cookbook:free_port
ip = {{ ipv4 }}
minimum = 6032
maximum = 6132
[{{name}}-port]
recipe = slapos.cookbook:free_port
ip = {{ ipv4 }}
minimum = 7032
maximum = 7132
{% set prefered_master = parameter_dict.get("db-prefered-master") -%} {% set prefered_master = parameter_dict.get("db-prefered-master") -%}
[{{ name ~ '-cluster-parameter' }}] [{{ name ~ '-cluster-parameter' }}]
{% for key, value in parameter_dict.items() -%} {% for key, value in parameter_dict.items() -%}
{{ key }} = {{ value }} {{ key }} = {{ value }}
{% endfor -%} {% endfor -%}
proxysql-user = {{ parameter_dict.get("proxysql-user", "external") }}
proxy-port = {{ '${' ~ name ~ '-port:port}' }}
proxy-admin-port = {{ '${' ~ name ~ '-admin-port:port}' }}
db-user = repman db-user = repman
db-password = ${publish-early:db-root-password} db-password = ${publish-early:db-root-password}
db-list = {{ mariadb_server_list | join(',') }} db-list = {{ mariadb_server_list | join(',') }}
...@@ -145,10 +145,15 @@ db-prefered-master = {{ prefered_master }} ...@@ -145,10 +145,15 @@ db-prefered-master = {{ prefered_master }}
# First database is the prefered master # First database is the prefered master
db-prefered-master = {{ mariadb_server_list[0] }} db-prefered-master = {{ mariadb_server_list[0] }}
{% endif -%} {% endif -%}
proxysql-servers = {{ ipv4 }} {% if proxy_type == "proxysql" -%}
proxysql-servers-ipv6 = [{{ ip }}] proxysql-servers = {{ proxy_config_dict['ip'] | join(',') }}
proxysql-servers-ipv6 = [{{ proxy_config_dict['ipv6'] | join('],[') }}]
proxysql-partition = {{ proxy_config_dict['partition'] | join(',') }}
proxysql-user = {{ parameter_dict.get("proxysql-user", "external") }}
{% endif -%}
password = ${repman-parameter:password} password = ${repman-parameter:password}
proxysql-partition = ${buildout:directory} proxy-port = {{ proxy_config_dict['port'] }}
proxy-admin-port = {{ proxy_config_dict['admin-port'] }}
receiver-port-list = {{ receiver_port_list | join(',') }} receiver-port-list = {{ receiver_port_list | join(',') }}
enabled-tags = {{ slapparameter_dict.get("tag-list", tag_list) | join(',') }} enabled-tags = {{ slapparameter_dict.get("tag-list", tag_list) | join(',') }}
proxy-tags = {{ parameter_dict.get("proxy-tags", ["pkg", "masterslave", "linux", "noreadwritesplit"]) | join(',') }} proxy-tags = {{ parameter_dict.get("proxy-tags", ["pkg", "masterslave", "linux", "noreadwritesplit"]) | join(',') }}
...@@ -186,81 +191,24 @@ extra-context = ...@@ -186,81 +191,24 @@ extra-context =
context = context =
section parameter_dict {{ name ~ '-cluster-parameter' }} section parameter_dict {{ name ~ '-cluster-parameter' }}
# Donwnload mariadb configuration from repman
[config-proxysql-{{ name }}]
recipe = plone.recipe.command
# if Repman is not started, cannot download config from server
stop-on-error = false
config = ${repman:proxies}/proxysql-{{ name }}.cnf
data = ${repman:proxy-data}/{{ name }}
command =
mkdir -p ${:data} &&
${download-proxy-config:rendered} {{ name }} {{ ipv4 }} {{ '${' ~ name ~ '-cluster-parameter:proxy-admin-port}' }} ${:config}
update-command = ${:command}
[proxysql-{{ name }}-wrapper]
recipe = slapos.cookbook:wrapper
command-line =
{{ proxysql_location }}/bin/proxysql -f
-c ${config-proxysql-{{ name }}:config}
-D ${config-proxysql-{{ name }}:data}
--reload
# -S /tmp/proxysql_admin.sock
wrapper-path = ${directory:controller}/proxysql-{{ name }}
wait-for-files =
${repman:bootstrap}/{{ name }}_bootstrapped
depends =
{{ '${proxysql-' ~ name ~ '-admin-promise:recipe}' }}
{{ '${proxysql-' ~ name ~ '-promise:recipe}' }}
{{ '${proxysql-' ~ name ~ '-ipv6-promise:recipe}' }}
[proxysql-{{ name }}-admin-promise]
<= monitor-promise-base
module = check_port_listening
name = proxysql-{{ name }}-admin-port-listening.py
config-hostname= {{ ipv4 }}
config-port = {{ '${' ~ name ~ '-cluster-parameter:proxy-admin-port}' }}
[proxysql-{{ name }}-promise]
<= monitor-promise-base
module = check_port_listening
name = proxysql-{{ name }}-port-listening.py
config-hostname= {{ ipv4 }}
config-port = {{ '${' ~ name ~ '-cluster-parameter:proxy-port}' }}
[proxysql-{{ name }}-ipv6-promise]
<= monitor-promise-base
module = check_port_listening
name = proxysql-{{ name }}-ipv6-port-listening.py
config-hostname= {{ ip }}
config-port = {{ '${' ~ name ~ '-cluster-parameter:proxy-port}' }}
{% set service_name = "proxysql-" ~ name -%}
{% set proxysql_dict = {"name": service_name, "command": "${" ~ service_name ~ "-wrapper:wrapper-path}",
"stopwaitsecs": 60, "environment": [],
"stdout_logfile": "${repman:proxies-log}/" ~ service_name ~ ".log",
"stderr_logfile": "${repman:proxies-log}/" ~ service_name ~ ".log" } %}
{{ supervisord_lib.supervisord_program(service_name, proxysql_dict) }}
{% do part_list.append("supervisord-" ~ service_name) %}
{% do part_list.append('config-' ~ name) -%}
{% do cluster_list.append("{'name': '" ~ name ~ "', 'host': '" ~ ipv4 ~ "', 'port': '${" ~ name ~ "-cluster-parameter:proxy-admin-port}'}") -%}
{% set publish_database_list = [] -%} {% set publish_database_list = [] -%}
{% set publish_database_v6_list = [] -%} {% set publish_database_v6_list = [] -%}
{% for i in range(0, proxy_amount) -%}
{% set proxy = "request-proxy-" ~ name ~ '-' ~ i -%}
{% for database in database_list -%} {% for database in database_list -%}
{% if database.get('user') -%} {% if database.get('user') -%}
{% do publish_database_list.append("mysql://" ~ database['user'] ~ ":" ~ database['password'] ~ "@" ~ ipv4 ~ ":${" ~ name ~ "-cluster-parameter:proxy-port}/" ~ database['name']) -%} {% do publish_database_list.append("mysql://" ~ database['user'] ~ ":" ~ database['password'] ~ "@${" ~ proxy ~ ":connection-ipv4}:" ~ proxy_config_dict['port'] ~ "/" ~ database['name']) -%}
{% do publish_database_v6_list.append("mysql://" ~ database['user'] ~ ":" ~ database['password'] ~ "@[" ~ ip ~ "]:${" ~ name ~ "-cluster-parameter:proxy-port}/" ~ database['name']) -%} {% do publish_database_v6_list.append("mysql://" ~ database['user'] ~ ":" ~ database['password'] ~ "@[${" ~ proxy ~ ":connection-ipv6}]:" ~ proxy_config_dict['port'] ~ "/" ~ database['name']) -%}
{% else -%} {% else -%}
{% do publish_database_list.append("mysql://" ~ ipv4 ~ ":${" ~ name ~ "-cluster-parameter:proxy-port}/" ~ database['name']) -%} {% do publish_database_list.append("mysql://${" ~ proxy ~ ":connection-ipv4}:" ~ proxy_config_dict['port'] ~ "/" ~ database['name']) -%}
{% do publish_database_v6_list.append("mysql://[" ~ ip ~ "]:${" ~ name ~ "-cluster-parameter:proxy-port}/" ~ database['name']) -%} {% do publish_database_v6_list.append("mysql://[${" ~ proxy ~ ":connection-ipv6}]:" ~ proxy_config_dict['port'] ~ "/" ~ database['name']) -%}
{% endif -%} {% endif -%}
{% endfor -%} {% endfor -%}
{% endfor -%}
{% do publish_dict.__setitem__(name ~ '-database-list', "!py!['" ~ publish_database_list | join("', '") ~ "']") -%} {% do part_list.append('config-' ~ name) -%}
{% do publish_dict.__setitem__(name ~ '-database-list-v6', "!py!['" ~ publish_database_v6_list | join("', '") ~ "']") -%} {% do publish_dict.__setitem__(name ~ '-db-list', "!py!['" ~ publish_database_list | join("', '") ~ "']") -%}
{% do publish_dict.__setitem__(name ~ '-db-list-v6', "!py!['" ~ publish_database_v6_list | join("', '") ~ "']") -%}
{% endfor -%} {% endfor -%}
[slap-configuration] [slap-configuration]
...@@ -286,11 +234,11 @@ etc = ${directory:etc}/repman ...@@ -286,11 +234,11 @@ etc = ${directory:etc}/repman
data-dir = ${directory:var}/lib data-dir = ${directory:var}/lib
root-dir = ${directory:srv}/repman root-dir = ${directory:srv}/repman
clusters = ${:etc}/cluster.d clusters = ${:etc}/cluster.d
proxies = ${:etc}/proxy #proxies = ${:etc}/proxy
proxy-data = ${:data-dir}/proxy proxy-data = ${:data-dir}/proxy
config-tmp = ${directory:tmp}/config config-tmp = ${directory:tmp}/config
bootstrap = ${:etc}/bootstrap bootstrap = ${:etc}/bootstrap
proxies-log = ${directory:log}/proxy #proxies-log = ${directory:log}/proxy
[nginx-parameter] [nginx-parameter]
ipv6 = ${instance-parameter:ipv6-random} ipv6 = ${instance-parameter:ipv6-random}
...@@ -520,28 +468,6 @@ name = check_repman_backend.py ...@@ -520,28 +468,6 @@ name = check_repman_backend.py
config-url = ${nginx-parameter:backend-ssl-url} config-url = ${nginx-parameter:backend-ssl-url}
config-check-secure = 1 config-check-secure = 1
[template-proxysql-need-stop-start]
recipe = slapos.recipe.template:jinja2
rendered = ${directory:bin}/proxysql_check_stop_start
template = {{ template_proxy_need_stopstart }}
mode = 755
cluster-list = !py![{{ cluster_list | join(', ') }}]
context =
key proxysql_controller {{proxysql_controller}}-bin:wrapper-path
key repman_url nginx-parameter:backend-url
key get_proxy_config download-proxy-config:rendered
key cluster_list :cluster-list
raw jq_bin {{ jq_bin }}
raw bash_bin {{ bash_bin }}
raw curl_bin {{ curl_bin }}
[proxy-need-stop-start]
recipe = slapos.cookbook:cron.d
cron-entries = ${cron:cron-entries}
name = proxysql-need-stop-start
frequency = * * * * *
command = ${template-proxysql-need-stop-start:rendered}
############################# #############################
# #
# Deploy replication-manager instance # Deploy replication-manager instance
...@@ -558,7 +484,6 @@ parts = ...@@ -558,7 +484,6 @@ parts =
publish-connection-parameter publish-connection-parameter
repman-frontend-promise repman-frontend-promise
repman-backend-promise repman-backend-promise
proxy-need-stop-start
# Complete parts with sections # Complete parts with sections
{{ part_list | join('\n ') }} {{ part_list | join('\n ') }}
......
...@@ -11,6 +11,7 @@ recipe = slapos.cookbook:switch-softwaretype ...@@ -11,6 +11,7 @@ recipe = slapos.cookbook:switch-softwaretype
default = template-instance-repman.cfg:rendered default = template-instance-repman.cfg:rendered
RootSoftwareInstance = ${:default} RootSoftwareInstance = ${:default}
mariadb = template-instance-mariadb.cfg:rendered mariadb = template-instance-mariadb.cfg:rendered
proxydb = template-instance-proxydb-cfg:rendered
[slap-configuration] [slap-configuration]
...@@ -102,4 +103,13 @@ filename = instance-mariadb.cfg ...@@ -102,4 +103,13 @@ filename = instance-mariadb.cfg
extra-context = extra-context =
section parameter_dict template-mariadb-parameters section parameter_dict template-mariadb-parameters
[template-proxydb-parameters]
[template-instance-proxydb-cfg]
<= jinja2-template-base
template = {{ template_proxydb_cfg }}
filename = instance-proxydb.cfg
extra-context =
section parameter_dict template-proxydb-parameters
raw proxysql_location {{ proxysql_location }}
raw template_proxy_need_stopstart {{ proxy_need_stop_start_template }}
...@@ -79,6 +79,7 @@ context = ...@@ -79,6 +79,7 @@ context =
key template_init_root_sql mariadb-init-root-sql:target key template_init_root_sql mariadb-init-root-sql:target
key template_init_root_wrapper init-root-wrapper-in:target key template_init_root_wrapper init-root-wrapper-in:target
key template_repman_cfg instance-repman.cfg:target key template_repman_cfg instance-repman.cfg:target
key template_proxydb_cfg instance-proxy.cfg:target
key unixodbc_location unixodbc:location key unixodbc_location unixodbc:location
key sysbench_location sysbench:location key sysbench_location sysbench:location
key proxysql_location proxysql:location key proxysql_location proxysql:location
...@@ -106,6 +107,9 @@ destination = ${buildout:directory}/${:_buildout_section_name_} ...@@ -106,6 +107,9 @@ destination = ${buildout:directory}/${:_buildout_section_name_}
[instance-repman.cfg] [instance-repman.cfg]
<= download-file <= download-file
[instance-proxy.cfg]
<= download-file
[repman-manager-sh.in] [repman-manager-sh.in]
<= download-file <= download-file
......
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