instance-repman.cfg.jinja2.in 20.8 KB
Newer Older
1 2 3 4 5
{% set publish_dict = {} -%}
{% set part_list = [] -%}
{% set monitor_base_url_dict = {} -%}
{% set mariadb_dict = {} -%}
{% set mariadb_server_list = [] -%}
6
{% set receiver_port_list = [] -%}
7 8 9
{% set mariadb_path_list = [] -%}
{% set ip = (ipv6_set | list)[0] -%}
{% set ipv4 = (ipv4_set | list)[0] -%}
10
{% set cluster_list = [] -%}
11
{% set tag_list = ["gtidstrict", "bind", "pkg", "innodb", "noquerycache", "slow", "pfs", "linux", "readonly", "diskmonitor", "sqlerror", "compressbinlog", "bm4ci", "mroonga", "utctime", "readcommitted", "nohandshake"] -%}
12
{% set frontend_parameter_dict = slapparameter_dict.get('slave-frontend', {}) -%}
13

14 15 16 17 18 19
[directory]
recipe = slapos.cookbook:mkdirectory
home = ${buildout:directory}
etc = ${:home}/etc
var = ${:home}/var
run = ${:var}/run
20
scripts = ${:etc}/run
21
service = ${:etc}/service
22
controller = ${:etc}/controller
23 24 25 26
promise = ${:etc}/promise
log = ${:var}/log
data = ${:var}/lib
nginx-prefix = ${:var}/nginx
27 28
tmp = ${:home}/tmp

29
{% import "supervisord_lib" as supervisord_lib with context %}
30
{% set proxysql_controller = "proxysql-ctl" -%}
31
{{ supervisord_lib.supervisord(proxysql_controller, buildout_bin_directory, supervisord_conf, use_service_hash=False) }}
32
{% do part_list.append("supervisord-proxysql-ctl") -%}
33 34 35 36 37 38 39 40 41 42

[request-common]
recipe = slapos.cookbook:request.serialised
software-url = ${slap-connection:software-release-url}
server-url = ${slap-connection:server-url}
key-file = ${slap-connection:key-file}
cert-file = ${slap-connection:cert-file}
computer-id = ${slap-connection:computer-id}
partition-id = ${slap-connection:partition-id}

43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
[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
60

61
{% do mariadb_dict.__setitem__('computer-memory-percent-threshold', 80) -%}
62
{% set default_parameter_dict = {"cluster1": {"name": "cluster1", "db-prefered-master": "",
63
  "database-amount": 2, "proxysql-user": "external",
64
  "logical-backup-cron": "0 21 * * *", "physical-backup-cron": "0 1 * * *"}} -%}
65 66 67 68
{% for name, parameter_dict in slapparameter_dict.get('repman-cluster-dict', default_parameter_dict).items() -%}

{% 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)) -%}
69

70
{% set database_list = parameter_dict.get('database-list', [{'name': 'repdb', 'user': 'user', 'password': 'insecure'}]) -%}
71
# Request mariadb instances
72 73 74 75 76 77
{% set db_amount = parameter_dict.get('database-amount', 2) -%}
{% if db_amount < 2 -%}
{% set db_amount = 2 -%}
{% endif -%}

{% for i in range(0, db_amount) -%}
78 79
{% do mariadb_dict.__setitem__('tcp-port', 2099 + (i * 100)) -%}
{% set section = 'request-mariadb-' ~ i -%}
80
{% set dbname = 'Mariadb-' ~ i -%}
81 82 83 84

[{{ section }}]
<= request-common
software-type = mariadb
85
name = {{ dbname }}
86
sla-computer_guid = {{ dumps(parameter_dict.get('-sla-' ~ i ~'-computer_guid', '')) }}
87 88 89 90
{% for key, value in mariadb_dict.items() -%}
config-{{ key }} = {{ dumps(value) }}
{% endfor -%}
config-monitor-passwd = ${publish-early:monitor-password}
91
config-root-password = ${publish-early:db-root-password}
92
config-repman-user = ${repman-parameter:username}
93
config-heartbeat-user = ${repman-parameter:heartbeat-user}
94
#config-repman-passwd =  ${repman-parameter:password}
95
config-repman-url = ${nginx-parameter:backend-url}
96 97 98
config-repman-secure-url = ${nginx-parameter:backend-ssl-url}
config-cluster = {{ name }}
config-name = {{ dbname }}
99
config-database-list = {{ dumps(database_list) }}
100 101
return = 
  database-host
