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
Titouan Soulard
slapos
Commits
e6f228a3
Commit
e6f228a3
authored
Jun 07, 2013
by
Cédric Le Ninivin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve slaprunner resilient recipe
parent
d519b13e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
8 deletions
+41
-8
slapos/recipe/slaprunner/backup.py
slapos/recipe/slaprunner/backup.py
+30
-6
software/slaprunner/common.cfg
software/slaprunner/common.cfg
+2
-0
software/slaprunner/instance-runner-export.cfg.in
software/slaprunner/instance-runner-export.cfg.in
+3
-0
software/slaprunner/instance-runner-import.cfg.in
software/slaprunner/instance-runner-import.cfg.in
+6
-2
No files found.
slapos/recipe/slaprunner/backup.py
View file @
e6f228a3
##############################################################################
#
# Copyright (c) 2013 Vifib SARL and Contributors. All Rights Reserved.
...
...
@@ -57,8 +58,24 @@ class ExportRecipe(GenericBaseRecipe):
content
=
textwrap
.
dedent
(
"""
\
#!%(shell-binary)s
umask 077
cd ~/%(srv-directory)s/ ;
\
\
tar --exclude=runner/software/* -czf %(backup-directory)s/runner.tgz runner/
sync_element () {
path=$1
backup_path=$2
shift 2
element_list=$*
for element in $element_list
do
cd $path;
if [ -f $element ] || [ -d $element ]; then
%(rsync-binary)s -avz --safe-links $element $backup_path;
fi
done
}
sync_element %(srv-directory)s/runner %(backup-directory)s/runner/ instance project proxy.db softwareLink
sync_element %(etc-directory)s %(backup-directory)s/etc/ .rcode .project .users
if [ -d %(backup-directory)s/runner/software ]; then
rm %(backup-directory)s/runner/software/*
fi
"""
%
self
.
options
)
self
.
createExecutable
(
wrapper
,
content
=
content
)
...
...
@@ -88,10 +105,17 @@ class ImportRecipe(GenericBaseRecipe):
Create a script to restore the database from 'custom' format.
"""
content
=
textwrap
.
dedent
(
"""
\
#!%(shell-binary)s
\
\
umask 077
\
\
cd ~/%(srv-directory)s/ ;
\
\
tar -xzf %(backup-directory)s/runner.tgz runner/ ;
\
\
#!%(shell-binary)s
umask 077
cd %(backup-directory)s;
%(rsync-binary)s -avz --delete runner/ %(srv-directory)s/runner;
%(rsync-binary)s -avz etc/ %(etc-directory)s;
ifs=$IFS IFS=';'
read user pass remaining < %(etc-directory)s/.users
IFS=$ifs
trap 'rm -f login_cookie' EXIT
%(curl-binary)s -vg6L -F clogin="$user" -F cpwd="$pass" --dump-header login_cookie %(backend-url)s/doLogin;
%(curl-binary)s -vg6LX POST --cookie login_cookie --max-time 5 %(backend-url)s/runSoftwareProfile;
"""
%
self
.
options
)
self
.
createExecutable
(
wrapper
,
content
=
content
)
...
...
software/slaprunner/common.cfg
View file @
e6f228a3
[buildout]
extends =
../../component/cloud9/buildout.cfg
../../component/curl/buildout.cfg
../../component/dash/buildout.cfg
../../component/dropbear/buildout.cfg
../../component/git/buildout.cfg
...
...
@@ -12,6 +13,7 @@ extends =
../../stack/slapos.cfg
parts =
rdiff-backup
template
slapos-cookbook
eggs
...
...
software/slaprunner/instance-runner-export.cfg.in
View file @
e6f228a3
...
...
@@ -11,8 +11,11 @@ parts +=
recipe = slapos.cookbook:slaprunner.export
wrapper = $${directory:bin}/$${slap-parameter:namebase}-exporter
srv-directory = $${directory:srv}
etc-directory = $${directory:etc}
backup-directory = $${directory:backup}
shell-binary = ${dash:location}/bin/dash
rsync-binary = ${rsync:location}/bin/rsync
# Extends publish section with resilient parameters
[urls]
...
...
software/slaprunner/instance-runner-import.cfg.in
View file @
e6f228a3
...
...
@@ -10,7 +10,11 @@ parts +=
[importer]
recipe = slapos.cookbook:slaprunner.import
wrapper = $${directory:bin}/$${slap-parameter:namebase}-
ex
porter
wrapper = $${directory:bin}/$${slap-parameter:namebase}-
im
porter
srv-directory = $${directory:srv}
etc-directory = $${directory:etc}
backup-directory = $${directory:backup}
shell-binary = ${dash:location}/bin/dash
\ No newline at end of file
shell-binary = ${dash:location}/bin/dash
rsync-binary = ${rsync:location}/bin/rsync
curl-binary = ${curl:location}/bin/curl
backend-url = $${slaprunner:access-url}
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