Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kristopher Ruzic
slapos
Commits
bc5cb1e6
Commit
bc5cb1e6
authored
Dec 08, 2014
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ERP5 SR: Use mariadb backup from erp5-cluster.
Side effect: activate binlogs. current backup system does not work.
parent
95748c74
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
7 deletions
+56
-7
slapos/recipe/generic_mysql/__init__.py
slapos/recipe/generic_mysql/__init__.py
+11
-0
slapos/recipe/generic_mysql/template/my.cnf.in
slapos/recipe/generic_mysql/template/my.cnf.in
+2
-3
stack/erp5/buildout.cfg
stack/erp5/buildout.cfg
+4
-1
stack/erp5/instance-mariadb.cfg.in
stack/erp5/instance-mariadb.cfg.in
+39
-3
No files found.
slapos/recipe/generic_mysql/__init__.py
View file @
bc5cb1e6
...
@@ -53,6 +53,15 @@ class Recipe(GenericBaseRecipe):
...
@@ -53,6 +53,15 @@ class Recipe(GenericBaseRecipe):
else
:
else
:
networking
=
'skip-networking'
networking
=
'skip-networking'
log_bin
=
self
.
options
.
get
(
'binlog-path'
,
''
)
if
log_bin
:
log_bin
=
'log_bin = %s'
%
log_bin
expire_logs_days
=
self
.
options
.
get
(
'binlog-expire-days'
)
if
expire_logs_days
>
0
:
expire_logs_days
=
'expire_logs_days = %s'
%
expire_logs_days
else
:
expire_logs_days
=
''
mysql_conf_file
=
self
.
createFile
(
mysql_conf_file
=
self
.
createFile
(
self
.
options
[
'conf-file'
],
self
.
options
[
'conf-file'
],
self
.
substituteTemplate
(
template_filename
,
{
self
.
substituteTemplate
(
template_filename
,
{
...
@@ -62,6 +71,8 @@ class Recipe(GenericBaseRecipe):
...
@@ -62,6 +71,8 @@ class Recipe(GenericBaseRecipe):
'socket'
:
self
.
options
[
'socket'
],
'socket'
:
self
.
options
[
'socket'
],
'error_log'
:
self
.
options
[
'error-log'
],
'error_log'
:
self
.
options
[
'error-log'
],
'slow_query_log'
:
self
.
options
[
'slow-query-log'
],
'slow_query_log'
:
self
.
options
[
'slow-query-log'
],
'log_bin'
:
log_bin
,
'expire_logs_days'
:
expire_logs_days
,
})
})
)
)
path_list
.
append
(
mysql_conf_file
)
path_list
.
append
(
mysql_conf_file
)
...
...
slapos/recipe/generic_mysql/template/my.cnf.in
View file @
bc5cb1e6
...
@@ -48,9 +48,8 @@ innodb_locks_unsafe_for_binlog = 1
...
@@ -48,9 +48,8 @@ innodb_locks_unsafe_for_binlog = 1
#innodb_doublewrite = 0
#innodb_doublewrite = 0
#sync_frm = 0
#sync_frm = 0
# Uncomment the following if you need binary logging, which is recommended
%(log_bin)s
# on production instances (either for replication or incremental backups).
%(expire_logs_days)s
#log-bin=mysql-bin
# Force utf8 usage
# Force utf8 usage
collation_server = utf8_unicode_ci
collation_server = utf8_unicode_ci
...
...
stack/erp5/buildout.cfg
View file @
bc5cb1e6
...
@@ -18,6 +18,7 @@ extends =
...
@@ -18,6 +18,7 @@ extends =
../../component/gzip/buildout.cfg
../../component/gzip/buildout.cfg
../../component/haproxy/buildout.cfg
../../component/haproxy/buildout.cfg
../../component/hookbox/buildout.cfg
../../component/hookbox/buildout.cfg
../../component/findutils/buildout.cfg
../../component/librsvg/buildout.cfg
../../component/librsvg/buildout.cfg
../../component/imagemagick/buildout.cfg
../../component/imagemagick/buildout.cfg
../../component/inkscape/buildout.cfg
../../component/inkscape/buildout.cfg
...
@@ -68,6 +69,7 @@ parts =
...
@@ -68,6 +69,7 @@ parts =
apache
apache
apache-antiloris
apache-antiloris
file
file
findutils
graphviz
graphviz
haproxy
haproxy
jsl
jsl
...
@@ -148,10 +150,11 @@ context =
...
@@ -148,10 +150,11 @@ context =
[template-mariadb]
[template-mariadb]
< = template-jinja2-base
< = template-jinja2-base
filename = instance-mariadb.cfg
filename = instance-mariadb.cfg
md5sum =
e0c923a8195b5a36c7df766c1fb4bfdb
md5sum =
94b4b4e30ce70077c5601f16d3f96f74
extra-context =
extra-context =
key coreutils_location coreutils:location
key coreutils_location coreutils:location
key dcron_location dcron:location
key dcron_location dcron:location
key findutils_location findutils:location
key gettext_location gettext:location
key gettext_location gettext:location
key grep_location grep:location
key grep_location grep:location
key gzip_location gzip:location
key gzip_location gzip:location
...
...
stack/erp5/instance-mariadb.cfg.in
View file @
bc5cb1e6
...
@@ -7,6 +7,7 @@ parts =
...
@@ -7,6 +7,7 @@ parts =
cron
cron
cron-entry-logrotate
cron-entry-logrotate
cron-entry-mariadb-backup
cron-entry-mariadb-backup
cron-entry-mariadb-backup-expire
binary-link
binary-link
promise
promise
...
@@ -18,14 +19,44 @@ offline = true
...
@@ -18,14 +19,44 @@ offline = true
recipe = slapos.cookbook:publishurl
recipe = slapos.cookbook:publishurl
url = mysql://${mariadb-instance:user}:${mariadb-instance:password}@${mariadb-instance:ip}:${mariadb-instance:port}/${mariadb-instance:database}
url = mysql://${mariadb-instance:user}:${mariadb-instance:password}@${mariadb-instance:ip}:${mariadb-instance:port}/${mariadb-instance:database}
[binary-wrap-base]
recipe = slapos.cookbook:wrapper
# Note: --defaults-file must be the first argument, otherwise wrapped binary
# will reject it.
command-line = "{{ mariadb_location }}/bin/${:command}" --defaults-file="${mariadb-instance:conf-file}"
wrapper-path = ${rootdirectory:bin}/${:command}
parameters-extra = true
[binary-wrap-mysqldump]
< = binary-wrap-base
command = mysqldump
[cron-entry-mariadb-backup]
[cron-entry-mariadb-backup]
<= cron
recipe = slapos.cookbook:cron.d
recipe = slapos.cookbook:cron.d
cron-entries = ${cron:cron-entries}
name = mariadb-backup
name = mariadb-backup
frequency = 0 0 * * *
frequency = 0 22 * * *
command = ${mariadb-instance:backup-script}
{# When binlogs are enabled:
# flush-logs: used so no manipulation on binlogs is needed to restore from
# full + binlogs. The first binlog after a dump starts from dump snapshot and
# can be fully restored.
# master-data: use value "2" as we are not in a replication case
#}
command = "${binary-wrap-mysqldump:wrapper-path}" -u root --all-databases --single-transaction --flush-logs --master-data=2 --socket=${mariadb-instance:socket} | {{ gzip_location }}/bin/gzip > "${directory:mariadb-backup-full}/$({{ coreutils_location }}/bin/date "+%Y%m%d%H%M%S").sql.gz"
{# KEEP GLOB PATTERN IN SYNC with generated filenames above
# YYYYmmddHHMMSS -#}
file-glob = ??????????????.sql.gz
[cron-entry-mariadb-backup-expire]
recipe = slapos.cookbook:cron.d
cron-entries = ${cron:cron-entries}
name = mariadb-backup-expire
frequency = 0 22 * * *
command = {{ findutils_location }}/bin/find "${directory:mariadb-backup-full}" -maxdepth 1 -name "${cron-entry-mariadb-backup:file-glob}" -daystart -mtime +7 -delete
[mariadb-instance]
[mariadb-instance]
# XXX: remove backup part of this recipe. Backup part is now done in previous sections.
# Keeping it is harmless because it is supposed to be launched by cron entry, which has been removed.
recipe = slapos.cookbook:generic.mysql
recipe = slapos.cookbook:generic.mysql
# Options
# Options
...
@@ -39,6 +70,11 @@ test-database = erp5_test
...
@@ -39,6 +70,11 @@ test-database = erp5_test
mysql-test-database-base = testdb
mysql-test-database-base = testdb
mysql-test-user-base = testuser
mysql-test-user-base = testuser
# Backup
binlog-path = ${directory:mariadb-backup-incremental}/binlog
# XXX: binlog rotation happens along with other log's rotation
binlog-expire-days = 7
# Paths
# Paths
wrapper = ${basedirectory:services}/mariadb
wrapper = ${basedirectory:services}/mariadb
update-wrapper = ${basedirectory:services}/mariadb_update
update-wrapper = ${basedirectory:services}/mariadb_update
...
...
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