102
  receiver-port
103 104 105 106 107
  monitor-base-url
  partition-path

{% do part_list.append(section) -%}
{% do mariadb_server_list.append('${' ~ section ~ ':connection-database-host}') -%}
108
{% do receiver_port_list.append('${' ~ section ~ ':connection-receiver-port}') -%}
109 110 111 112 113 114
{% do mariadb_path_list.append('${' ~ section ~ ':connection-partition-path}') -%}
{% do monitor_base_url_dict.__setitem__('mariadb' ~ i, '${' ~ section ~ ':connection-monitor-base-url}') -%}

{% endfor -%}

# Manage Replication Manager clusters
115 116 117 118 119 120 121 122 123 124 125 126
[{{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

127
{% set prefered_master = parameter_dict.get("db-prefered-master") -%}
128 129
[{{ name ~ '-cluster-parameter' }}]
{% for key, value in parameter_dict.items() -%}
130
{{ key }} = {{ value }}
131
{% endfor -%}
132
proxysql-user = {{ parameter_dict.get("proxysql-user", "external") }}
133 134
proxy-port = {{ '${' ~ name ~ '-port:port}' }}
proxy-admin-port = {{ '${' ~ name ~ '-admin-port:port}' }}
135 136
db-user = repman
db-password = ${publish-early:db-root-password}
137
db-list = {{ mariadb_server_list | join(',') }}
138 139 140

heartbeat-user = ${repman-parameter:heartbeat-user}
heartbeat-password = ${publish-early:db-root-password}
141 142 143 144 145 146 147 148
partition-list = {{ mariadb_path_list | join(',') }}
{% if prefered_master -%}
db-prefered-master = {{ prefered_master }}
{% else -%}
# First database is the prefered master
db-prefered-master = {{ mariadb_server_list[0] }}
{% endif -%}
proxysql-servers = {{ ipv4 }}
149
proxysql-servers-ipv6 = [{{ ip }}]
150 151
password = ${repman-parameter:password}
proxysql-partition = ${buildout:directory}
152
receiver-port-list = {{ receiver_port_list | join(',') }}
153 154
enabled-tags = {{ slapparameter_dict.get("tag-list", tag_list) | join(',') }}
proxy-tags = {{ parameter_dict.get("proxy-tags", ["pkg", "masterslave", "linux", "noreadwritesplit"]) | join(',') }}
155
logical-backup-cron = {{ parameter_dict.get("logical-backup-cron", "0 22 * * *") }}
156 157 158 159 160 161
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) }}
db-cpu-cores = {{ parameter_dict.get("db-cpu-cores", 2) }}
db-disk-iops = {{ parameter_dict.get("db-disk-iops", 300) }}
db-memory = {{ parameter_dict.get("db-memory", 256) }}
162 163
db-memory-shared-pct = {{ parameter_dict.get("db-memory-shared-pct", ["threads:16", "innodb:60", "myisam:10", "aria:10", "rocksdb:1", "tokudb:1", "s3:1", "archive:1", "querycache:0"]) | join(',') }}
db-memory-threaded-pct = {{ parameter_dict.get("db-memory-threaded-pct", ["tmp:70", "join:20", "sort:10"]) | join(',') }}
164
# failover
165
failover-mode = {{ parameter_dict.get('failover-mode', 'manual') }}
166 167 168 169 170 171 172 173 174 175 176 177 178 179
failover-limit = {{ parameter_dict.get('failover-limit', 5) }}
failover-falsepositive-heartbeat = {{ parameter_dict.get('failover-falsepositive-heartbeat', True) }}
failover-falsepositive-heartbeat-timeout = {{ parameter_dict.get('failover-falsepositive-heartbeat-timeout', 3) }}
failover-falsepositive-ping-counter = {{ parameter_dict.get('failover-falsepositive-ping-counter', 5) }}
failover-max-slave-delay = {{ parameter_dict.get('failover-max-slave-delay', 30) }}
failover-readonly-state = {{ parameter_dict.get('failover-readonly-state', True) }}
failover-restart-unsafe = {{ parameter_dict.get('failover-restart-unsafe', False) }}
failover-time-limit = {{ parameter_dict.get('failover-time-limit', 0) }}
#switchover
switchover-at-equal-gtid = {{ parameter_dict.get('switchover-at-equal-gtid', False) }}
switchover-slave-wait-catch = {{ parameter_dict.get('switchover-slave-wait-catch', True) }}
switchover-wait-kill = {{ parameter_dict.get('switchover-wait-kill', 5000) }}
switchover-wait-trx = {{ parameter_dict.get('switchover-wait-trx', 10) }}
switchover-wait-write-query = {{ parameter_dict.get('switchover-wait-write-query', 10) }}
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197

