Commit 2ff71ad0 authored by Julien Muchembled's avatar Julien Muchembled

ERP5/NEO: update authentication with local user for MariaDB 10.4

parent c4485fb5
...@@ -38,6 +38,7 @@ template = {{ neo_master }} ...@@ -38,6 +38,7 @@ template = {{ neo_master }}
<= jinja2-template-base <= jinja2-template-base
template = {{ neo }} template = {{ neo }}
extra-context = extra-context =
key user slap-configuration:user-name
key master_cfg neo-master:rendered key master_cfg neo-master:rendered
key admin_cfg neo-admin:rendered key admin_cfg neo-admin:rendered
{%- if mariadb_location is defined %} {%- if mariadb_location is defined %}
......
...@@ -25,6 +25,7 @@ slow-query-log = ${directory:log}/mariadb_slowquery.log ...@@ -25,6 +25,7 @@ slow-query-log = ${directory:log}/mariadb_slowquery.log
extra-dict = {{ dumps(slapparameter_dict.get('mysql', {})) }} extra-dict = {{ dumps(slapparameter_dict.get('mysql', {})) }}
init-file = ${init-script:rendered} init-file = ${init-script:rendered}
engine = {{ slapparameter_dict.get('engine', '') }} engine = {{ slapparameter_dict.get('engine', '') }}
user = {{ user }}
[my-cnf] [my-cnf]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
...@@ -102,7 +103,7 @@ wrapper = ${directory:etc_run}/{{ 'neostorage-' ~ i }} ...@@ -102,7 +103,7 @@ wrapper = ${directory:etc_run}/{{ 'neostorage-' ~ i }}
logfile = ${directory:log}/{{ 'neostorage-' ~ i }}.log logfile = ${directory:log}/{{ 'neostorage-' ~ i }}.log
{%- if mysql %} {%- if mysql %}
{%- do init_list.append('CREATE DATABASE IF NOT EXISTS neo' ~ i ~ ';') %} {%- do init_list.append('CREATE DATABASE IF NOT EXISTS neo' ~ i ~ ';') %}
database-parameters = root@neo{{ i }}${my-cnf-parameters:socket} database-parameters = ${my-cnf-parameters:user}@neo{{ i }}${my-cnf-parameters:socket}
{%- else %} {%- else %}
database-parameters = ${directory:db-{{i}}}/db.sqlite database-parameters = ${directory:db-{{i}}}/db.sqlite
......
...@@ -59,4 +59,4 @@ skip_character_set_client_handshake ...@@ -59,4 +59,4 @@ skip_character_set_client_handshake
[client] [client]
socket = {{ socket }} socket = {{ socket }}
user = root user = {{ parameter_dict['user'] }}
...@@ -94,7 +94,7 @@ mode = 644 ...@@ -94,7 +94,7 @@ mode = 644
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/${:_buildout_section_name_}.cfg.in template = ${:_profile_base_location_}/${:_buildout_section_name_}.cfg.in
rendered = ${buildout:directory}/${:_buildout_section_name_}.cfg rendered = ${buildout:directory}/${:_buildout_section_name_}.cfg
md5sum = 0a3a54fcc7be0bbd63cbd64f006ceebc md5sum = efdb9d6ca0e9d34c5c78583426ab356d
context = context =
key bin_directory buildout:bin-directory key bin_directory buildout:bin-directory
key develop_eggs_directory buildout:develop-eggs-directory key develop_eggs_directory buildout:develop-eggs-directory
...@@ -124,12 +124,12 @@ md5sum = 728c407bc526252aec2222752226dde6 ...@@ -124,12 +124,12 @@ md5sum = 728c407bc526252aec2222752226dde6
[instance-neo] [instance-neo]
<= download-base-neo <= download-base-neo
md5sum = d18e049d580720e733502b774b0d6790 md5sum = 25a7d15df985512047a620d3d0485fc3
[template-neo-my-cnf] [template-neo-my-cnf]
<= download-base-neo <= download-base-neo
url = ${:_profile_base_location_}/my.cnf.in url = ${:_profile_base_location_}/my.cnf.in
md5sum = 9f6f8f2b5f4cb0d97d50ffc1d3837e2f md5sum = 65288470b8283aaeeb09fbee7a5327ed
[template-mysqld-wrapper] [template-mysqld-wrapper]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
......
...@@ -26,7 +26,7 @@ md5sum = d95e8500bdc72d1f40b97cc414656e7e ...@@ -26,7 +26,7 @@ md5sum = d95e8500bdc72d1f40b97cc414656e7e
[template-mariadb] [template-mariadb]
filename = instance-mariadb.cfg.in filename = instance-mariadb.cfg.in
md5sum = 591fe60e2f615c7690fa5078473b1b0a md5sum = 091ac04b43c8861c6b3fdf4fcadbe6d5
[template-kumofs] [template-kumofs]
filename = instance-kumofs.cfg.in filename = instance-kumofs.cfg.in
...@@ -42,7 +42,7 @@ md5sum = d32417746fcf671d4e86a70379815039 ...@@ -42,7 +42,7 @@ md5sum = d32417746fcf671d4e86a70379815039
[template-my-cnf] [template-my-cnf]
filename = my.cnf.in filename = my.cnf.in
md5sum = 5a6f337117ba8b72d7fe3b7a9f26f5f6 md5sum = a30b651dd66cad827b23401d58c3ff77
[template-mariadb-initial-setup] [template-mariadb-initial-setup]
filename = mariadb_initial_setup.sql.in filename = mariadb_initial_setup.sql.in
...@@ -70,7 +70,7 @@ md5sum = c64f35f825200fe35328641b2b8e0fdd ...@@ -70,7 +70,7 @@ md5sum = c64f35f825200fe35328641b2b8e0fdd
[template] [template]
filename = instance.cfg.in filename = instance.cfg.in
md5sum = f6c6820f9b3653d0d5c29708606fc591 md5sum = 7a33bcfa014a9dab8359815495cd4ede
[monitor-template-dummy] [monitor-template-dummy]
filename = dummy.cfg filename = dummy.cfg
......
...@@ -107,7 +107,7 @@ time = {{ dumps(backup_periodicity) }} ...@@ -107,7 +107,7 @@ time = {{ dumps(backup_periodicity) }}
# can be fully restored. # can be fully restored.
# master-data: use value "2" as we are not in a replication case # master-data: use value "2" as we are not in a replication case
#} #}
command = "${binary-wrap-mysqldump:wrapper-path}" -u root --all-databases --flush-privileges --single-transaction --max-allowed-packet=128M {% if incremental_backup_retention_days > -1 %}--flush-logs --master-data=2 {% endif %}| {{ parameter_dict['gzip-location'] }}/bin/gzip > "${directory:mariadb-backup-full}/$({{ parameter_dict['coreutils-location'] }}/bin/date "+%Y%m%d%H%M%S").sql.gz" command = "${binary-wrap-mysqldump:wrapper-path}" --all-databases --flush-privileges --single-transaction --max-allowed-packet=128M {% if incremental_backup_retention_days > -1 %}--flush-logs --master-data=2 {% endif %}| {{ parameter_dict['gzip-location'] }}/bin/gzip > "${directory:mariadb-backup-full}/$({{ parameter_dict['coreutils-location'] }}/bin/date "+%Y%m%d%H%M%S").sql.gz"
{# KEEP GLOB PATTERN IN SYNC with generated filenames above {# KEEP GLOB PATTERN IN SYNC with generated filenames above
# YYYYmmddHHMMSS -#} # YYYYmmddHHMMSS -#}
file-glob = ??????????????.sql.gz file-glob = ??????????????.sql.gz
...@@ -125,6 +125,7 @@ command = {{ parameter_dict['findutils-location'] }}/bin/find "${directory:maria ...@@ -125,6 +125,7 @@ command = {{ parameter_dict['findutils-location'] }}/bin/find "${directory:maria
[my-cnf-parameters] [my-cnf-parameters]
ip = {{ ip }} ip = {{ ip }}
port = {{ port }} port = {{ port }}
user = {{ user }}
socket = ${directory:run}/mariadb.sock socket = ${directory:run}/mariadb.sock
data-directory = ${directory:srv}/mariadb data-directory = ${directory:srv}/mariadb
tmp-directory = ${directory:tmp} tmp-directory = ${directory:tmp}
...@@ -206,7 +207,7 @@ context = section parameter_dict odbc-ini-text ...@@ -206,7 +207,7 @@ context = section parameter_dict odbc-ini-text
< = logrotate-entry-base < = logrotate-entry-base
name = mariadb name = mariadb
log = ${my-cnf-parameters:error-log} ${my-cnf-parameters:slow-query-log} log = ${my-cnf-parameters:error-log} ${my-cnf-parameters:slow-query-log}
post = "${binary-wrap-mysql:wrapper-path}" -B -u root -e "FLUSH LOGS" post = "${binary-wrap-mysql:wrapper-path}" -B -e "FLUSH LOGS"
[{{ section('binary-link') }}] [{{ section('binary-link') }}]
recipe = slapos.cookbook:symbolic.link recipe = slapos.cookbook:symbolic.link
......
...@@ -155,6 +155,7 @@ unixodbc-location = {{ unixodbc_location }} ...@@ -155,6 +155,7 @@ unixodbc-location = {{ unixodbc_location }}
template = {{ template_mariadb }} template = {{ template_mariadb }}
filename = instance-mariadb.cfg filename = instance-mariadb.cfg
extra-context = extra-context =
key user slap-configuration:user-name
section parameter_dict dynamic-template-mariadb-parameters section parameter_dict dynamic-template-mariadb-parameters
# Keep a section for backward compatibility for removed types # Keep a section for backward compatibility for removed types
......
...@@ -84,7 +84,7 @@ ssl_cipher = {{ parameter_dict['ssl-cipher'] }} ...@@ -84,7 +84,7 @@ ssl_cipher = {{ parameter_dict['ssl-cipher'] }}
[client] [client]
socket = {{ socket }} socket = {{ socket }}
user = root user = {{ parameter_dict['user'] }}
[mysql] [mysql]
no_auto_rehash no_auto_rehash
......
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