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
Lukas Niegsch
slapos
Commits
62193cff
Commit
62193cff
authored
Oct 17, 2011
by
Łukasz Nowak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Switch mariadb instantiation to a profile based.
parent
001a849b
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
249 additions
and
1 deletion
+249
-1
slapos/recipe/generic_mysql/__init__.py
slapos/recipe/generic_mysql/__init__.py
+111
-0
slapos/recipe/generic_mysql/mysql.py
slapos/recipe/generic_mysql/mysql.py
+0
-0
slapos/recipe/generic_mysql/template/initmysql.sql.in
slapos/recipe/generic_mysql/template/initmysql.sql.in
+0
-0
slapos/recipe/generic_mysql/template/my.cnf.in
slapos/recipe/generic_mysql/template/my.cnf.in
+0
-0
software/erp5/instance-mariadb.cfg
software/erp5/instance-mariadb.cfg
+128
-0
software/erp5/instance.cfg
software/erp5/instance.cfg
+1
-0
software/erp5/software.cfg
software/erp5/software.cfg
+9
-1
No files found.
slapos/recipe/generic_mysql/__init__.py
0 → 100644
View file @
62193cff
##############################################################################
#
# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 3
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from
slapos.recipe.librecipe
import
GenericBaseRecipe
import
os
class
Recipe
(
GenericBaseRecipe
):
def
_options
(
self
,
options
):
options
[
'password'
]
=
self
.
generatePassword
()
def
install
(
self
):
path_list
=
[]
template_filename
=
self
.
getTemplateFilename
(
'my.cnf.in'
)
mysql_conf
=
dict
(
ip
=
self
.
options
[
'ip'
],
data_directory
=
self
.
options
[
'data-directory'
],
tcp_port
=
self
.
options
[
'port'
],
pid_file
=
self
.
options
[
'pid-file'
],
socket
=
self
.
options
[
'socket'
],
error_log
=
self
.
options
[
'error-log'
],
slow_query_log
=
self
.
options
[
'slow-query-log'
],
mysql_database
=
self
.
options
[
'database'
],
mysql_user
=
self
.
options
[
'user'
],
mysql_password
=
self
.
options
[
'password'
],
)
mysql_binary
=
self
.
options
[
'mysql-binary'
]
socket
=
self
.
options
[
'socket'
],
post_rotate
=
self
.
createPythonScript
(
self
.
options
[
'logrotate-post'
],
'slapos.recipe.librecipe.execute.execute'
,
[
mysql_binary
,
'--no-defaults'
,
'-B'
,
'--socket=%s'
%
socket
,
'-e'
,
'FLUSH LOGS'
]
)
path_list
.
append
(
post_rotate
)
mysql_conf_file
=
self
.
createFile
(
self
.
options
[
'conf-file'
],
self
.
substituteTemplate
(
template_filename
,
mysql_conf
)
)
path_list
.
append
(
mysql_conf_file
)
mysql_script_list
=
[]
init_script
=
self
.
substituteTemplate
(
self
.
getTemplateFilename
(
'initmysql.sql.in'
),
{
'mysql_database'
:
mysql_conf
[
'mysql_database'
],
'mysql_user'
:
mysql_conf
[
'mysql_user'
],
'mysql_password'
:
mysql_conf
[
'mysql_password'
]
}
)
mysql_script_list
.
append
(
init_script
)
mysql_script_list
.
append
(
'EXIT'
)
mysql_script
=
'
\
n
'
.
join
(
mysql_script_list
)
mysql_upgrade_binary
=
self
.
options
[
'mysql-upgrade-binary'
]
mysql_update
=
self
.
createPythonScript
(
self
.
options
[
'update-wrapper'
],
'%s.mysql.updateMysql'
%
__name__
,
dict
(
mysql_script
=
mysql_script
,
mysql_binary
=
mysql_binary
,
mysql_upgrade_binary
=
mysql_upgrade_binary
,
socket
=
socket
,
)
)
path_list
.
append
(
mysql_update
)
mysqld_binary
=
self
.
options
[
'mysqld-binary'
]
mysqld
=
self
.
createPythonScript
(
self
.
options
[
'wrapper'
],
'%s.mysql.runMysql'
%
__name__
,
dict
(
mysql_install_binary
=
self
.
options
[
'mysql-install-binary'
],
mysqld_binary
=
mysqld_binary
,
data_directory
=
mysql_conf
[
'data_directory'
],
mysql_binary
=
mysql_binary
,
socket
=
socket
,
configuration_file
=
mysql_conf_file
,
)
)
path_list
.
append
(
mysqld
)
return
path_list
slapos/recipe/
erp5
/mysql.py
→
slapos/recipe/
generic_mysql
/mysql.py
View file @
62193cff
File moved
slapos/recipe/
erp5
/template/initmysql.sql.in
→
slapos/recipe/
generic_mysql
/template/initmysql.sql.in
View file @
62193cff
File moved
slapos/recipe/
erp5
/template/my.cnf.in
→
slapos/recipe/
generic_mysql
/template/my.cnf.in
View file @
62193cff
File moved
software/erp5/instance-mariadb.cfg
View file @
62193cff
[buildout]
parts =
publish-mariadb-url
mariadb
logrotate
logrotate-entry-mariadb
cron
cron-entry-logrotate
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[url]
recipe = slapos.cookbook:publishurl
url = mysqls://$${mariadb:user}:$${mariadb:password}@$${mariadb:ip}:$${mariadb:port}/$${mariadb:database}
[mariadb]
recipe = slapos.cookbook:mysql
# Options
recovering = false
user = user
port = 3306
ip = $${slap-network-information:local-ipv4}
database = db
# Paths
wrapper = $${basedirectory:services}/mariadb
update-wrapper = $${basedirectory:services}/mariadb_update
backup-directory = $${directory:mariadb-backup}
data-directory = $${directory:mariadb-data}
pid-file = $${basedirectory:run}/mariadb.pid
socket = $${basedirectory:run}/mariadb.sock
error-log = $${basedirectory:log}/mariadb_error.log
slow-query-log = $${basedirectory:log}/mariadb_slowquery.log
conf-file = $${rootdirectory:etc}/mariadb.cnf
backup-pending-directory = $${directory:mariadb-backup-pending}
dumpname = dump.sql.gz
# Binary information
mysql-binary = ${mariadb:location}/bin/mysql
mysql-install-binary = ${mariadb:location}/bin/mysql_install_db
mysql-upgrade-binary = ${mariadb:location}/bin/mysql_upgrade
mysqld-binary = ${mariadb:location}/libexec/mysqld
mysqldump-binary = ${mariadb:location}/bin/mysqldump
[logrotate]
recipe = slapos.cookbook:logrotate
# Binaries
logrotate-binary = ${logrotate:location}/usr/sbin/logrotate
gzip-binary = $${buildout:gzip-binary}
gunzip-binary = ${gzip:location}/bin/gunzip
# Directories
wrapper = $${rootdirectory:bin}/logrotate
conf = $${rootdirectory:etc}/logrotate.conf
logrotate-entries = $${directory:logrotate-entries}
backup = $${directory:logrotate-backup}
state-file = $${rootdirectory:srv}/logrotate.status
[logrotate-entry-mariadb]
<= logrotate
recipe = slapos.cookbook:logrotate.d
name = mariadb
log = $${mariadb:error-log} $${mariadb:slow-query-log}
frequency = daily
rotate-num = 30
post = $${mariadb:mysql-binary} --no-defaults -B --socket=$${mariadb:socket} -e "FLUSH LOGS"
sharedscripts = true
notifempty = true
create = true
[cron]
recipe = slapos.cookbook:cron
dcrond-binary = ${dcron:location}/sbin/crond
cron-entries = $${directory:cron-entries}
crontabs = $${directory:crontabs}
cronstamps = $${directory:cronstamps}
catcher = $${cron-simplelogger:binary}
binary = $${basedirectory:services}/crond
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
binary = $${rootdirectory:bin}/cron_simplelogger
output = $${directory:cronoutput}
[cron-entry-logrotate]
<= cron
recipe = slapos.cookbook:cron.d
name = logrotate
frequency = 0 0 * * *
command = $${logrotate:wrapper}
[cron-entry-mariadb-backup]
<= cron
recipe = slapos.cookbook:cron.d
name = mariadb-backup
frequency = 0 0 * * *
command = $${mariadb:backup-script}
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/
var = $${buildout:directory}/var/
srv = $${buildout:directory}/srv/
bin = $${buildout:directory}/bin/
[basedirectory]
recipe = slapos.cookbook:mkdirectory
log = $${rootdirectory:var}/log/
services = $${rootdirectory:etc}/run/
run = $${rootdirectory:var}/run/
backup = $${rootdirectory:srv}/backup/
[directory]
recipe = slapos.cookbook:mkdirectory
cron-entries = $${rootdirectory:etc}/cron.d/
crontabs = $${rootdirectory:etc}/crontabs/
cronstamps = $${rootdirectory:etc}/cronstamps/
cronoutput = $${basedirectory:log}/cron/
ca-dir = $${rootdirectory:srv}/ssl/
mariadb-backup = $${basedirectory:backup}/mariadb/
mariadb-backup-pending = $${basedirectory:backup}/mariadb-pending/
mariadb-data = $${rootdirectory:srv}/mariadb/
logrotate-backup = $${basedirectory:backup}/logrotate/
logrotate-entries = $${rootdirectory:etc}/logrotate.d/
software/erp5/instance.cfg
View file @
62193cff
...
@@ -87,3 +87,4 @@ memcached = ${template-memcached:output}
...
@@ -87,3 +87,4 @@ memcached = ${template-memcached:output}
cloudooo = ${template-cloudooo:output}
cloudooo = ${template-cloudooo:output}
zope = ${template-zope:output}
zope = ${template-zope:output}
zeo = ${template-zeo:output}
zeo = ${template-zeo:output}
mariadb = ${template-mariadb:output}
software/erp5/software.cfg
View file @
62193cff
...
@@ -12,6 +12,7 @@ parts +=
...
@@ -12,6 +12,7 @@ parts +=
template-kumofs
template-kumofs
template-cloudooo
template-cloudooo
template-zope
template-zope
template-mariadb
template
template
validator
validator
...
@@ -20,6 +21,13 @@ parts +=
...
@@ -20,6 +21,13 @@ parts +=
# development / fast switching environment for whole software
# development / fast switching environment for whole software
unzip = true
unzip = true
[template-mariadb]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-mariadb.cfg
md5sum = 3913b5ff68311ac97314dabbb4059bd9
output = ${buildout:directory}/template-mariadb.cfg
mode = 0644
[template-zope]
[template-zope]
recipe = slapos.recipe.template
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-zope.cfg
url = ${:_profile_base_location_}/instance-zope.cfg
...
@@ -53,7 +61,7 @@ configurator_bt5_list = erp5_core_proxy_field_legacy erp5_full_text_myisam_catal
...
@@ -53,7 +61,7 @@ configurator_bt5_list = erp5_core_proxy_field_legacy erp5_full_text_myisam_catal
[template]
[template]
recipe = slapos.recipe.template
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
url = ${:_profile_base_location_}/instance.cfg
md5sum =
b92f0cfc0248ada71302406981ca75c2
md5sum =
f575d9f5e47fd340cf99bd63db15ac36
output = ${buildout:directory}/template.cfg
output = ${buildout:directory}/template.cfg
mode = 0644
mode = 0644
...
...
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