Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
slapos
Commits
657570f9
Commit
657570f9
authored
Jul 06, 2020
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
repman: fix add support for multiple SQL proxy
parent
a27c7329
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
19 deletions
+57
-19
software/repman/buildout.hash.cfg
software/repman/buildout.hash.cfg
+2
-2
software/repman/instance-proxy.cfg.jinja2.in
software/repman/instance-proxy.cfg.jinja2.in
+17
-7
software/repman/instance-repman-input-schema.json
software/repman/instance-repman-input-schema.json
+16
-2
software/repman/instance-repman.cfg.jinja2.in
software/repman/instance-repman.cfg.jinja2.in
+22
-8
No files found.
software/repman/buildout.hash.cfg
View file @
657570f9
...
...
@@ -18,11 +18,11 @@ md5sum = b6798777834fdc4789591b9a53048e9c
[instance-repman.cfg]
_update_hash_filename_ = instance-repman.cfg.jinja2.in
md5sum =
e89737ecaa9308baa792d01f8f130667
md5sum =
dc55574a7a7374c7e2d2a8173925b213
[instance-proxy.cfg]
_update_hash_filename_ = instance-proxy.cfg.jinja2.in
md5sum =
a8560b62fa3e8907a9483bb55ce02ebf
md5sum =
4a01dc6efaef2caa780024a48339d6a4
[config-toml.in]
_update_hash_filename_ = templates/config.toml.in
...
...
software/repman/instance-proxy.cfg.jinja2.in
View file @
657570f9
{% set publish_dict = {} -%}
{% set part_list = [] -%}
{% set ip = (ipv6_set | list)[0] -%}
{% set ip
v6
= (ipv6_set | list)[0] -%}
{% set ipv4 = (ipv4_set | list)[0] -%}
{% set name = slapparameter_dict['proxy-name'] -%}
{% set monitor_password = slapparameter_dict['monitor-passwd'] -%}
...
...
@@ -8,8 +8,16 @@
{% set proxy_port = slapparameter_dict.get('proxy-port', 6032) -%}
{% set proxy_admin_port = slapparameter_dict.get('proxy-admin-port', 7032) -%}
{% set cluster_list = [] -%}
{% set use_ipv6 = slapparameter_dict.get('use-ipv6', False) -%}
{% set host = ipv4 -%}
{% set ip = ipv4 -%}
{% do cluster_list.append({'name':name, 'host': ipv4, 'port': proxy_admin_port}) -%}
{% if use_ipv6 -%}
{% set host = '[' ~ ipv6 ~ ']' -%}
{% set ip = ipv6 -%}
{% endif -%}
{% do cluster_list.append({'name':name, 'host': host, 'port': proxy_admin_port}) -%}
[directory]
recipe = slapos.cookbook:mkdirectory
...
...
@@ -60,7 +68,7 @@ stop-on-error = false
config = ${directory:etc}/proxysql.cnf
data = ${directory:data}
command =
${download-proxy-config:rendered} {{ name }} {{
ipv4
}} {{ proxy_admin_port }} ${:config}
${download-proxy-config:rendered} {{ name }} {{
host
}} {{ proxy_admin_port }} ${:config}
update-command = ${:command}
[proxysql-wrapper]
...
...
@@ -78,28 +86,30 @@ wait-for-files =
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= {{ ip
v4
}}
config-hostname= {{ ip }}
config-port = {{ proxy_admin_port }}
[proxysql-promise]
<= monitor-promise-base
module = check_port_listening
name = proxysql-port-listening.py
config-hostname= {{ ip
v4
}}
config-hostname= {{ ip }}
config-port = {{ proxy_port }}
{% if not use_ipv6 -%}
[proxysql-ipv6-promise]
<= monitor-promise-base
module = check_port_listening
name = proxysql-ipv6-port-listening.py
config-hostname= {{ ip }}
config-port = {{ proxy_port }}
{% do part_list.append("proxysql-ipv6-promise") -%}
{% endif -%}
{% set service_name = "proxy-" ~ name -%}
{% set proxysql_dict = {"name": service_name, "command": "${proxysql-wrapper:wrapper-path}",
...
...
@@ -125,7 +135,7 @@ recipe = slapos.cookbook:publish.serialised
proxy-port = {{ proxy_port }}
proxy-admin-port = {{ proxy_admin_port }}
ipv4 = {{ ipv4 }}
ipv6 = {{ ip }}
ipv6 = {{ ip
v6
}}
partition-path = ${buildout:directory}
...
...
software/repman/instance-repman-input-schema.json
View file @
657570f9
...
...
@@ -157,7 +157,8 @@
"description"
:
"Database amount to deploy with this cluster. Minimal amount is 2 required to enable replication."
,
"type"
:
"integer"
,
"default"
:
2
,
"minimum"
:
2
"minimum"
:
2
,
"maximum"
:
4
},
"-sla-0-computer_guid"
:
{
"title"
:
"Prefered Master Computer Guid"
,
...
...
@@ -236,7 +237,20 @@
"description"
:
"Number of Proxy instances de deploy"
,
"type"
:
"integer"
,
"default"
:
1
,
"minimum"
:
1
"minimum"
:
1
,
"maximum"
:
3
},
"-sla-proxy1-computer_guid"
:
{
"title"
:
"Second SQL Proxy Computer Guid"
,
"description"
:
"Computer Guid for the second SQL Proxy instance. The first proxy instance is requested on root partition."
,
"type"
:
"string"
,
"default"
:
""
},
"-sla-proxy2-computer_guid"
:
{
"title"
:
"Third Proxy Computer Guid"
,
"description"
:
"Computer Guid for the third SQL Proxy instance. The first proxy instance is requested on root partition."
,
"type"
:
"string"
,
"default"
:
""
},
"proxy-cpu-cores"
:
{
"title"
:
"Proxy Cpu cores"
,
...
...
software/repman/instance-repman.cfg.jinja2.in
View file @
657570f9
...
...
@@ -101,7 +101,18 @@ return =
<= request-common
software-type = proxydb
name = {{ proxy_name }}
#sla-computer_guid =
{% if i == 0 -%}
{% do proxy_config_dict['ip'].append('${' ~ section ~ ':connection-ipv4}') -%}
{# set proxysql-servers-ipv6 to also allow access proxy via ipv6 -#}
{% do proxy_config_dict['ipv6'].append('${' ~ section ~ ':connection-ipv6}') -%}
sla-computer_guid = ${slap-connection:computer-id}
{% else -%}
sla-computer_guid = {{ dumps(parameter_dict.get('-sla-proxy' ~ i ~'-computer_guid', '')) }}
# This proxy can be on different machine with repman, so we enforce use IPv6
{% do proxy_config_dict['ip'].append("[${" ~ section ~ ":connection-ipv6}]") -%}
{% do proxy_config_dict['ipv6'].append('${' ~ section ~ ':connection-ipv6}') -%}
config-use-ipv6 = True
{% endif -%}
config-monitor-passwd = ${publish-early:monitor-password}
config-repman-url = ${nginx-parameter:backend-url}
config-repman-secure-url = ${nginx-parameter:backend-ssl-url}
...
...
@@ -110,15 +121,13 @@ 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 =
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}') -%}
...
...
@@ -197,18 +206,23 @@ context =
{% set proxy = "request-proxy-" ~ name ~ '-' ~ i -%}
{% for database in database_list -%}
{% if database.get('user') -%}
{% do publish_database_list.append("mysql://" ~ database['user'] ~ ":" ~ database['password'] ~ "@${" ~ proxy ~ ":connection-ipv4}:" ~ proxy_config_dict['port'] ~ "/" ~ database['name']) -%}
{# first proxy which is deployed on repman partition can use ipv4 connexion string -#}
{% if i == 0 -%}
{% do publish_database_list.append("mysql://" ~ database['user'] ~ ":" ~ database['password'] ~ "@${" ~ proxy ~ ":connection-ipv4}:" ~ proxy_config_dict['port'] ~ "/" ~ database['name']) -%}
{% endif -%}
{% do publish_database_v6_list.append("mysql://" ~ database['user'] ~ ":" ~ database['password'] ~ "@[${" ~ proxy ~ ":connection-ipv6}]:" ~ proxy_config_dict['port'] ~ "/" ~ database['name']) -%}
{% else -%}
{% do publish_database_list.append("mysql://${" ~ proxy ~ ":connection-ipv4}:" ~ proxy_config_dict['port'] ~ "/" ~ database['name']) -%}
{% if i == 0 -%}
{% do publish_database_list.append("mysql://${" ~ proxy ~ ":connection-ipv4}:" ~ proxy_config_dict['port'] ~ "/" ~ database['name']) -%}
{% endif -%}
{% do publish_database_v6_list.append("mysql://[${" ~ proxy ~ ":connection-ipv6}]:" ~ proxy_config_dict['port'] ~ "/" ~ database['name']) -%}
{% endif -%}
{% endfor -%}
{% endfor -%}
{% do part_list.append('config-' ~ name) -%}
{% 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("', '") ~ "']") -%}
{% do publish_dict.__setitem__(name ~ '-db-list
-ipv4
', "!py!['" ~ publish_database_list | join("', '") ~ "']") -%}
{% do publish_dict.__setitem__(name ~ '-db-list-
ip
v6', "!py!['" ~ publish_database_v6_list | join("', '") ~ "']") -%}
{% endfor -%}
[slap-configuration]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment