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
Thomas Leymonerie
slapos
Commits
2c3efd8c
Commit
2c3efd8c
authored
Jan 13, 2012
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Configure mydumper automated backup.
parent
bb405f53
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
68 additions
and
62 deletions
+68
-62
component/mydumper/buildout.cfg
component/mydumper/buildout.cfg
+8
-7
slapos/recipe/bef_erp5/__init__.py
slapos/recipe/bef_erp5/__init__.py
+25
-54
software/erp5/instance-mariadb.cfg
software/erp5/instance-mariadb.cfg
+31
-0
software/erp5/software.cfg
software/erp5/software.cfg
+1
-1
stack/erp5.cfg
stack/erp5.cfg
+3
-0
No files found.
component/mydumper/buildout.cfg
View file @
2c3efd8c
...
...
@@ -4,7 +4,7 @@ extends =
../cmake/buildout.cfg
../glib/buildout.cfg
../pcre/buildout.cfg
../m
ariadb
/buildout.cfg
../m
ysql-tritonn-5.0
/buildout.cfg
parts = mydumper
...
...
@@ -17,13 +17,13 @@ url = http://launchpad.net/mydumper/0.2/0.2.3/+download/mydumper-0.2.3.tar.gz
md5sum = 36e6a1c97a9634a6882ddaac5e2697d5
buildout-bin-dir = ${buildout:bin-directory}
cmake-command = ${cmake:location}/bin/cmake
mysql-config = ${m
ariadb
:location}/bin/mysql_config
mysql-config = ${m
ysql-tritonn-5.0
:location}/bin/mysql_config
doc-dependency = ${mydumper-doc:eggs}
mysqllib = ${m
ariadb
:location}/lib
mysqllib = ${m
ysql-tritonn-5.0
:location}/lib
pkg-config-path = ${glib:location}/lib/pkgconfig/:${pcre:location}/lib/pkgconfig/
libraries = ${zlib:location}/lib/:${glib:location}/lib/:${pcre:location}/lib/:${m
ariadb
:location}/lib/mysql/
includes = ${zlib:location}/include/:${glib:location}/include/:${pcre:location}/include/:${m
ariadb
:location}/include/mysql/
cflags = -I${zlib:location}/include/ -I${glib:location}/include/ -I${pcre:location}/include/ -I${m
ariadb
:location}/include/mysql/
libraries = ${zlib:location}/lib/:${glib:location}/lib/:${pcre:location}/lib/:${m
ysql-tritonn-5.0
:location}/lib/mysql/
includes = ${zlib:location}/include/:${glib:location}/include/:${pcre:location}/include/:${m
ysql-tritonn-5.0
:location}/include/mysql/
cflags = -I${zlib:location}/include/ -I${glib:location}/include/ -I${pcre:location}/include/ -I${m
ysql-tritonn-5.0
:location}/include/mysql/
slapos_promise =
directory:bin
file:bin/mydumper
...
...
@@ -55,6 +55,7 @@ eggs =
Sphinx
dependent-scripts = true
# XXX-Antoine: here's what I did using hexagonit.recipe.cmmi.
# and it wasn't working !
#[mydumper]
...
...
@@ -66,7 +67,7 @@ dependent-scripts = true
#configure-command =
# ${cmake:location}/bin/cmake \
# -DCMAKE_INSTALL_PREFIX=${:location} \
# -DMYSQL_CONFIG=${m
ariadb
:location}/bin/mysql_config \
# -DMYSQL_CONFIG=${m
ysql-tritonn-5.0
:location}/bin/mysql_config \
# -DCMAKE_INCLUDE_PATH=${zlib:location}/include \
# -DCMAKE_LIBRARY_PATH=${zlib:location}/lib \
# .
...
...
slapos/recipe/bef_erp5/__init__.py
View file @
2c3efd8c
...
...
@@ -88,31 +88,31 @@ class Recipe(slapos.recipe.erp5.Recipe):
))
return
self
.
path_list
def
installMysqldumpBackup
(
self
):
backup_directory
=
self
.
createBackupDirectory
(
'mysqldump'
)
environment
=
dict
(
PATH
=
'%s'
%
self
.
bin_directory
)
executable
=
os
.
path
.
join
(
self
.
bin_directory
,
'mysqldump'
)
mysql_socket
=
os
.
path
.
join
(
self
.
var_directory
,
'run'
,
'mysqld.sock'
)
mysqldump_opt
=
[
'-u'
,
'root'
,
'-S'
,
mysql_socket
,
'--single-transaction'
,
'--no-autocommit'
,
'--opt'
]
mysqldump_cron
=
os
.
path
.
join
(
self
.
cron_d
,
'mysqldump'
)
database
=
'sanef_dms'
cronfile
=
open
(
mysqldump_cron
,
'w'
)
cronfile
.
write
(
"0 0 * * * %(mysqldump)s %(mysqldump_opt)s %(database)s | %(gzip)s > %(destination)s
\
n
"
%
dict
(
mysqldump
=
executable
,
mysqldump_opt
=
' '
.
join
(
mysqldump_opt
),
database
=
database
,
gzip
=
self
.
options
[
'gzip_binary'
],
destination
=
os
.
path
.
join
(
backup_directory
,
'%s.sql.gz'
%
database
)
))
for
table
in
[
'message'
,
'message_queue'
,
'portal_ids'
]:
destination
=
os
.
path
.
join
(
backup_directory
,
'%s.%s.sql.gz'
%
(
database
,
table
))
cronfile
.
write
(
"0 0 * * * %(mysqldump)s %(mysqldump_opt)s %(database)s %(table)s | %(gzip)s > %(destination)s
\
n
"
%
dict
(
mysqldump
=
executable
,
mysqldump_opt
=
' '
.
join
(
mysqldump_opt
),
database
=
database
,
gzip
=
self
.
options
[
'gzip_binary'
],
table
=
table
,
destination
=
destination
)
)
cronfile
.
close
()
self
.
path_list
.
append
(
mysqldump_cron
)
#
def installMysqldumpBackup(self):
#
backup_directory = self.createBackupDirectory('mysqldump')
#
environment = dict(PATH='%s' % self.bin_directory)
#
executable = os.path.join(self.bin_directory, 'mysqldump')
#
mysql_socket = os.path.join(self.var_directory, 'run', 'mysqld.sock')
#
mysqldump_opt = ['-u', 'root', '-S', mysql_socket, '--single-transaction',
#
'--no-autocommit', '--opt']
#
mysqldump_cron = os.path.join(self.cron_d, 'mysqldump')
#
database = 'sanef_dms'
#
cronfile = open(mysqldump_cron, 'w')
#
cronfile.write("0 0 * * * %(mysqldump)s %(mysqldump_opt)s %(database)s | %(gzip)s > %(destination)s\n" % dict(
#
mysqldump=executable, mysqldump_opt=' '.join(mysqldump_opt),
#
database=database, gzip=self.options['gzip_binary'],
#
destination=os.path.join(backup_directory, '%s.sql.gz' % database)
#
))
#
for table in ['message', 'message_queue', 'portal_ids']:
#
destination = os.path.join(backup_directory, '%s.%s.sql.gz' % (database,
#
table))
#
cronfile.write("0 0 * * * %(mysqldump)s %(mysqldump_opt)s %(database)s %(table)s | %(gzip)s > %(destination)s\n" % dict(
#
mysqldump=executable, mysqldump_opt=' '.join(mysqldump_opt),
#
database=database, gzip=self.options['gzip_binary'],
#
table=table, destination=destination)
#
)
#
cronfile.close()
#
self.path_list.append(mysqldump_cron)
def
installDevelopmentEnvironment
(
self
):
ca_conf
=
self
.
installCertificateAuthority
()
...
...
@@ -161,32 +161,3 @@ class Recipe(slapos.recipe.erp5.Recipe):
development_zope
=
'http://%s:%s/'
%
(
ip
,
zope_port
)
))
return
self
.
path_list
def
_install
(
self
):
self
.
path_list
=
[]
self
.
requirements
,
self
.
ws
=
self
.
egg
.
working_set
()
# self.cron_d is a directory, where cron jobs can be registered
self
.
cron_d
=
self
.
installCrond
()
self
.
logrotate_d
,
self
.
logrotate_backup
=
self
.
installLogrotate
()
self
.
killpidfromfile
=
zc
.
buildout
.
easy_install
.
scripts
(
[(
'killpidfromfile'
,
'slapos.recipe.erp5.killpidfromfile'
,
'killpidfromfile'
)],
self
.
ws
,
sys
.
executable
,
self
.
bin_directory
)[
0
]
self
.
path_list
.
append
(
self
.
killpidfromfile
)
self
.
linkBinary
()
self
.
installBT5Repo
()
if
self
.
parameter_dict
.
get
(
'production_mysql'
,
'false'
).
lower
()
==
'true'
:
self
.
development
=
False
return
self
.
installProductionMysql
()
elif
self
.
parameter_dict
.
get
(
'production_application'
,
'false'
).
lower
()
==
'true'
:
self
.
development
=
False
return
self
.
installProductionApplication
()
elif
self
.
parameter_dict
.
get
(
'production_frontend'
,
'false'
).
lower
()
==
'true'
:
self
.
development
=
False
return
self
.
installProductionFrontend
()
elif
self
.
parameter_dict
.
get
(
'development'
,
'true'
).
lower
()
==
'true'
:
self
.
development
=
True
return
self
.
installDevelopmentEnvironment
()
else
:
raise
NotImplementedError
(
'Flavour of instance have to be given.'
)
software/erp5/instance-mariadb.cfg
View file @
2c3efd8c
...
...
@@ -2,11 +2,13 @@
parts =
publish-mariadb-url
mariadb-instance
mydumper-import
logrotate
logrotate-entry-mariadb
cron
cron-entry-logrotate
cron-entry-mariadb-backup
cron-entry-mariadb-mydumperbackup
binary-link
eggs-directory = ${buildout:eggs-directory}
...
...
@@ -90,6 +92,34 @@ pt-visual-explain-binary = ${perl:siteprefix}/bin/pt-visual-explain
xtrabackup-binary = ${xtrabackup:location}/bin/xtrabackup_51
perl-binary = ${perl:location}/bin/perl
[mydumper]
recipe = slapos.cookbook:mydumper
wrapper = $${rootdirectory:bin}/raw_mydumper
backup-directory = $${directory:mariadb-backup}
socket = $${mariadb-instance:socket}
user = root
mydumper-binary = ${mydumper:location}/bin/mydumper
database = $${mariadb-instance:database}
import = false
compression = true
[cron-entry-mariadb-mydumperbackup]
<= cron
recipe = slapos.cookbook:cron.d
name = backup
frequency = 0 * * * *
command = $${mydumper:wrapper}
[mydumper-import]
recipe = slapos.cookbook:mydumper
wrapper = $${rootdirectory:bin}/myloader
backup-directory = $${directory:mariadb-backup}
socket = $${mariadb-instance:socket}
user = root
myloader-binary = ${mydumper:location}/bin/myloader
database = $${mariadb-instance:database}
import = true
[logrotate]
recipe = slapos.cookbook:logrotate
# Binaries
...
...
@@ -167,6 +197,7 @@ crontabs = $${rootdirectory:etc}/crontabs
cronstamps = $${rootdirectory:etc}/cronstamps
cronoutput = $${basedirectory:log}/cron
ca-dir = $${rootdirectory:srv}/ssl
mariadb-backup = $${basedirectory:backup}/mariadb
mariadb-backup-full = $${basedirectory:backup}/mariadb-full
mariadb-backup-incremental = $${basedirectory:backup}/mariadb-incremental
mariadb-data = $${rootdirectory:srv}/mariadb
...
...
software/erp5/software.cfg
View file @
2c3efd8c
...
...
@@ -61,7 +61,7 @@ command = grep parts ${buildout:develop-eggs-directory}/z2loganalyser.egg-link
[template-mariadb]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-mariadb.cfg
md5sum =
17c71c2488d280267ad5130cfa22f52f
md5sum =
33a4096149f89d8e36e3709627d9969c
output = ${buildout:directory}/template-mariadb.cfg
mode = 0644
...
...
stack/erp5.cfg
View file @
2c3efd8c
...
...
@@ -72,6 +72,7 @@ extends =
../component/sed/buildout.cfg
../component/coreutils/buildout.cfg
../component/grep/buildout.cfg
../component/mydumper/buildout.cfg
versions = versions
...
...
@@ -106,6 +107,7 @@ parts =
zabbix-agent
pdftk
dcron
mydumper
# Buildoutish
eggs
...
...
@@ -476,3 +478,4 @@ setuptools =
# official pysvn egg does not supports --include-dirs and
# --library-dirs, so we use our modified version
pysvn = 1.7.4nxd006
Sphinx = 1.1.2
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