[{{ 'config-' ~ name }}]
recipe = slapos.recipe.template:jinja2
template = {{ config_cluster_toml_in }}
rendered = ${repman:clusters}/config-{{ name }}.toml
extra-context =
context =
  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} &&
198
  ${download-proxy-config:rendered} {{ name }} {{ ipv4 }} {{ '${' ~ name ~ '-cluster-parameter:proxy-admin-port}' }} ${:config}
199 200
update-command = ${:command}

201
[proxysql-{{ name }}-wrapper]
202 203 204 205 206 207 208
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
209
wrapper-path = ${directory:controller}/proxysql-{{ name }}
210 211
wait-for-files =
  ${repman:bootstrap}/{{ name }}_bootstrapped
212 213 214
depends =
  {{ '${proxysql-' ~ name ~ '-admin-promise:recipe}' }}
  {{ '${proxysql-' ~ name ~ '-promise:recipe}' }}
215
  {{ '${proxysql-' ~ name ~ '-ipv6-promise:recipe}' }}
216 217 218 219

[proxysql-{{ name }}-admin-promise]
<= monitor-promise-base
module = check_port_listening
220
name = proxysql-{{ name }}-admin-port-listening.py
221 222 223 224 225 226
config-hostname=  {{ ipv4 }}
config-port = {{ '${' ~ name ~ '-cluster-parameter:proxy-admin-port}' }}

[proxysql-{{ name }}-promise]
<= monitor-promise-base
module = check_port_listening
227
name = proxysql-{{ name }}-port-listening.py
228 229
config-hostname=  {{ ipv4 }}
config-port = {{ '${' ~ name ~ '-cluster-parameter:proxy-port}' }}
230

231 232 233 234 235 236 237
[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}' }}

238 239
{% set service_name = "proxysql-" ~ name -%}
{% set proxysql_dict = {"name": service_name, "command": "${" ~ service_name ~ "-wrapper:wrapper-path}",
240 241 242
  "stopwaitsecs": 60, "environment": [],
  "stdout_logfile": "${repman:proxies-log}/" ~ service_name ~ ".log",
  "stderr_logfile": "${repman:proxies-log}/" ~ service_name ~ ".log" } %}
243

244 245
{{ supervisord_lib.supervisord_program(service_name, proxysql_dict) }}
{% do part_list.append("supervisord-" ~ service_name) %}
246

247
{% do part_list.append('config-' ~ name) -%}
248
{% do cluster_list.append("{'name': '" ~ name ~ "', 'host': '" ~ ipv4 ~ "', 'port': '${" ~ name ~ "-cluster-parameter:proxy-admin-port}'}") -%}
249 250

