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
Ivan Tyagov
slapos
Commits
3ebe4aff
Commit
3ebe4aff
authored
Jul 07, 2021
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
repman: publish slave database list
parent
0596a4ad
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
8 deletions
+57
-8
software/repman/buildout.hash.cfg
software/repman/buildout.hash.cfg
+1
-1
software/repman/instance-repman-slave-input-schema.json
software/repman/instance-repman-slave-input-schema.json
+25
-0
software/repman/instance-repman.cfg.jinja2.in
software/repman/instance-repman.cfg.jinja2.in
+22
-7
software/repman/software.cfg.json
software/repman/software.cfg.json
+9
-0
No files found.
software/repman/buildout.hash.cfg
View file @
3ebe4aff
...
...
@@ -18,7 +18,7 @@ md5sum = 1812befaf367f30a1fe469ccf95dae31
[instance-repman.cfg]
_update_hash_filename_ = instance-repman.cfg.jinja2.in
md5sum =
effd642104d1323e0d8a111546331905
md5sum =
b65e982e82dbef25cc71c12f91185e03
[config-toml.in]
_update_hash_filename_ = templates/config.toml.in
...
...
software/repman/instance-repman-slave-input-schema.json
0 → 100644
View file @
3ebe4aff
{
"$schema"
:
"http://json-schema.org/draft-04/schema"
,
"properties"
:
{
"db_name"
:
{
"description"
:
"Database Name. If empty, name is autogenerated from slave reference."
,
"title"
:
"Database Name"
,
"type"
:
"string"
,
"default"
:
""
},
"db_user"
:
{
"description"
:
"Database User"
,
"title"
:
"Database User"
,
"type"
:
"string"
,
"default"
:
"user"
},
"db_password"
:
{
"description"
:
"Database Password. If no password set, a password will be generated"
,
"title"
:
"Database Password"
,
"type"
:
"string"
,
"default"
:
""
}
},
"title"
:
"Input Parameters"
,
"type"
:
"object"
}
software/repman/instance-repman.cfg.jinja2.in
View file @
3ebe4aff
...
...
@@ -10,6 +10,7 @@
{% set cluster_list = [] -%}
{% set tag_list = ["gtidstrict", "bind", "pkg", "innodb", "noquerycache", "slow", "pfs", "linux", "readonly", "diskmonitor", "sqlerror", "compressbinlog", "bm4ci", "mroonga", "utctime", "readcommitted", "nohandshake"] -%}
{% set frontend_parameter_dict = slapparameter_dict.get('slave-frontend', {}) -%}
{% set dabase_slave_list = [] -%}
[directory]
recipe = slapos.cookbook:mkdirectory
...
...
@@ -58,6 +59,20 @@ template = inline:#!{{ bash_bin }}
rendered = ${directory:bin}/update-proxysql-config
mode = 755
{% set db_name_list = [] -%}
[database-slave-information]
{% for instance_dict in slave_instance_list -%}
{% set slave_dict = {
'name': instance_dict.get('db_name', instance_dict['db_name'].replace('-', '_').lower()),
'user': instance_dict.get('db_user', 'user'),
'password': instance_dict.get('db_password'),
'slave_reference': instance_dict['slave_reference']
} -%}
{{ slave_dict['name'] }} = {{ dumps(slave_dict) }}
{% do dabase_slave_list.append(slave_dict) -%}
{% do db_name_list.append(slave_dict['name']) -%}
{% endfor %}
{% do mariadb_dict.__setitem__('computer-memory-percent-threshold', 80) -%}
{% set default_parameter_dict = {"cluster1": {"name": "cluster1", "db-prefered-master": "",
"database-amount": 2, "proxysql-user": "external",
...
...
@@ -78,7 +93,6 @@ mode = 755
{% set section = 'request-mariadb-' ~ i -%}
{% set dbname = 'Mariadb-' ~ i -%}
# {{ dumps(slave_instance_list) }}
[{{ section }}]
<= request-common
...
...
@@ -97,7 +111,7 @@ config-repman-url = ${nginx-parameter:backend-url}
config-repman-secure-url = ${nginx-parameter:backend-ssl-url}
config-cluster = {{ name }}
config-name = {{ dbname }}
config-database-list = {{ dumps(
slave_instanc
e_list) }}
config-database-list = {{ dumps(
dabase_slav
e_list) }}
return =
database-host
receiver-port
...
...
@@ -271,11 +285,6 @@ context =
{% do part_list.append(name ~ '-publish-slave-information') -%}
{% endfor -%}
[database-slave-information]
{% for slave_dict in slave_instance_list -%}
{{ slave_dict['name'] }} = {{ dumps(slave_dict) }}
{% endfor %}
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration
computer = ${slap-connection:computer-id}
...
...
@@ -475,12 +484,17 @@ name = nginx
log = ${nginx-parameter:access-log} ${nginx-parameter:error-log}
post = kill -USR1 $(cat ${nginx-parameter:pid-file})
{% set db_list = db_name_list | join(' ') -%}
[db-slave-requested]
name = {{ db_list }}
[publish-early]
recipe = slapos.cookbook:publish-early
-init =
monitor-password monitor-htpasswd:passwd
db-root-password gen-root-password:passwd
repman-password repman-password:passwd
database-list db-slave-requested:name
[publish-connection-parameter]
<= monitor-publish
...
...
@@ -489,6 +503,7 @@ recipe = slapos.cookbook:publish
backend-url = ${nginx-parameter:backend-ssl-url}
url = ${repman-frontend:connection-secure_access}
username = ${repman-parameter:username}
database-list = {{ db_list }}
{% for name, value in publish_dict.items() -%}
{{ name }} = {{ value }}
{% endfor %}
...
...
software/repman/software.cfg.json
View file @
3ebe4aff
...
...
@@ -10,6 +10,15 @@
"request"
:
"instance-repman-input-schema.json"
,
"response"
:
"instance-repman-output-schema.json"
,
"index"
:
0
},
"default-slave"
:
{
"title"
:
"Replication Manager Database"
,
"description"
:
"Replication Manager Database"
,
"software-type"
:
"default"
,
"request"
:
"instance-repman-slave-input-schema.json"
,
"response"
:
"instance-repman-output-schema.json"
,
"shared"
:
true
,
"index"
:
1
}
}
}
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