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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Romain Courteaud
slapos
Commits
47fe7eb3
Commit
47fe7eb3
authored
Aug 29, 2019
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NEO: make MariaDB database creation more robust
parent
15c2a0d0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
18 deletions
+40
-18
software/neoppod/instance-common.cfg.in
software/neoppod/instance-common.cfg.in
+1
-0
software/neoppod/instance-neo.cfg.in
software/neoppod/instance-neo.cfg.in
+15
-16
software/neoppod/software-common.cfg
software/neoppod/software-common.cfg
+24
-2
No files found.
software/neoppod/instance-common.cfg.in
View file @
47fe7eb3
...
@@ -42,5 +42,6 @@ extra-context =
...
@@ -42,5 +42,6 @@ extra-context =
key admin_cfg neo-admin:rendered
key admin_cfg neo-admin:rendered
{%- if mariadb_location is defined %}
{%- if mariadb_location is defined %}
raw mariadb_location {{ mariadb_location }}
raw mariadb_location {{ mariadb_location }}
raw template_mysqld_wrapper {{ template_mysqld_wrapper }}
raw template_neo_my_cnf {{ template_neo_my_cnf }}
raw template_neo_my_cnf {{ template_neo_my_cnf }}
{%- endif %}
{%- endif %}
software/neoppod/instance-neo.cfg.in
View file @
47fe7eb3
...
@@ -7,18 +7,17 @@
...
@@ -7,18 +7,17 @@
{% set mysql = storage_type == 'MySQL' -%}
{% set mysql = storage_type == 'MySQL' -%}
{% if mysql -%}
{% if mysql -%}
[mysqld]
[{{ section('mysqld') }}]
recipe = slapos.cookbook:generic.mysql.wrap_mysqld
recipe = slapos.recipe.template:jinja2
output = ${directory:etc_run}/mariadb
template = {{ template_mysqld_wrapper }}
binary = ${:mysql-base-directory}/bin/mysqld
rendered = ${directory:etc_run}/mariadb
configuration-file = ${my-cnf:rendered}
context =
data-directory = ${directory:srv_mariadb}
key defaults_file my-cnf:rendered
mysql-install-binary = ${:mysql-base-directory}/scripts/mysql_install_db
key datadir my-cnf-parameters:data-directory
mysql-base-directory = {{ mariadb_location }}
[my-cnf-parameters]
[my-cnf-parameters]
socket = ${directory:var_run}/mariadb.sock
socket = ${directory:var_run}/mariadb.sock
data-directory = ${
mysqld:data-directory}
data-directory = ${
directory:srv}/mariadb
tmp-directory = ${directory:tmp}
tmp-directory = ${directory:tmp}
pid-file = ${directory:var_run}/mariadb.pid
pid-file = ${directory:var_run}/mariadb.pid
error-log = ${directory:log}/mariadb_error.log
error-log = ${directory:log}/mariadb_error.log
...
@@ -34,9 +33,9 @@ rendered = ${directory:etc}/mariadb.cnf
...
@@ -34,9 +33,9 @@ rendered = ${directory:etc}/mariadb.cnf
template = {{ template_neo_my_cnf }}
template = {{ template_neo_my_cnf }}
context = section parameter_dict my-cnf-parameters
context = section parameter_dict my-cnf-parameters
[
{{ section('binary-wrap-mysql') }}
]
[
binary-wrap-mysql
]
recipe = slapos.cookbook:wrapper
recipe = slapos.cookbook:wrapper
command-line =
${mysqld:mysql-base-directory}/bin/${:command} --defaults-file=${my-cnf:rendered}
command-line =
'{{ mariadb_location }}/bin/${:command}' --defaults-file="${my-cnf:rendered}"
wrapper-path = ${directory:bin}/${:command}
wrapper-path = ${directory:bin}/${:command}
command = mysql
command = mysql
...
@@ -107,7 +106,7 @@ database-parameters = root@neo{{ i }}${my-cnf-parameters:socket}
...
@@ -107,7 +106,7 @@ database-parameters = root@neo{{ i }}${my-cnf-parameters:socket}
database-parameters = ${directory:db-{{i}}}/db.sqlite
database-parameters = ${directory:db-{{i}}}/db.sqlite
[directory]
[directory]
db-{{i}} = ${
buildout:directory}/srv
/{{ storage_id }}
db-{{i}} = ${
:srv}
/{{ storage_id }}
{%- endif %}
{%- endif %}
[{{ section('logrotate-storage-' ~ i) }}]
[{{ section('logrotate-storage-' ~ i) }}]
...
@@ -128,9 +127,9 @@ etc_run = ${:etc}/run
...
@@ -128,9 +127,9 @@ etc_run = ${:etc}/run
var_run = ${:var}/run
var_run = ${:var}/run
log = ${buildout:directory}/var/log
log = ${buildout:directory}/var/log
tmp = ${buildout:directory}/tmp
tmp = ${buildout:directory}/tmp
{% if mysql -%}
srv = ${buildout:directory}/srv
srv_mariadb = ${buildout:directory}/srv/mariadb
{% if mysql -%}
[init-script]
[init-script]
recipe = slapos.recipe.template:jinja2
recipe = slapos.recipe.template:jinja2
# XXX: is there a better location ?
# XXX: is there a better location ?
...
@@ -142,7 +141,7 @@ template = inline:
...
@@ -142,7 +141,7 @@ template = inline:
< = 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 = ${
mysqld:mysql-base-directory}/bin/mysql --defaults-file="${my-cnf:rendered}"
-e "FLUSH LOGS"
post = ${
binary-wrap-mysql:command-line}
-e "FLUSH LOGS"
{% if runTestSuite_in is defined -%}
{% if runTestSuite_in is defined -%}
# bin/runTestSuite to run NEO tests
# bin/runTestSuite to run NEO tests
...
@@ -155,7 +154,7 @@ context =
...
@@ -155,7 +154,7 @@ context =
section directory directory
section directory directory
section my_cnf_parameters my-cnf-parameters
section my_cnf_parameters my-cnf-parameters
raw bin_directory {{ bin_directory }}
raw bin_directory {{ bin_directory }}
raw prepend_path
${mysqld:mysql-base-directory
}/bin
raw prepend_path
{{ mariadb_location }
}/bin
{%- endif %}
{%- endif %}
{%- endif %}
{%- endif %}
...
...
software/neoppod/software-common.cfg
View file @
47fe7eb3
...
@@ -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 =
c0e22816537b56bceef0b4c2b40f6219
md5sum =
0a3a54fcc7be0bbd63cbd64f006ceebc
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
...
@@ -107,6 +107,7 @@ context =
...
@@ -107,6 +107,7 @@ context =
${:adapter-context}
${:adapter-context}
adapter-context =
adapter-context =
key mariadb_location mariadb:location
key mariadb_location mariadb:location
key template_mysqld_wrapper template-mysqld-wrapper:rendered
key template_neo_my_cnf template-neo-my-cnf:target
key template_neo_my_cnf template-neo-my-cnf:target
[root-common]
[root-common]
...
@@ -123,13 +124,34 @@ md5sum = 4faee020eaf7cd495cd6210dfa4eb0c1
...
@@ -123,13 +124,34 @@ md5sum = 4faee020eaf7cd495cd6210dfa4eb0c1
[instance-neo]
[instance-neo]
<= download-base-neo
<= download-base-neo
md5sum =
3e394ae616e554e1eacb2b86ee74fc76
md5sum =
5fc9fcaec3a5387625af34fe686097ae
[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 = 9f6f8f2b5f4cb0d97d50ffc1d3837e2f
[template-mysqld-wrapper]
recipe = slapos.recipe.template:jinja2
rendered = ${buildout:parts-directory}/${:_buildout_section_name_}/mysqld.in
mode = 644
template =
inline:{% raw %}#!/bin/sh -e
datadir='{{datadir}}'
[ -e "$datadir" ] || {
rm -vrf "$datadir.new"
'${mariadb:location}/scripts/mysql_install_db' \
--defaults-file='{{defaults_file}}' \
--skip-name-resolve \
--basedir='${mariadb:location}' \
--datadir="$datadir.new"
mv -v "$datadir.new" "$datadir"
}
exec '${mariadb:location}/bin/mysqld' \
--defaults-file='{{defaults_file}}' \
"$@"
{% endraw %}
[versions]
[versions]
BTrees = 4.5.1
BTrees = 4.5.1
ZODB = 4.4.5
ZODB = 4.4.5
...
...
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