{% set publish_database_list = [] -%}
251
{% set publish_database_v6_list = [] -%}
252 253 254
{% for database in database_list -%}
{%   if database.get('user') -%}
{%     do publish_database_list.append("mysql://" ~ database['user'] ~ ":" ~ database['password'] ~ "@" ~ ipv4 ~ ":${" ~ name ~ "-cluster-parameter:proxy-port}/" ~ database['name']) -%}
255
{%     do publish_database_v6_list.append("mysql://" ~ database['user'] ~ ":" ~ database['password'] ~ "@[" ~ ip ~ "]:${" ~ name ~ "-cluster-parameter:proxy-port}/" ~ database['name']) -%}
256 257
{%   else -%}
{%     do publish_database_list.append("mysql://" ~ ipv4 ~ ":${" ~ name ~ "-cluster-parameter:proxy-port}/" ~ database['name']) -%}
258
{%     do publish_database_v6_list.append("mysql://[" ~ ip ~ "]:${" ~ name ~ "-cluster-parameter:proxy-port}/" ~ database['name']) -%}
259 260 261 262
{%   endif -%}
{% endfor -%}

{% do publish_dict.__setitem__(name ~ '-database-list', "!py!['" ~ publish_database_list | join("', '") ~ "']") -%}
263
{% do publish_dict.__setitem__(name ~ '-database-list-v6', "!py!['" ~ publish_database_v6_list | join("', '") ~ "']") -%}
264
{% endfor -%}
265 266 267 268 269 270 271 272 273 274 275 276

[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}

[instance-parameter]
<= slap-configuration
# repman monitor seems to use a fixed port
277 278 279 280
repman-secure-port = 10005
repman-port = 10001
nginx-ssl-port  = 10006
nginx-port  = 10007
281 282 283 284 285 286 287


[repman]
recipe   = slapos.cookbook:mkdirectory
etc      = ${directory:etc}/repman
data-dir = ${directory:var}/lib
root-dir = ${directory:srv}/repman
288 289 290 291 292
clusters = ${:etc}/cluster.d
proxies  = ${:etc}/proxy
proxy-data = ${:data-dir}/proxy
config-tmp = ${directory:tmp}/config
bootstrap = ${:etc}/bootstrap
293
proxies-log = ${directory:log}/proxy
294 295 296 297

[nginx-parameter]
ipv6 = ${instance-parameter:ipv6-random}
port = ${instance-parameter:nginx-port}
298
ssl-port = ${instance-parameter:nginx-ssl-port}
299 300 301 302 303
ssl-certificate = ${ca-nginx:cert-file}
ssl-key = ${ca-nginx:key-file}
pid-file = ${directory:run}/nginx.pid
access-log = ${directory:log}/nginx_access.log
error-log = ${directory:log}/nginx_error.log
304 305
repman-secure-url = https://${repman-parameter:ipv4}:${repman-parameter:secure-port}
repman-url = http://${repman-parameter:ipv4}:${repman-parameter:port}
306
config-file = ${directory:etc}/nginx.conf
307 308
backend-ssl-url = https://[${:ipv6}]:${:ssl-port}
backend-url = http://[${:ipv6}]:${:port}
309 310 311 312 313

[repman-password]
recipe = slapos.cookbook:generate.password
bytes = 12

314 315 316 317
[gen-root-password]
recipe = slapos.cookbook:generate.password
bytes = 12

318 319 320 321
[repman-parameter]
log = ${directory:log}/repman.log
http-root = ${repman:root-dir}/dashboard
share-dir = ${repman:root-dir}/share
322
secure-port = ${instance-parameter:repman-secure-port}
323 324 325
port = ${instance-parameter:repman-port}
ipv4 = ${instance-parameter:ipv4-random}
username = admin
326
heartbeat-user = heartbeat
327
password = ${publish-early:repman-password}
328
cluster-d = ${repman:clusters}
329 330
autorejoin = {{ slapparameter_dict.get("autorejoin", True) }}
autoseed = {{ slapparameter_dict.get("autoseed", True) }}
331 332 333 334 335 336
mysql-bin-dir = {{ mariadb_location }}/bin
mysqlbinlog-path = {{ mariadb_location }}/bin/mysqlbinlog
mysqlclient-path = {{ mariadb_location }}/bin/mysql
mysqldump-path = {{ mariadb_location }}/bin/mysqldump
haproxy-bin   = {{ haproxy_location }}/sbin/haproxy
sysbench-bin  = {{ sysbench_location }}/bin/sysbench
337
restic-bin    = {{ restic_bin_location }}
338 339

