Commit 35d04da6 authored by Vincent Pelletier's avatar Vincent Pelletier

stack.erp5: Randomly generate server-id if not provided.

Makes it easier to deploy a functional replication setup.
parent ba2427fe
...@@ -19,7 +19,7 @@ md5sum = 1e89de954d816b93f76d9b75820d192c ...@@ -19,7 +19,7 @@ md5sum = 1e89de954d816b93f76d9b75820d192c
[template-mariadb] [template-mariadb]
filename = instance-mariadb.cfg.in filename = instance-mariadb.cfg.in
md5sum = 11e7faca5233868c1643854e4c898588 md5sum = 6cc8f361b3ca22aab2611231fcad8b2d
[template-kumofs] [template-kumofs]
filename = instance-kumofs.cfg.in filename = instance-kumofs.cfg.in
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
[publish] [publish]
recipe = slapos.cookbook:publish.serialised recipe = slapos.cookbook:publish.serialised
-extends = publish-early
{% macro render_database_list(database_list) -%} {% macro render_database_list(database_list) -%}
{% set publish_database_list = [] -%} {% set publish_database_list = [] -%}
{% for database in database_list -%} {% for database in database_list -%}
...@@ -33,6 +34,20 @@ recipe = slapos.cookbook:publish.serialised ...@@ -33,6 +34,20 @@ recipe = slapos.cookbook:publish.serialised
database-list = {{ render_database_list(database_list) }} database-list = {{ render_database_list(database_list) }}
test-database-list = {{ render_database_list(test_database_list) }} test-database-list = {{ render_database_list(test_database_list) }}
[publish-early]
recipe = slapos.cookbook:publish-early
-init =
server-id gen-server-id:value
{%- set server_id = slapparameter_dict.get('server-id') %}
{%- if server_id %}
server-id = {{ dumps(server_id) }}
{%- endif %}
[gen-server-id]
recipe = slapos.cookbook:random.integer
minimum = {{ dumps(1) }}
maximum = {{ dumps(2**32 - 1) }}
[jinja2-template-base] [jinja2-template-base]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
mode = 644 mode = 644
...@@ -124,7 +139,7 @@ relaxed-writes = {{ dumps(slapparameter_dict.get('relaxed-writes', False)) }} ...@@ -124,7 +139,7 @@ relaxed-writes = {{ dumps(slapparameter_dict.get('relaxed-writes', False)) }}
binlog-path = ${directory:mariadb-backup-incremental}/binlog binlog-path = ${directory:mariadb-backup-incremental}/binlog
# XXX: binlog rotation happens along with other log's rotation # XXX: binlog rotation happens along with other log's rotation
binlog-expire-days = {{ dumps(incremental_backup_retention_days) }} binlog-expire-days = {{ dumps(incremental_backup_retention_days) }}
server-id = {{ dumps(slapparameter_dict.get('server-id', 1)) }} server-id = ${publish-early:server-id}
{% else %} {% else %}
binlog-path = binlog-path =
{%- endif %} {%- endif %}
......
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