mail-from = {{ slapparameter_dict.get("mail-from", "mrm@localhost") }}
340 341
mail-smtp-addr = {{ slapparameter_dict.get("mail-smtp-addr", "localhost") }}
mail-smtp-port = {{ slapparameter_dict.get("mail-smtp-port", "25") }}
342 343 344
mail-smtp-password = {{ slapparameter_dict.get("mail-smtp-password", "") }}
mail-smtp-user = {{ slapparameter_dict.get("mail-smtp-user", "") }}
mail-to = {{ slapparameter_dict.get("mail-to", "") }}
345 346 347

http-session-lifetime = {{ slapparameter_dict.get("http-session-lifetime", 86400) }}
http-refresh-interval = {{ slapparameter_dict.get("http-refresh-interval", 4) }}
348 349 350 351

[repman-config-folder]
recipe = plone.recipe.command
repman-location = {{ repman_src_location }}
352
command =
353
  cd ${:repman-location}
354 355
  {{ rsync_location }}/bin/rsync -av share ${repman:root-dir}/
  {{ rsync_location }}/bin/rsync -av  dashboard ${repman:root-dir}/
356

357
update-command = ${:command}
358

359 360 361
[replication-manager-reload]
recipe = slapos.recipe.template:jinja2
template = {{ template_repman_manager_sh }}
362
cluster-list = {{ dumps( list(slapparameter_dict.get('repman-cluster-dict', default_parameter_dict)) ) }}
363 364 365 366 367 368 369 370 371 372 373
context =
  section parameter_dict repman
  key username repman-parameter:username
  key password repman-parameter:password
  key secure_url nginx-parameter:backend-ssl-url
  key cluster_name_list :cluster-list
  raw jq_bin {{ jq_bin }}
  raw curl_bin {{ curl_bin }}
  raw bash_bin {{ bash_bin }}
rendered = ${directory:scripts}/repman-reload
mode = 755
374 375 376 377 378 379 380 381 382 383 384

[replication-manager]
recipe = slapos.cookbook:wrapper
command-line =
   {{ gowork_bin }}/replication-manager
   --monitoring-basedir=${repman:root-dir}
   --monitoring-sharedir=${repman-parameter:share-dir}
   --http-root=${repman-parameter:http-root}
   --monitoring-datadir=${repman:data-dir}
   --config=${repman-config.toml:rendered}
   --log-file=${repman-parameter:log}
385
   --memprofile=${directory:tmp}/repmgr.mprof
386 387 388 389 390 391
   monitor

wrapper-path = ${directory:service}/replication-manager
# setup repman instance folder
depends =
  ${repman-config-folder:recipe}
392
  ${replication-manager-reload:recipe}
393 394
  ${repman-listen-promise:recipe}
  ${repman-listen-ssl-promise:recipe}
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410

[repman-config.toml]
recipe = slapos.recipe.template:jinja2
template = {{ config_toml_in }}
rendered = ${repman:etc}/config.toml
extra-context =
context =
  section parameter_dict repman-parameter

[repman-listen-promise]
<= monitor-promise-base
module = check_port_listening
name = repman_service_listen.py
config-hostname = ${repman-parameter:ipv4}
config-port = ${repman-parameter:port}

411 412 413 414 415 416 417
[repman-listen-ssl-promise]
<= monitor-promise-base
module = check_port_listening
name = repman_service_ssl_listen.py
config-hostname = ${repman-parameter:ipv4}
config-port = ${repman-parameter:secure-port}

418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434
[nginx-conf]
recipe = slapos.recipe.template:jinja2
template = {{ nginx_conf_in }}
rendered = ${nginx-parameter:config-file}
context =
    section parameter_dict nginx-parameter

[nginx-launcher]
recipe = slapos.cookbook:wrapper
command-line =
  {{ nginx_bin }}
  -p ${directory:nginx-prefix}
  -c ${nginx-conf:rendered}
wrapper-path = ${directory:bin}/nginx-start
wait-for-files =
  ${ca-directory:certs}/nginx.key
  ${ca-directory:certs}/nginx.crt
435
  ${nginx-graceful-wrapper:rendered}
436 437

[nginx-graceful-wrapper]
438 439 440 441 442 443
recipe = slapos.recipe.template:jinja2
template = inline:#!{{ bash_bin }}
  kill -USR1 "$(cat ${nginx-parameter:pid-file})"
rendered = ${directory:scripts}/nginx-graceful
context =
mode = 755
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464

[ca-nginx]
<= certificate-authority
recipe = slapos.cookbook:certificate_authority.request
cert-file = ${ca-directory:certs}/nginx.crt
key-file = ${ca-directory:certs}/nginx.key
executable = ${nginx-launcher:wrapper-path}
wrapper = ${directory:bin}/ca-nginx

[ca-nginx-service]
recipe = slapos.cookbook:wrapper
command-line = ${ca-nginx:wrapper}
wrapper-path = ${directory:services}/nginx
hash-existing-files = ${buildout:directory}/software_release/buildout.cfg

[logrotate-entry-nginx]
<= logrotate-entry-base
name = nginx
log = ${nginx-parameter:access-log} ${nginx-parameter:error-log}
post = kill -USR1 $(cat ${nginx-parameter:pid-file})

465 466 467 468
[publish-early]
recipe = slapos.cookbook:publish-early
-init =
  monitor-password monitor-htpasswd:passwd
469 470
  db-root-password gen-root-password:passwd
  repman-password repman-password:passwd
471

472 473
[publish-connection-parameter]
<= monitor-publish
474
-extends = publish-early
475
recipe = slapos.cookbook:publish
476
backend-url = ${nginx-parameter:backend-ssl-url}
477 478
url = ${repman-frontend:connection-secure_access}
username = ${repman-parameter:username}
479 480 481 482 483 484 485 486 487 488 489 490 491 492 493
{% for name, value in publish_dict.items() -%}
{{   name }} = {{ value }}
{% endfor %}


[monitor-instance-parameter]
monitor-httpd-port = 8060
cors-domains = {{ slapparameter_dict.get('monitor-cors-domains', 'monitor.app.officejs.com') }} 
username = admin
password = ${publish-early:monitor-password}

[monitor-base-url-dict]
{% for key, value in monitor_base_url_dict.items() -%}
{{ key }} = {{ value }}
{% endfor %}
494 495 496 497 498 499

[repman-frontend]
<= slap-connection
recipe = slapos.cookbook:requestoptional
name = Replication Manager Frontend
# XXX We have hardcoded SR URL here.
500 501 502 503
software-url = {{ frontend_parameter_dict.get('frontend-software-url', 'http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg') }}
{% if frontend_parameter_dict.get('frontend-software-type', '') -%}
software-type ={{ frontend_parameter_dict['frontend-software-type'] }}
{% endif -%}
504
slave = true
505
config-url = ${nginx-parameter:backend-ssl-url}
506
config-domain = {{ frontend_parameter_dict.get('slave-domain', '') }}
507 508 509 510 511 512 513 514 515 516 517 518
return = domain secure_access

[repman-frontend-promise]
<= monitor-promise-base
module = check_url_available
name = check_repman_frontend.py
config-url = https://${repman-frontend:connection-domain}
config-check-secure = 1

[repman-backend-promise]
<= monitor-promise-base
module = check_url_available
519
name = check_repman_backend.py
520
config-url = ${nginx-parameter:backend-ssl-url}
521 522
config-check-secure = 1

523 524 525 526 527 528 529 530 531
[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
532
  key get_proxy_config    download-proxy-config:rendered
533 534 535 536 537 538 539 540 541 542 543
  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}
544 545 546 547 548 549 550 551

#############################
#
# Deploy replication-manager instance
#
#############################
[buildout]
extends =
552
  {{ template_monitor }}
553 554 555 556 557 558 559 560
parts =
  replication-manager
  monitor-base
  logrotate-entry-nginx
  ca-nginx-service
  publish-connection-parameter
  repman-frontend-promise
  repman-backend-promise
561
  proxy-need-stop-start
562

563 564
# Complete parts with sections
  {{ part_list | join('\n  ') }}
565 566 567 568

eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true