Commit 6430a8fd authored by Cédric de Saint Martin's avatar Cédric de Saint Martin

Merge branch 'master' into erp5-component

Conflicts:
	component/rpm2cpio/buildout.cfg
	component/slapos/buildout.cfg
	setup.py
	slapos/recipe/6tunnel/__init__.py
	slapos/recipe/request.py
	stack/slapos.cfg
parents 2d95f58e c42de3f4
Changes Changes
======= =======
0.71.1 (2013-01-04)
-------------------
* Frontend: Sort instances by reference to avoid attacks. [Cedric de Saint
Martin]
* Frontend: Add public_ipv4 parameter support to ease deployment of slave
frontend. [Cedric de Saint Martin]
* Frontend: Move apache_frontend wrappers to watched directory (etc/service).
[Cedric de Saint Martin]
* Frontend: Add native path to varnish environment. [Cedric de Saint Martin]
0.71 (2012-12-20)
-----------------
* frontend: Add "path" parameter for Zope instances. [Cedric de Saint Martin]
0.70 (2012-11-05)
-----------------
* KVM: Add support for disk-type, second nbd and cpu-count. [Cedric de Saint
Martin]
0.69 (2012-10-30)
-----------------
* handle multiple notification_url values in notifier recipe [Marco Mariani]
* createWrapper() sh alternative to execute.execute() for simple cases
[Marco Mariani]
* fixed secret key generation in apachephp config [Marco Mariani]
0.68.1 (2012-10-03)
-------------------
* slaprunner: fix "logfile" parameter to "log_file"
0.68 (2012-10-02)
-----------------
* request.py: Remove useless calls to master, fix "update" method. [Cedric
de Saint Martin]
* Add webrunner test recipe. [Alain Takoudjou]
* Add logfile for slaprunner. [Cedric de Saint Martin]
* Fix check_url_available promise (syntax + checks + IPv6 support). [Cedric
de Saint Martin]
0.67 (2012-09-26)
-----------------
* Add check_page_content promise generator. [Cedric Le Ninivin]
* Fix check_url_available recipe. [Cedric de Saint Martin]
* Set up timezone database in mariab's mysql table so that we can use
timezone conversion function. [Kazuhiko Shiozaki]
* Add many resiliency-based recipes [Timothée Lacroix]
* Fix and unify request and requestoptional recipes [Cedric de Saint Martin]
* Fix Dropbear. [Antoine Catton]
0.66 (2012-09-10) 0.66 (2012-09-10)
----------------- -----------------
......
[buildout]
parts = apache-perl
extends =
../apache/buildout.cfg
../perl/buildout.cfg
../libuuid/buildout.cfg
[apache-perl]
# Note: Shall react on each build of apache and reinstall itself
recipe = hexagonit.recipe.cmmi
url = http://perl.apache.org/dist/mod_perl-2.0.5.tar.gz
md5sum = 03d01d135a122bd8cebd0cd5b185d674
configure-command =
${perl:location}/bin/perl Makefile.PL
configure-options =
MP_AP_PREFIX=${apache-2.2:location}
environment =
# CPPFLAGS=-I${libuuid:location}/include
MP_CCOPTS=-L${libuuid:location}/lib
...@@ -55,10 +55,50 @@ configure-options = ...@@ -55,10 +55,50 @@ configure-options =
--enable-bz2 --enable-bz2
--enable-ftp --enable-ftp
# Changing TMPDIR is required for PEAR installation.
# It will create a pear/temp directory under the SR instead of a shared /tmp/pear/temp.
# XXX we could mkdir tmp there
environment = environment =
PKG_CONFIG_PATH=${libxml2:location}/lib/pkgconfig:${openssl:location}/lib/pkgconfig PKG_CONFIG_PATH=${libxml2:location}/lib/pkgconfig:${openssl:location}/lib/pkgconfig
PATH=${pkgconfig:location}/bin:${bzip2:location}/bin:${libxml2:location}/bin:%(PATH)s PATH=${pkgconfig:location}/bin:${bzip2:location}/bin:${libxml2:location}/bin:%(PATH)s
LDFLAGS =-L${bzip2:location}/lib -Wl,-rpath -Wl,${bzip2:location}/lib -L${libtool:location}/lib -Wl,-rpath -Wl,${libtool:location}/lib -L${mariadb:location}/lib -Wl,-rpath -Wl,${mariadb:location}/lib -L${zlib:location}/lib -Wl,-rpath -Wl,${zlib:location}/lib -L${libmcrypt:location}/lib -Wl,-rpath -Wl,${libmcrypt:location}/libblkid LDFLAGS =-L${bzip2:location}/lib -Wl,-rpath -Wl,${bzip2:location}/lib -L${libtool:location}/lib -Wl,-rpath -Wl,${libtool:location}/lib -L${mariadb:location}/lib -Wl,-rpath -Wl,${mariadb:location}/lib -L${zlib:location}/lib -Wl,-rpath -Wl,${zlib:location}/lib -L${libmcrypt:location}/lib -Wl,-rpath -Wl,${libmcrypt:location}/libblkid
TMPDIR=${buildout:parts-directory}/${:_buildout_section_name_}
[apache-php-postgres]
<=apache-php
configure-options =
--with-apxs2=${apache:location}/bin/apxs
--with-libxml-dir=${libxml2:location}
--with-zlib-dir=${zlib:location}
--with-bz2-dir=${bzip2:location}
--with-mcrypt=${libmcrypt:location}
--with-gd
--with-jpeg-dir=${libjpeg:location}
--with-png-dir=${libpng:location}
--enable-gd-native-ttf
--with-ttf
--with-freetype-dir=${freetype:location}
--with-curl=${curl:location}
--with-zip-dir=${zip:location}
--with-imap=${cclient:location}
--with-iconv-dir=${libiconv:location}
--with-gettext=${gettext:location}
--with-ldap=${openldap:location}
--with-imap-ssl
--with-openssl=${openssl:location}
--enable-libxml
--enable-mbstring
--enable-session
--enable-exif
--enable-zip
--enable-bz2
--enable-ftp
--with-pgsql=${postgresql:location}
[libmcrypt] [libmcrypt]
......
...@@ -87,7 +87,7 @@ configure-options = --prefix=${buildout:parts-directory}/${:_buildout_section_na ...@@ -87,7 +87,7 @@ configure-options = --prefix=${buildout:parts-directory}/${:_buildout_section_na
environment = environment =
PATH=${pkgconfig:location}/bin:%(PATH)s PATH=${pkgconfig:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${openssl:location}/lib/pkgconfig PKG_CONFIG_PATH=${openssl:location}/lib/pkgconfig
CPPFLAGS =-I${libuuid:location}/include CPPFLAGS =-I${libuuid:location}/include -I${openssl:location}/include
LDFLAGS =-Wl,-rpath=${zlib:location}/lib -Wl,-rpath=${openssl:location}/lib -L${libuuid:location}/lib -Wl,-rpath=${libuuid:location}/lib -Wl,-rpath=${libexpat:location}/lib -Wl,-rpath=${pcre:location}/lib -Wl,-rpath=${sqlite3:location}/lib -Wl,-rpath=${gdbm:location}/lib LDFLAGS =-Wl,-rpath=${zlib:location}/lib -Wl,-rpath=${openssl:location}/lib -L${libuuid:location}/lib -Wl,-rpath=${libuuid:location}/lib -Wl,-rpath=${libexpat:location}/lib -Wl,-rpath=${pcre:location}/lib -Wl,-rpath=${sqlite3:location}/lib -Wl,-rpath=${gdbm:location}/lib
[mod_antiloris-apache-2.4.patch] [mod_antiloris-apache-2.4.patch]
......
...@@ -5,7 +5,7 @@ parts = busybox ...@@ -5,7 +5,7 @@ parts = busybox
[busybox] [busybox]
recipe = slapos.recipe.build recipe = slapos.recipe.build
url = http://git.busybox.net/busybox/snapshot/busybox-1_20_1.tar.gz url = http://git.busybox.net/busybox/snapshot/busybox-1_20_1.tar.gz
md5sum = 15758fc37ae8051d6def1b8afb691821 md5sum = 2dcfee8add6b9c52d6a91e97ba705b66
script = script =
extract_dir = self.extract(self.download(%(url)r, %(md5sum)r)) extract_dir = self.extract(self.download(%(url)r, %(md5sum)r))
workdir = guessworkdir(extract_dir) workdir = guessworkdir(extract_dir)
......
...@@ -10,10 +10,10 @@ parts = ...@@ -10,10 +10,10 @@ parts =
cclient cclient
[cclient-patch] [cclient-patch]
recipe = slapos.recipe.download recipe = hexagonit.recipe.download
download-only = true
url = ${:_profile_base_location_}/imap-2007f.patch url = ${:_profile_base_location_}/imap-2007f.patch
md5sum = 42c77fdd5d7a976fc302b93aadb3da98 md5sum = 42c77fdd5d7a976fc302b93aadb3da98
location = ${buildout:parts-directory}/${:_buildout_section_name_}
filename = imap-2007f.patch filename = imap-2007f.patch
[cclient] [cclient]
......
...@@ -16,7 +16,7 @@ parts = ...@@ -16,7 +16,7 @@ parts =
[node-sm] [node-sm]
recipe = slapos.recipe.build:npm recipe = slapos.recipe.build:npm
packages = sm@0.2.7 packages = sm@0.2.11
node = nodejs node = nodejs
environment = environment =
PATH=${nodejs:location}/bin:%(PATH)s PATH=${nodejs:location}/bin:%(PATH)s
...@@ -25,10 +25,10 @@ environment = ...@@ -25,10 +25,10 @@ environment =
# Online IDE written in javascript/node.js # Online IDE written in javascript/node.js
# URL : c9.io # URL : c9.io
# You can use it using the following command : # You can use it using the following command :
# NODE_PATH=${:destination}/node_modules ${nodejs:node_location} ${:cloud9_js_location} # NODE_PATH=${:destination}/node_modules ${nodejs:node_location} ${:cloud9_js_location}
recipe = plone.recipe.command recipe = plone.recipe.command
stop-on-error = true stop-on-error = true
commit = 97db1467c517d265438684bd2a70b0b76ee282f6 commit = 5d18344936baf1d86b0fa5fc2c690051b4c77cb2
repository = https://github.com/ajaxorg/cloud9.git repository = https://github.com/ajaxorg/cloud9.git
location = ${buildout:parts-directory}/${:_buildout_section_name_} location = ${buildout:parts-directory}/${:_buildout_section_name_}
git-binary = ${git:location}/bin/git git-binary = ${git:location}/bin/git
...@@ -37,26 +37,33 @@ command = export GIT_SSL_NO_VERIFY=true; export HOME=${:location}; (${:git-binar ...@@ -37,26 +37,33 @@ command = export GIT_SSL_NO_VERIFY=true; export HOME=${:location}; (${:git-binar
update-command = update-command =
executable = ${:location}/bin/cloud9.js executable = ${:location}/bin/cloud9.js
[cloud9-session-directory.patch]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
filename = cloud9-session-directory.patch
download-only = true
md5sum = 5dc8cc28447ed3747b8a53c768d872aa
[cloud9-git] [cloud9-git]
# Online IDE written in javascript/node.js # Online IDE written in javascript/node.js
# URL : c9.io # URL : c9.io
# You can use it using the following command : # You can use it using the following command :
# NODE_PATH=${:destination}/node_modules ${nodejs:node_location} ${:cloud9_js_location} # NODE_PATH=${:destination}/node_modules ${nodejs:node_location} ${:cloud9_js_location}
recipe = plone.recipe.command recipe = plone.recipe.command
stop-on-error = true stop-on-error = true
commit = c66284221143c175fc889418d499da6f37492a7c commit = 6b0112363dd0f9523430808394a162d3cc699550
repository = https://github.com/ajaxorg/cloud9.git repository = https://github.com/ajaxorg/cloud9.git
location = ${buildout:parts-directory}/${:_buildout_section_name_} location = ${buildout:parts-directory}/${:_buildout_section_name_}
environment = export GIT_SSL_NO_VERIFY=true; export PATH=${git:location}/bin:${nodejs:location}/bin:${node-sm:location}/node_modules/sm/bin:$PATH; export CPPFLAGS="-I${libxml2:location}/include -I${nodejs:location}/include"; export LDFLAGS="-L${libxml2:location}/lib -Wl,-rpath=${libxml2:location}/lib"; export HOME=${:location}; environment = export GIT_SSL_NO_VERIFY=true; export PATH=${git:location}/bin:${nodejs:location}/bin:${node-sm:location}/node_modules/sm/bin:$PATH; export CPPFLAGS="-I${libxml2:location}/include -I${nodejs:location}/include"; export LDFLAGS="-L${libxml2:location}/lib -Wl,-rpath=${libxml2:location}/lib"; export HOME=${:location};
command = ${:environment} (git clone --quiet ${:repository} ${:location} && cd ${:location} && git reset --hard ${:commit} && ${node-sm:location}/node_modules/.bin/sm install) || (rm -fr ${:location}; exit 1) command = ${:environment} (git clone --quiet ${:repository} ${:location} && cd ${:location} && git reset --hard ${:commit} && ${node-sm:location}/node_modules/.bin/sm install && patch -p1 < ${cloud9-session-directory.patch:location}/${cloud9-session-directory.patch:filename}) || (rm -fr ${:location}; exit 1)
update-command = update-command =
executable = ${:location}/server.js executable = ${:location}/server.js
[cloud9-npm] [cloud9-npm]
# Online IDE written in javascript/node.js # Online IDE written in javascript/node.js
# URL : c9.io # URL : c9.io
# You can use it using the following command : # You can use it using the following command :
# NODE_PATH=${:destination}/node_modules ${nodejs:node_location} ${:cloud9_js_location} # NODE_PATH=${:destination}/node_modules ${nodejs:node_location} ${:cloud9_js_location}
recipe = slapos.recipe.npm recipe = slapos.recipe.npm
# Node part has to be specified, otherwise system node is used. # Node part has to be specified, otherwise system node is used.
node = nodejs node = nodejs
......
diff --git a/configs/default.js b/configs/default.js
index 6d1c85f..be35b37 100644
--- a/configs/default.js
+++ b/configs/default.js
@@ -22,6 +22,8 @@ var vfsUrl = "/vfs";
var port = argv.p || process.env.PORT || 3131;
var host = argv.l || process.env.IP || "localhost";
+var home = process.env['HOME']
+
var config = [
{
packagePath: "connect-architect/connect",
@@ -167,7 +169,7 @@ var config = [
},
{
packagePath: "connect-architect/connect.session.file",
- sessionsPath: __dirname + "/../.sessions"
+ sessionsPath: home + "/.sessions"
},
"./cloud9.permissions",
{
\ No newline at end of file
...@@ -12,8 +12,8 @@ parts = ...@@ -12,8 +12,8 @@ parts =
[git] [git]
recipe = hexagonit.recipe.cmmi recipe = hexagonit.recipe.cmmi
url = http://git-core.googlecode.com/files/git-1.7.10.4.tar.gz url = http://git-core.googlecode.com/files/git-1.7.12.tar.gz
md5sum = 68319d593d051ef76c26e945bbd2d7ac md5sum = ceb1a6b17a3e33bbc70eadf8fce5876c
configure-options = configure-options =
--with-curl=${curl:location} --with-curl=${curl:location}
--with-openssl=${openssl:location} --with-openssl=${openssl:location}
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
extends = extends =
../cmake/buildout.cfg ../cmake/buildout.cfg
../glib/buildout.cfg ../glib/buildout.cfg
../pkgconfig/buildout.cfg
../openssl/buildout.cfg ../openssl/buildout.cfg
../pcre/buildout.cfg ../pcre/buildout.cfg
../mariadb/buildout.cfg ../mariadb/buildout.cfg
...@@ -22,6 +23,7 @@ buildout-bin-dir = ${buildout:bin-directory} ...@@ -22,6 +23,7 @@ buildout-bin-dir = ${buildout:bin-directory}
cmake-command = ${cmake:location}/bin/cmake cmake-command = ${cmake:location}/bin/cmake
mysql-config = ${mariadb:location}/bin/mysql_config mysql-config = ${mariadb:location}/bin/mysql_config
mysqllib = ${mariadb:location}/lib mysqllib = ${mariadb:location}/lib
path = ${pkgconfig:location}/bin
pkg-config-path = ${glib:location}/lib/pkgconfig/:${pcre:location}/lib/pkgconfig/:${openssl:location}/lib/pkgconfig/ pkg-config-path = ${glib:location}/lib/pkgconfig/:${pcre:location}/lib/pkgconfig/:${openssl:location}/lib/pkgconfig/
libraries = ${zlib:location}/lib/:${glib:location}/lib/:${pcre:location}/lib/:${mariadb:location}/lib/:${openssl:location}/lib/ libraries = ${zlib:location}/lib/:${glib:location}/lib/:${pcre:location}/lib/:${mariadb:location}/lib/:${openssl:location}/lib/
includes = ${zlib:location}/include/:${glib:location}/include/:${pcre:location}/include/:${mariadb:location}/include:${openssl:location}/include/ includes = ${zlib:location}/include/:${glib:location}/include/:${pcre:location}/include/:${mariadb:location}/include:${openssl:location}/include/
...@@ -39,7 +41,7 @@ script = ...@@ -39,7 +41,7 @@ script =
extract_dir = self.extract(url) extract_dir = self.extract(url)
workdir = guessworkdir(extract_dir) workdir = guessworkdir(extract_dir)
self.applyPatchList(self.options['mydumper-patches'], cwd=workdir) self.applyPatchList(self.options['mydumper-patches'], cwd=workdir)
env['PATH'] = self.options['buildout-bin-dir'] + ':' + env.get('PATH', '') env['PATH'] = self.options['path'] + ':' + self.options['buildout-bin-dir'] + ':' + env.get('PATH', '')
env['PKG_CONFIG_PATH'] = self.options['pkg-config-path'] + ':' + \ env['PKG_CONFIG_PATH'] = self.options['pkg-config-path'] + ':' + \
env.get('PKG_CONFIG_PATH', '') env.get('PKG_CONFIG_PATH', '')
env['CMAKE_INCLUDE_PATH'] = self.options['includes'] env['CMAKE_INCLUDE_PATH'] = self.options['includes']
......
...@@ -3,7 +3,7 @@ parts = ...@@ -3,7 +3,7 @@ parts =
noVNC noVNC
[noVNC] [noVNC]
recipe = slapos.recipe.build:download-unpacked recipe = hexagonit.recipe.download
url = http://cloud.github.com/downloads/kanaka/noVNC/novnc-0.3.tar.gz url = http://cloud.github.com/downloads/kanaka/noVNC/novnc-0.4.tar.gz
md5sum = 95d3c58921fa188c179491e8ef2acc12 md5sum = 5703d5d46022d8723796dcbbf821ee7f
strip-top-level-dir = true strip-top-level-dir = true
...@@ -14,8 +14,8 @@ parts = ...@@ -14,8 +14,8 @@ parts =
[nodejs-0.8] [nodejs-0.8]
# Server-side Javascript. # Server-side Javascript.
recipe = hexagonit.recipe.cmmi recipe = hexagonit.recipe.cmmi
url = http://nodejs.org/dist/v0.8.8/node-v0.8.8.tar.gz url = http://nodejs.org/dist/v0.8.14/node-v0.8.14.tar.gz
md5sum = f4dae84e96a94b768404c14633bccd49 md5sum = 284fd2c7578064c339d9cf6a3a475ac7
configure-options = configure-options =
--openssl-includes=${openssl:location}/include --openssl-includes=${openssl:location}/include
--openssl-libpath=${openssl:location}/lib --openssl-libpath=${openssl:location}/lib
......
...@@ -9,6 +9,9 @@ extends = ...@@ -9,6 +9,9 @@ extends =
../glib/buildout.cfg ../glib/buildout.cfg
../popt/buildout.cfg ../popt/buildout.cfg
[pkg-config]
<= pkgconfig
[pkgconfig] [pkgconfig]
recipe = hexagonit.recipe.cmmi recipe = hexagonit.recipe.cmmi
url = http://pkgconfig.freedesktop.org/releases/pkg-config-0.27.1.tar.gz url = http://pkgconfig.freedesktop.org/releases/pkg-config-0.27.1.tar.gz
......
[buildout]
extends =
../openssl/buildout.cfg
../readline/buildout.cfg
../zlib/buildout.cfg
../ncurses/buildout.cfg
parts = postgresql
[postgresql]
<= postgresql92
[postgresql91]
recipe = hexagonit.recipe.cmmi
url = http://ftp.postgresql.org/pub/source/v9.1.7/postgresql-9.1.7.tar.bz2
md5sum = eaf7b67493d59d1a60767ffdfbd65ce9
configure-options = --with-openssl
environment =
CPPFLAGS=-I${zlib:location}/include -I${readline:location}/include -I${openssl:location}/include -I${ncurses:location}/lib
LDFLAGS=-L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib -L${readline:location}/lib -Wl,-rpath=${readline:location}/lib -L${openssl:location}/lib -Wl,-rpath=${openssl:location}/lib -L${ncurses:location}/lib -Wl,-rpath=${ncurses:location}/lib
[postgresql92]
recipe = hexagonit.recipe.cmmi
url = http://ftp.postgresql.org/pub/source/v9.2.2/postgresql-9.2.2.tar.bz2
md5sum = 1cc388988e69bf75c6b55d59070100f6
configure-options = --with-openssl
environment =
CPPFLAGS=-I${zlib:location}/include -I${readline:location}/include -I${openssl:location}/include -I${ncurses:location}/lib
LDFLAGS=-L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib -L${readline:location}/lib -Wl,-rpath=${readline:location}/lib -L${openssl:location}/lib -Wl,-rpath=${openssl:location}/lib -L${ncurses:location}/lib -Wl,-rpath=${ncurses:location}/lib
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
parts = python-setuptools parts = python-setuptools
[setuptools-download] [setuptools-download]
recipe = slapos.recipe.download recipe = hexagonit.recipe.download
download-only = true
filename = setuptools-0.6c11-py2.7.egg filename = setuptools-0.6c11-py2.7.egg
url = http://pypi.python.org/packages/2.7/s/setuptools/${:filename} url = http://pypi.python.org/packages/2.7/s/setuptools/${:filename}
md5sum = fe1f997bc722265116870bc7919059ea md5sum = fe1f997bc722265116870bc7919059ea
......
...@@ -3,6 +3,7 @@ parts = ...@@ -3,6 +3,7 @@ parts =
rpm2cpio rpm2cpio
[rpm2cpio] [rpm2cpio]
recipe = slapos.recipe.build:download recipe = hexagonit.recipe.download
download-only = true
url = https://raw.github.com/ruda/rpm2cpio/e196173f1f6b746463b7398e381b94a42edfa345/rpm2cpio.py url = https://raw.github.com/ruda/rpm2cpio/e196173f1f6b746463b7398e381b94a42edfa345/rpm2cpio.py
md5sum = c5bb6227d99e1ff5df880f997cbed2e3 md5sum = c5bb6227d99e1ff5df880f997cbed2e3
...@@ -27,6 +27,7 @@ parts = ...@@ -27,6 +27,7 @@ parts =
slapos slapos
cfg-environment cfg-environment
sh-environment sh-environment
py
find-links = find-links =
http://www.nexedi.org/static/packages/source/slapos.buildout/ http://www.nexedi.org/static/packages/source/slapos.buildout/
...@@ -48,13 +49,13 @@ exec-sitecustomize = false ...@@ -48,13 +49,13 @@ exec-sitecustomize = false
allowed-eggs-from-site-packages = allowed-eggs-from-site-packages =
[environment] [environment]
# Note: For now original PATH is appeneded to the end, as not all tools are # Note: For now original PATH is appended to the end, as not all tools are
# provided by SlapOS # provided by SlapOS
PATH=${bison:location}/bin:${bzip2:location}/bin:${gettext:location}/bin:${glib:location}/bin:${libxml2:location}/bin:${libxslt:location}/bin:${m4:location}/bin:${ncurses:location}/bin:${openssl:location}/bin:${pkgconfig:location}/bin:${python2.7:location}/bin:${readline:location}/bin:${sqlite3:location}/bin:${swig:location}/bin:${buildout:bin-directory}:${patch:location}/bin:$PATH PATH=${bison:location}/bin:${bzip2:location}/bin:${gettext:location}/bin:${glib:location}/bin:${libxml2:location}/bin:${libxslt:location}/bin:${m4:location}/bin:${ncurses:location}/bin:${openssl:location}/bin:${pkgconfig:location}/bin:${python2.7:location}/bin:${readline:location}/bin:${sqlite3:location}/bin:${swig:location}/bin:${buildout:bin-directory}:${patch:location}/bin:$PATH
CFLAGS=-I${bzip2:location}/include -I${gdbm:location}/include -I${gettext:location}/include -I${glib:location}/include -I${libxml2:location}/include -I${libxslt:location}/include -I${ncurses:location}/include -I${openssl:location}/include -I${popt:location}/include -I${readline:location}/include -I${sqlite3:location}/include -I${zlib:location}/include CFLAGS=-I${bzip2:location}/include -I${gdbm:location}/include -I${gettext:location}/include -I${glib:location}/include -I${libxml2:location}/include -I${libxslt:location}/include -I${ncurses:location}/include -I${openssl:location}/include -I${popt:location}/include -I${readline:location}/include -I${sqlite3:location}/include -I${zlib:location}/include
CPPFLAGS=${:CFLAGS} CPPFLAGS=${:CFLAGS}
LDFLAGS=-L${bzip2:location}/lib -Wl,-rpath=${bzip2:location}/lib -L${gdbm:location}/lib -Wl,-rpath=${gdbm:location}/lib -L${gettext:location}/lib -Wl,-rpath=${gettext:location}/lib -L${glib:location}/lib -Wl,-rpath=${glib:location}/lib -L${libxml2:location}/lib -Wl,-rpath=${libxml2:location}/lib -L${libxslt:location}/lib -Wl,-rpath=${libxslt:location}/lib -L${ncurses:location}/lib -Wl,-rpath=${ncurses:location}/lib -L${openssl:location}/lib -Wl,-rpath=${openssl:location}/lib -L${popt:location}/lib -Wl,-rpath=${popt:location}/lib -L${readline:location}/lib -Wl,-rpath=${readline:location}/lib -L${sqlite3:location}/lib -Wl,-rpath=${sqlite3:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib LDFLAGS=-L${bzip2:location}/lib -Wl,-rpath=${bzip2:location}/lib -L${gdbm:location}/lib -Wl,-rpath=${gdbm:location}/lib -L${gettext:location}/lib -Wl,-rpath=${gettext:location}/lib -L${glib:location}/lib -Wl,-rpath=${glib:location}/lib -L${libxml2:location}/lib -Wl,-rpath=${libxml2:location}/lib -L${libxslt:location}/lib -Wl,-rpath=${libxslt:location}/lib -L${ncurses:location}/lib -Wl,-rpath=${ncurses:location}/lib -L${openssl:location}/lib -Wl,-rpath=${openssl:location}/lib -L${popt:location}/lib -Wl,-rpath=${popt:location}/lib -L${readline:location}/lib -Wl,-rpath=${readline:location}/lib -L${sqlite3:location}/lib -Wl,-rpath=${sqlite3:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib
PKG_CONFIG_PATH=${glib:location}/lib/pkgconfig:${libxml2:location}/lib/pkgconfig:${libxslt:location}/lib/pkgconfig:${openssl:location}/lib/pkgconfig:${popt:location}/lib/pkgconfig:${python2.7:location}/lib/pkconfig:${sqlite3:location}/lib/pkconfig PKG_CONFIG_PATH=${glib:location}/lib/pkgconfig:${libxml2:location}/lib/pkgconfig:${libxslt:location}/lib/pkgconfig:${openssl:location}/lib/pkgconfig:${popt:location}/lib/pkgconfig:${python2.7:location}/lib/pkgconfig:${sqlite3:location}/lib/pkgconfig
LD_LIBRARY_PATH=${bzip2:location}/lib:${gdbm:location}/lib:${gettext:location}/lib:${glib:location}/lib:${libxml2:location}/lib:${libxslt:location}/lib:${ncurses:location}/lib:${openssl:location}/lib:${popt:location}/lib:${readline:location}/lib:${sqlite3:location}/lib:${zlib:location}/lib LD_LIBRARY_PATH=${bzip2:location}/lib:${gdbm:location}/lib:${gettext:location}/lib:${glib:location}/lib:${libxml2:location}/lib:${libxslt:location}/lib:${ncurses:location}/lib:${openssl:location}/lib:${popt:location}/lib:${readline:location}/lib:${sqlite3:location}/lib:${zlib:location}/lib
[cfg-environment] [cfg-environment]
...@@ -114,27 +115,37 @@ scripts = ...@@ -114,27 +115,37 @@ scripts =
slapgrid-supervisord = slapos.grid.svcbackend:supervisord slapgrid-supervisord = slapos.grid.svcbackend:supervisord
slapproxy = slapos.proxy:main slapproxy = slapos.proxy:main
slapos = slapos.entry:main slapos = slapos.entry:main
slapos-watchdog = slapos.grid.watchdog:main
[versions] [py]
zc.buildout = 1.6.0-dev-SlapOS-008 recipe = zc.recipe.egg
eggs =
${slapos:eggs}
python = python2.7
interpreter = py
scripts = py
[versions]
# Use our own buildout version
zc.buildout = 1.6.0-dev-SlapOS-010
# Generated by buildout-versions
Jinja2 = 2.6 Jinja2 = 2.6
Werkzeug = 0.8.3 Werkzeug = 0.8.3
buildout-versions = 1.7 buildout-versions = 1.7
collective.recipe.template = 1.9 collective.recipe.template = 1.9
hexagonit.recipe.cmmi = 1.6 hexagonit.recipe.cmmi = 1.6
lxml = 2.3.5 lxml = 3.0.1
meld3 = 0.6.9 meld3 = 0.6.9
netaddr = 0.7.10 netaddr = 0.7.10
slapos.core = 0.29 slapos.core = 0.33.1
slapos.libnetworkcache = 0.13.2 slapos.libnetworkcache = 0.13.2
xml-marshaller = 0.9.7 xml-marshaller = 0.9.7
z3c.recipe.scripts = 1.0.1 z3c.recipe.scripts = 1.0.1
zc.recipe.egg = 1.3.2 zc.recipe.egg = 1.3.2
# Required by: # Required by:
# slapos.core==0.29 # slapos.core==0.33.1
Flask = 0.9 Flask = 0.9
# Required by: # Required by:
...@@ -142,21 +153,21 @@ Flask = 0.9 ...@@ -142,21 +153,21 @@ Flask = 0.9
hexagonit.recipe.download = 1.5.1 hexagonit.recipe.download = 1.5.1
# Required by: # Required by:
# slapos.core==0.29 # slapos.core==0.33.1
netifaces = 0.8 netifaces = 0.8
# Required by: # Required by:
# slapos.core==0.29 # slapos.core==0.33.1
# slapos.libnetworkcache==0.13.2 # slapos.libnetworkcache==0.13.2
# supervisor==3.0b1 # supervisor==3.0b1
# zc.buildout==1.6.0-dev-SlapOS-006 # zc.buildout==1.6.0-dev-SlapOS-010
# zope.interface==4.0.1 # zope.interface==4.0.1
setuptools = 0.6c12dev-r88846 setuptools = 0.6c12dev-r88846
# Required by: # Required by:
# slapos.core==0.29 # slapos.core==0.33.1
supervisor = 3.0b1 supervisor = 3.0b1
# Required by: # Required by:
# slapos.core==0.29 # slapos.core==0.33.1
zope.interface = 4.0.1 zope.interface = 4.0.1
...@@ -45,6 +45,6 @@ patches = ...@@ -45,6 +45,6 @@ patches =
environment = environment =
PATH=${pkgconfig:location}/bin:%(PATH)s PATH=${pkgconfig:location}/bin:%(PATH)s
PKG_CONFIG_PATH=${openssl:location}/lib/pkgconfig:${garbage-collector:location}/lib/pkconfig PKG_CONFIG_PATH=${openssl:location}/lib/pkgconfig:${garbage-collector:location}/lib/pkgconfig
CPPFLAGS=-I${ncurses:location}/include/ -I${zlib:location}/include/ -I${garbage-collector:location}/include CPPFLAGS=-I${ncurses:location}/include/ -I${zlib:location}/include/ -I${garbage-collector:location}/include
LDFLAGS=-Wl,--as-needed -L${garbage-collector:location}/lib -Wl,-rpath=${garbage-collector:location}/lib -L${ncurses:location}/lib -Wl,-rpath=${ncurses:location}/lib -L${openssl:location}/lib -Wl,-rpath=${openssl:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib LDFLAGS=-Wl,--as-needed -L${garbage-collector:location}/lib -Wl,-rpath=${garbage-collector:location}/lib -L${ncurses:location}/lib -Wl,-rpath=${ncurses:location}/lib -L${openssl:location}/lib -Wl,-rpath=${openssl:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib
##############################################################################
#
# Copyright (c) 2010-2013 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 setuptools import setup, find_packages from setuptools import setup, find_packages
import glob import glob
import os import os
version = '0.67-dev' version = '0.71.2-dev'
name = 'slapos.cookbook' name = 'slapos.cookbook'
long_description = open("README.txt").read() + "\n" + \ long_description = open("README.txt").read() + "\n" + \
open("CHANGES.txt").read() + "\n" open("CHANGES.txt").read() + "\n"
...@@ -26,7 +52,6 @@ setup(name=name, ...@@ -26,7 +52,6 @@ setup(name=name,
packages=find_packages(), packages=find_packages(),
include_package_data=True, include_package_data=True,
install_requires=[ install_requires=[
'PyXML', # for full blown python interpreter
'lxml', # for full blown python interpreter 'lxml', # for full blown python interpreter
'netaddr', # to manipulate on IP addresses 'netaddr', # to manipulate on IP addresses
'setuptools', # namespaces 'setuptools', # namespaces
...@@ -41,33 +66,36 @@ setup(name=name, ...@@ -41,33 +66,36 @@ setup(name=name,
zip_safe=True, zip_safe=True,
entry_points={ entry_points={
'zc.buildout': [ 'zc.buildout': [
'addresiliency = slapos.recipe.addresiliency:Recipe',
'agent = slapos.recipe.agent:Recipe', 'agent = slapos.recipe.agent:Recipe',
'apache.frontend = slapos.recipe.apache_frontend:Recipe', 'apache.frontend = slapos.recipe.apache_frontend:Recipe',
'apache.zope.backend = slapos.recipe.apache_zope_backend:Recipe',
'apachephp = slapos.recipe.apachephp:Recipe', 'apachephp = slapos.recipe.apachephp:Recipe',
'apacheproxy = slapos.recipe.apacheproxy:Recipe', 'apacheproxy = slapos.recipe.apacheproxy:Recipe',
'apache.zope.backend = slapos.recipe.apache_zope_backend:Recipe',
'certificate_authority.request = slapos.recipe.certificate_authority:Request',
'certificate_authority = slapos.recipe.certificate_authority:Recipe', 'certificate_authority = slapos.recipe.certificate_authority:Recipe',
'certificate_authority.request = slapos.recipe.certificate_authority:Request',
'check_page_content = slapos.recipe.check_page_content:Recipe',
'check_port_listening = slapos.recipe.check_port_listening:Recipe', 'check_port_listening = slapos.recipe.check_port_listening:Recipe',
'check_url_available = slapos.recipe.check_url_available:Recipe', 'check_url_available = slapos.recipe.check_url_available:Recipe',
'check_page_content = slapos.recipe.check_page_content:Recipe',
'cloud9 = slapos.recipe.cloud9:Recipe', 'cloud9 = slapos.recipe.cloud9:Recipe',
'cron.d = slapos.recipe.dcron:Part', 'cloudooo.test = slapos.recipe.erp5_test:CloudoooRecipe',
'cron = slapos.recipe.dcron:Recipe', 'cron = slapos.recipe.dcron:Recipe',
'cron.d = slapos.recipe.dcron:Part',
'davstorage = slapos.recipe.davstorage:Recipe', 'davstorage = slapos.recipe.davstorage:Recipe',
'downloader = slapos.recipe.downloader:Recipe', 'downloader = slapos.recipe.downloader:Recipe',
'dropbear = slapos.recipe.dropbear:Recipe',
'dropbear.add_authorized_key = slapos.recipe.dropbear:AddAuthorizedKey', 'dropbear.add_authorized_key = slapos.recipe.dropbear:AddAuthorizedKey',
'dropbear.client = slapos.recipe.dropbear:Client', 'dropbear.client = slapos.recipe.dropbear:Client',
'dropbear = slapos.recipe.dropbear:Recipe', 'dumpmdb = slapos.recipe.dumpmdb:Recipe',
'duplicity = slapos.recipe.duplicity:Recipe', 'duplicity = slapos.recipe.duplicity:Recipe',
'egg_test = slapos.recipe.erp5_test:EggTestRecipe', 'egg_test = slapos.recipe.erp5_test:EggTestRecipe',
'equeue = slapos.recipe.equeue:Recipe', 'equeue = slapos.recipe.equeue:Recipe',
'erp5.bootstrap = slapos.recipe.erp5_bootstrap:Recipe', 'erp5.bootstrap = slapos.recipe.erp5_bootstrap:Recipe',
'erp5.promise = slapos.recipe.erp5_promise:Recipe', 'erp5.promise = slapos.recipe.erp5_promise:Recipe',
'erp5scalabilitytestbed = slapos.recipe.erp5scalabilitytestbed:Recipe',
'erp5testnode = slapos.recipe.erp5testnode:Recipe',
'erp5.test = slapos.recipe.erp5_test:Recipe', 'erp5.test = slapos.recipe.erp5_test:Recipe',
'erp5.update = slapos.recipe.erp5_update:Recipe', 'erp5.update = slapos.recipe.erp5_update:Recipe',
'erp5scalabilitytestbed = slapos.recipe.erp5scalabilitytestbed:Recipe',
'erp5testnode = slapos.recipe.erp5testnode:Recipe',
'firefox = slapos.recipe.firefox:Recipe', 'firefox = slapos.recipe.firefox:Recipe',
'fontconfig = slapos.recipe.fontconfig:Recipe', 'fontconfig = slapos.recipe.fontconfig:Recipe',
'generate.mac = slapos.recipe.generatemac:Recipe', 'generate.mac = slapos.recipe.generatemac:Recipe',
...@@ -85,19 +113,20 @@ setup(name=name, ...@@ -85,19 +113,20 @@ setup(name=name,
'gitinit = slapos.recipe.gitinit:Recipe', 'gitinit = slapos.recipe.gitinit:Recipe',
'haproxy = slapos.recipe.haproxy:Recipe', 'haproxy = slapos.recipe.haproxy:Recipe',
'helloworld = slapos.recipe.helloworld:Recipe', 'helloworld = slapos.recipe.helloworld:Recipe',
'importmdb = slapos.recipe.importmdb:Recipe',
'java = slapos.recipe.java:Recipe', 'java = slapos.recipe.java:Recipe',
'kumofs = slapos.recipe.kumofs:Recipe', 'kumofs = slapos.recipe.kumofs:Recipe',
'kvm.frontend = slapos.recipe.kvm_frontend:Recipe',
'kvm = slapos.recipe.kvm:Recipe', 'kvm = slapos.recipe.kvm:Recipe',
'kvm.frontend = slapos.recipe.kvm_frontend:Recipe',
'lamp = slapos.recipe.lamp:Request',
'lamp.request = slapos.recipe.lamp:Request', 'lamp.request = slapos.recipe.lamp:Request',
'lamp.simple = slapos.recipe.lamp:Simple', 'lamp.simple = slapos.recipe.lamp:Simple',
'lamp = slapos.recipe.lamp:Request',
'lamp.static = slapos.recipe.lamp:Static', 'lamp.static = slapos.recipe.lamp:Static',
'libcloudrequest = slapos.recipe.libcloudrequest:Recipe',
'libcloud = slapos.recipe.libcloud:Recipe', 'libcloud = slapos.recipe.libcloud:Recipe',
'libcloudrequest = slapos.recipe.libcloudrequest:Recipe',
'lockfile = slapos.recipe.lockfile:Recipe', 'lockfile = slapos.recipe.lockfile:Recipe',
'logrotate.d = slapos.recipe.logrotate:Part',
'logrotate = slapos.recipe.logrotate:Recipe', 'logrotate = slapos.recipe.logrotate:Recipe',
'logrotate.d = slapos.recipe.logrotate:Part',
'memcached = slapos.recipe.memcached:Recipe', 'memcached = slapos.recipe.memcached:Recipe',
'mkdirectory = slapos.recipe.mkdirectory:Recipe', 'mkdirectory = slapos.recipe.mkdirectory:Recipe',
'mydumper = slapos.recipe.mydumper:Recipe', 'mydumper = slapos.recipe.mydumper:Recipe',
...@@ -107,41 +136,45 @@ setup(name=name, ...@@ -107,41 +136,45 @@ setup(name=name,
'neoppod.master = slapos.recipe.neoppod:Master', 'neoppod.master = slapos.recipe.neoppod:Master',
'neoppod.storage = slapos.recipe.neoppod:Storage', 'neoppod.storage = slapos.recipe.neoppod:Storage',
'nosqltestbed = slapos.recipe.nosqltestbed:NoSQLTestBed', 'nosqltestbed = slapos.recipe.nosqltestbed:NoSQLTestBed',
'notifier = slapos.recipe.notifier:Recipe',
'notifier.callback = slapos.recipe.notifier:Callback', 'notifier.callback = slapos.recipe.notifier:Callback',
'notifier.notify = slapos.recipe.notifier:Notify', 'notifier.notify = slapos.recipe.notifier:Notify',
'notifier = slapos.recipe.notifier:Recipe',
'novnc = slapos.recipe.novnc:Recipe', 'novnc = slapos.recipe.novnc:Recipe',
'onetimeupload = slapos.recipe.onetimeupload:Recipe', 'onetimeupload = slapos.recipe.onetimeupload:Recipe',
'pbs = slapos.recipe.pbs:Recipe', 'pbs = slapos.recipe.pbs:Recipe',
'postgres = slapos.recipe.postgres:Recipe',
'postgres.export = slapos.recipe.postgres:ExportRecipe',
'postgres.import = slapos.recipe.postgres:ImportRecipe',
'proactive = slapos.recipe.proactive:Recipe', 'proactive = slapos.recipe.proactive:Recipe',
'publish = slapos.recipe.publish:Recipe', 'publish = slapos.recipe.publish:Recipe',
'publish.serialised = slapos.recipe.publish:Serialised', 'publish.serialised = slapos.recipe.publish:Serialised',
'publishurl = slapos.recipe.publishurl:Recipe', 'publishurl = slapos.recipe.publishurl:Recipe',
'pwgen = slapos.recipe.pwgen:Recipe', 'pwgen = slapos.recipe.pwgen:Recipe',
'pwgen.stable = slapos.recipe.pwgen:StablePasswordGeneratorRecipe', 'pwgen.stable = slapos.recipe.pwgen:StablePasswordGeneratorRecipe',
'requestoptional = slapos.recipe.requestoptional:Recipe',
'request = slapos.recipe.request:Recipe', 'request = slapos.recipe.request:Recipe',
'request.serialised = slapos.recipe.request:Serialised', 'request.serialised = slapos.recipe.request:Serialised',
'requestoptional = slapos.recipe.request:RequestOptional',
'seleniumrunner = slapos.recipe.seleniumrunner:Recipe', 'seleniumrunner = slapos.recipe.seleniumrunner:Recipe',
'sheepdogtestbed = slapos.recipe.sheepdogtestbed:SheepDogTestBed', 'sheepdogtestbed = slapos.recipe.sheepdogtestbed:SheepDogTestBed',
'shellinabox = slapos.recipe.shellinabox:Recipe',
'shell = slapos.recipe.shell:Recipe', 'shell = slapos.recipe.shell:Recipe',
'shellinabox = slapos.recipe.shellinabox:Recipe',
'signalwrapper= slapos.recipe.signal_wrapper:Recipe', 'signalwrapper= slapos.recipe.signal_wrapper:Recipe',
'simplelogger = slapos.recipe.simplelogger:Recipe', 'simplelogger = slapos.recipe.simplelogger:Recipe',
'siptester = slapos.recipe.siptester:SipTesterRecipe', 'siptester = slapos.recipe.siptester:SipTesterRecipe',
'slapconfiguration = slapos.recipe.slapconfiguration:Recipe', 'slapconfiguration = slapos.recipe.slapconfiguration:Recipe',
'slapconfiguration.serialised = slapos.recipe.slapconfiguration:Serialised', 'slapconfiguration.serialised = slapos.recipe.slapconfiguration:Serialised',
'slapcontainer = slapos.recipe.container:Recipe', 'slapcontainer = slapos.recipe.container:Recipe',
'slapmonitor = slapos.recipe.slapmonitor:Recipe', 'slapmonitor = slapos.recipe.slapmonitor:MonitorRecipe',
'slapmonitor-xml = slapos.recipe.slapmonitor:MonitorXMLRecipe',
'slapreport = slapos.recipe.slapreport:Recipe', 'slapreport = slapos.recipe.slapreport:Recipe',
'slaprunner = slapos.recipe.slaprunner:Recipe', 'slaprunner = slapos.recipe.slaprunner:Recipe',
'slaprunner.test = slapos.recipe.slaprunner:Test',
'softwaretype = slapos.recipe.softwaretype:Recipe', 'softwaretype = slapos.recipe.softwaretype:Recipe',
'sphinx= slapos.recipe.sphinx:Recipe', 'sphinx= slapos.recipe.sphinx:Recipe',
'sshkeys_authority.request = slapos.recipe.sshkeys_authority:Request',
'sshkeys_authority = slapos.recipe.sshkeys_authority:Recipe', 'sshkeys_authority = slapos.recipe.sshkeys_authority:Recipe',
'sshkeys_authority.request = slapos.recipe.sshkeys_authority:Request',
'stunnel = slapos.recipe.stunnel:Recipe', 'stunnel = slapos.recipe.stunnel:Recipe',
'symbolic.link = slapos.recipe.symbolic_link:Recipe', 'symbolic.link = slapos.recipe.symbolic_link:Recipe',
'testnode = slapos.recipe.testnode:Recipe',
'tidstorage = slapos.recipe.tidstorage:Recipe', 'tidstorage = slapos.recipe.tidstorage:Recipe',
'urlparse = slapos.recipe._urlparse:Recipe', 'urlparse = slapos.recipe._urlparse:Recipe',
'uuid = slapos.recipe._uuid:Recipe', 'uuid = slapos.recipe._uuid:Recipe',
......
testnode
========
Generic testnode.
...@@ -24,84 +24,75 @@ ...@@ -24,84 +24,75 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# #
############################################################################## ##############################################################################
import logging from slapos.recipe.librecipe import GenericSlapRecipe
from slapos import slap as slapmodule import os
class Recipe(object):
""" Request a SlapOS instance. Won't fail if instance is not ready. class Recipe(GenericSlapRecipe):
""" """ This class provides the installation of the resilience
scripts on the partition.
def __init__(self, buildout, name, options):
self.logger = logging.getLogger(name) bin/takeover will perform a rename (must be run manually).
bin/bully will monitor, run elections and perform renames when needed.
slap = slapmodule.slap() """
self.software_release_url = options['software-url'] def _install(self):
self.name = options['name'] path_list = []
slap.initializeConnection(options['server-url'], confpath = os.path.join(self.options['etc'], 'bully.conf')
options.get('key-file'),
options.get('cert-file'), ip_list = self.parameter_dict['ip-list']
) print 'Creating bully configuration with ips : %s\n' % ip_list
computer_partition = slap.registerComputerPartition(
options['computer-id'], options['partition-id']) conf = self.createFile(confpath,
self.request = computer_partition.request self.substituteTemplate(
self.getTemplateFilename('bully.conf.in'),
self.isSlave = False {
if 'slave' in options: 'self_id': int(self.parameter_dict['number']),
self.isSlave = options['slave'].lower() in ['y', 'yes', 'true', '1'] 'ip_list': ip_list
}
self.return_parameters = [] ))
if 'return' in options: path_list.append(conf)
self.return_parameters = [str(parameter).strip()
for parameter in options['return'].split()] slap_connection = self.buildout['slap-connection']
else:
self.logger.debug("No parameter to return to main instance." if self.optionIsTrue('enable-bully-service', default=False):
"Be careful about that...") bully_dir = self.options['services']
else:
software_type = 'RootSoftwareInstance' bully_dir = self.options['bin']
if 'software-type' in options:
software_type = options['software-type'] bully_wrapper = self.createPythonScript(
name=os.path.join(bully_dir, self.options['wrapper-bully']),
filter_kw = {} absolute_function='slapos.recipe.addresiliency.bully.run',
if 'sla' in options: arguments={
for sla_parameter in options['sla'].split(): 'confpath': confpath,
filter_kw[sla_parameter] = options['sla-%s' % sla_parameter] 'server_url': slap_connection['server-url'],
'key_file': slap_connection.get('key-file'),
partition_parameter_kw = {} 'cert_file': slap_connection.get('cert-file'),
if 'config' in options: 'computer_id': slap_connection['computer-id'],
for config_parameter in options['config'].split(): 'partition_id': slap_connection['partition-id'],
partition_parameter_kw[config_parameter] = \ 'software': slap_connection['software-release-url'],
options['config-%s' % config_parameter] 'namebase': self.parameter_dict['namebase'],
})
self.instance = self.request(options['software-url'], software_type,
self.name, partition_parameter_kw=partition_parameter_kw, path_list.append(bully_wrapper)
filter_kw=filter_kw, shared=self.isSlave)
takeover_wrapper = self.createPythonScript(
self.failed = None name=os.path.join(self.options['bin'], self.options['wrapper-takeover']),
for param in self.return_parameters: absolute_function='slapos.recipe.addresiliency.takeover.run',
try: arguments={
options['connection-%s' % param] = str( 'server_url': slap_connection['server-url'],
self.instance.getConnectionParameter(param)) 'key_file': slap_connection.get('key-file'),
except slapmodule.NotFoundError: 'cert_file': slap_connection.get('cert-file'),
options['connection-%s' % param] = '' 'computer_id': slap_connection['computer-id'],
if self.failed is None: 'partition_id': slap_connection['partition-id'],
self.failed = param 'software': slap_connection['software-release-url'],
'namebase': self.parameter_dict['namebase'],
def install(self): })
if self.failed is not None:
# Check instance status to know if instance has been deployed path_list.append(takeover_wrapper)
try:
status = self.instance.getState() return path_list
except slapmodule.NotFoundError:
status = 'not ready yet'
except AttributeError:
status = 'unknown'
error_message = 'Connection parameter %s not found. '\
'Requested instance is currently %s. If this error persists, '\
'check status of this instance.' % (self.failed, status)
self.logger.error(error_message)
return []
update = install
# -*- coding: utf-8 -*-
import logging
import Queue
import socket
import thread
import time
import slapos.recipe.addresiliency.renamer
import slapos
log = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
BASE_PORT = 50000
SLEEPING_MINS = 2 # XXX was 30, increase after testing
MSG_PING = 'ping'
MSG_HALT = 'halt'
MSG_VICTORY = 'victory'
MSG_OK = 'ok'
STATE_NORMAL = 'normal'
STATE_WAITINGCONFIRM = 'waitingConfirm'
STATE_ELECTION = 'election'
STATE_REORGANIZATION = 'reorganization'
## Leader is always number 0
class ResilientInstance(object):
def __init__(self, comm, renamer, confpath):
self.comm = comm
self.participant_id = 0
self.state = STATE_NORMAL
self.halter_id = 0
self.inElection = False
self.alive = True
self.mainCanal = self.comm.create_canal([MSG_PING, MSG_HALT, MSG_VICTORY])
self.renamer = renamer
self.okCanal = self.comm.create_canal([MSG_OK])
self.confpath = confpath
self.loadConnectionInfo()
def loadConnectionInfo(self):
params = open(self.confpath, 'r').readlines()
self.total_participants = len(params[0].split())
new_id = int(params[1])
if self.participant_id != new_id:
self.halter_id = new_id
self.participant_id = new_id
log.debug('I am {} of {}'.format(self.participant_id, self.total_participants))
## Needs to be changed to use the master
def aliveManagement(self):
while self.alive:
log.info('XXX sleeping for %d minutes' % SLEEPING_MINS)
time.sleep(SLEEPING_MINS*60)
if self.participant_id == 0:
continue
self.comm.send(MSG_PING, 0)
message, sender = self.okCanal.get()
if message:
continue
self.election()
def listen(self):
while self.alive:
self.comm.recv()
def main(self):
while self.alive:
message, sender = self.mainCanal.get()
if message == MSG_PING:
self.comm.send(MSG_OK, sender)
elif message == MSG_HALT:
self.state = STATE_WAITINGCONFIRM
self.halter_id = int(sender)
self.comm.send(MSG_OK, sender)
elif message == MSG_VICTORY:
if int(sender) == self.halter_id and self.state == STATE_WAITINGCONFIRM:
log.info('{} thinks {} is the leader'.format(self.participant_id, sender))
self.comm.send(MSG_OK, sender)
self.state = STATE_NORMAL
def election(self):
self.inElection = True
self.loadConnectionInfo()
# Check if I'm the highest instance alive
for higher in range(self.participant_id + 1, self.total_participants):
self.comm.send(MSG_PING, higher)
message, sender = self.okCanal.get()
if message:
log.info('{} is alive ({})'.format(higher, self.participant_id))
self.inElection = False
return False
continue
if not self.alive:
return False
# I should be the new coordinator, halt those below me
log.info('Should be ME : {}'.format(self.participant_id))
self.state = STATE_ELECTION
self.halter_id = self.participant_id
ups = []
for lower in range(self.participant_id):
self.comm.send(MSG_HALT, lower)
message, sender = self.okCanal.get()
if message:
ups.append(lower)
#Broadcast Victory
self.state = STATE_REORGANIZATION
for up in ups:
self.comm.send(MSG_VICTORY, up)
message, sender = self.okCanal.get()
if message:
continue
log.info('Something is wrong... let\'s start over')
return self.election()
self.state = STATE_NORMAL
self.active = True
log.info('{} Is THE LEADER'.format(self.participant_id))
self.renamer.failover()
self.inElection = False
return True
class FilteredCanal(object):
def __init__(self, accept, timeout):
self.accept = accept
self.queue = Queue.Queue()
self.timeout = timeout
def append(self, message, sender):
if message in self.accept:
self.queue.put([message, sender])
def get(self):
try:
return self.queue.get(timeout=self.timeout)
except Queue.Empty:
return [None, None]
class Wrapper(object):
def __init__(self, confpath, timeout=20):
self.canals = []
self.ips = []
self.participant_id = 0
self.timeout = timeout
self.confpath = confpath
self.getConnectionInfo()
self.socket = None
def getConnectionInfo(self):
params = open(self.confpath, 'r').readlines()
self.ips = params[0].split()
self.participant_id = int(params[1])
log.debug('I am {} of {}'.format(self.participant_id, self.ips))
def start(self):
self.getConnectionInfo()
self.socket = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
self.socket.bind((self.ips[self.participant_id], BASE_PORT + self.participant_id))
self.socket.listen(5)
def send(self, message, number):
self.getConnectionInfo()
try:
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
s.connect((self.ips[number], BASE_PORT + number))
s.send(message + (' {}\n'.format(self.participant_id)))
except (socket.error, socket.herror, socket.gaierror, socket.timeout):
pass
finally:
s.close()
def create_canal(self, accept):
created = FilteredCanal(accept, self.timeout)
self.canals.append(created)
return created
def recv(self):
client, _ = self.socket.accept()
client_message = client.recv(1024)
if client_message:
message, sender = client_message.split()
for canal in self.canals:
canal.append(message, int(sender))
def run(args):
confpath = args.pop('confpath')
renamer = slapos.recipe.addresiliency.renamer.Renamer(server_url = args.pop('server_url'),
key_file = args.pop('key_file'),
cert_file = args.pop('cert_file'),
computer_guid = args.pop('computer_id'),
partition_id = args.pop('partition_id'),
software_release = args.pop('software'),
namebase = args.pop('namebase'))
if args:
raise ValueError('Unknown arguments: %s' % ', '.join(args))
wrapper = Wrapper(confpath=confpath, timeout=20)
computer = ResilientInstance(wrapper, renamer=renamer, confpath=confpath)
# idle waiting for connection infos
while computer.total_participants < 2:
computer.loadConnectionInfo()
time.sleep(30)
log.info('Starting')
computer.comm.start()
thread.start_new_thread(computer.listen, ())
thread.start_new_thread(computer.aliveManagement, ())
computer.main()
# -*- coding: utf-8 -*-
import logging
import time
import slapos
log = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
class Renamer(object):
def __init__(self, server_url, key_file, cert_file, computer_guid,
partition_id, software_release, namebase):
self.server_url = server_url
self.key_file = key_file
self.cert_file = cert_file
self.computer_guid = computer_guid
self.partition_id = partition_id
self.software_release = software_release
self.namebase = namebase
def _failover(self):
"""\
This method does
- retrieve the broken computer partition
- change its reference to 'broken-...' and its software type to 'frozen'
- retrieve the winner computer partition (attached to this process)
- change its reference to replace the broken one.
later, slapgrid will change its software_type as well.
Then, after running slapgrid-cp a few times, the winner takes over and
a new cp is created to replace it as an importer.
"""
slap = slapos.slap.slap()
slap.initializeConnection(self.server_url, self.key_file, self.cert_file)
# partition that will take over.
cp_winner = slap.registerComputerPartition(computer_guid=self.computer_guid,
partition_id=self.partition_id)
# XXX although we can already rename cp_winner, to change its software type we need to
# get hold of the root cp as well
cp_exporter_ref = self.namebase + '0' # this is ok. the boss is always number zero.
# partition to be deactivated
cp_broken = cp_winner.request(software_release=self.software_release,
software_type='frozen',
state='stopped',
partition_reference=cp_exporter_ref)
broken_new_ref = 'broken-{}'.format(time.strftime("%d-%b_%H:%M:%S", time.gmtime()))
log.debug("Renaming {}: {}".format(cp_broken.getId(), broken_new_ref))
cp_broken.rename(new_name=broken_new_ref)
cp_broken.stopped()
log.debug("Renaming {}: {}".format(cp_winner.getId(), cp_exporter_ref))
# update name (and later, software type) for the partition that will take over
cp_winner.rename(new_name=cp_exporter_ref)
cp_winner.bang(message='partitions have been renamed!')
def failover(self):
try:
self._failover()
log.info('Renaming done')
except slapos.slap.ServerError:
log.info('Internal server error')
# -*- coding: utf-8 -*-
import slapos.recipe.addresiliency.renamer
def run(args):
renamer = slapos.recipe.addresiliency.renamer.Renamer(server_url = args.pop('server_url'),
key_file = args.pop('key_file'),
cert_file = args.pop('cert_file'),
computer_guid = args.pop('computer_id'),
partition_id = args.pop('partition_id'),
software_release = args.pop('software'),
namebase = args.pop('namebase'))
renamer.failover()
#!%(executable)s
import select
import socket
import threading
import time
import sys
sys.path[:] = %(syspath)s
import slapos
from slapos import slap as slapmodule
port = 50000
size = 1024
wait = True
def loadConnectionInfos():
connectionInfos = {}
file = open('%(confpath)s', 'r')
params = file.read().split('\n')
file.close()
ip_list = [x.strip("' ") for x in params[0].strip('[],').split(',')]
connectionInfos['self_id'] = int(params[1])
connectionInfos['server_list'] = \
[(i, ip_list[i]) for i in range(len(ip_list))]
connectionInfos['self_ip'] = ip_list[connectionInfos['self_id']]
return connectionInfos
def rename_broken_and_stop():
try:
slap = slapmodule.slap()
slap.initializeConnection('%(server_url)s',
'%(key_file)s',
'%(cert_file)s')
computer_partition = slap.registerComputerPartition(computer_guid='%(computer_id)s',
partition_id='%(partition_id)s')
broken = computer_partition.request(software_release='%(software)s',
software_type='frozen',
partition_reference='%(namebase)s0')
broken.rename('broken-%%s' %% (time.strftime("%%d-%%b_%%H:%%M:%%S", time.gmtime())))
broken.stopped()
computer_partition.rename('%(namebase)s0')
print 'renaming done\n'
except slapos.slap.slap.ServerError:
print 'Internal server error\n'
def election():
global wait
connection = loadConnectionInfos()
message = "%%s, %%s" %% (connection['self_id'], "Election")
victory = True
for (remote_id, addr) in connection['server_list']:
if remote_id > connection['self_id']:
try:
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
s.connect((addr, port + remote_id))
s.send(message)
reply = s.recv(size)
if reply == "%%s, %%s" %% (remote_id, "Alive"):
victory = False
except (socket.error, socket.herror, socket.gaierror, socket.timeout):
pass
finally:
s.close()
if victory:
wait = True
for (remote_id, addr) in connection['server_list']:
if remote_id < connection['self_id']:
try:
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
s.connect((addr, port + remote_id))
s.send("%%s, %%s" %% (connection['self_id'], "Victory"))
except (socket.error, socket.herror, socket.gaierror, socket.timeout):
pass
finally:
s.close()
rename_broken_and_stop()
def failure_detect():
global wait
connection = loadConnectionInfos()
while True:
time.sleep(30)
if wait:
print 'waiting 30 minutes\n'
time.sleep(30 * 60)
wait = False
if not connection['server_list'][0]:
continue
(remote_id, addr) = connection['server_list'][0]
try:
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
s.connect((addr, port + remote_id))
s.close()
except (socket.error, socket.herror, socket.gaierror, socket.timeout):
s.close()
election()
failure_detect_thread = threading.Thread(target=failure_detect)
failure_detect_thread.start()
connection = loadConnectionInfos()
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
s.bind((connection['self_ip'], port + connection['self_id']))
s.listen(5)
#election()
while True:
force_election = False
client, _ = s.accept()
client_message = client.recv(1024)
if client_message:
client_id, message = client_message.split(', ')
client_id = eval(client_id)
if message == "Victory":
wait = True
print "%%s wins" %% client_id
elif message == "Election":
print "%%s starts an election" %% client_id
if client_id < connection['self_id']:
client.send("%%s, %%s" %% (connection['self_id'], "Alive"))
force_election = True
client.close()
if force_election:
election()
#!%(executable)s
import logging
import os
import socket
import sys
import thread
import time
sys.path[:] = %(syspath)s
from slapos import slap as slapmodule
import slapos
BASE_PORT = 50000
SLEEPING_MINS = 2
log = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
class Renamer(object):
def __init__(self, server_url, key_file, cert_file, computer_guid,
partition_id, software_release, namebase):
self.server_url = server_url
self.key_file = key_file
self.cert_file = cert_file
self.computer_guid = computer_guid
self.partition_id = partition_id
self.software_release = software_release
self.namebase = namebase
def _failover(self):
slap = slapmodule.slap()
slap.initializeConnection(self.server_url,
self.key_file,
self.cert_file)
computer_partition = slap.registerComputerPartition(computer_guid=self.computer_guid,
partition_id=self.partition_id)
broken = computer_partition.request(software_release=self.software_release,
software_type='frozen',
partition_reference=self.namebase+'0')
broken.rename('broken-{}'.format(time.strftime("%%d-%%b_%%H:%%M:%%S", time.gmtime())))
broken.stopped()
computer_partition.rename(self.namebase+'0')
def failover(self):
try:
log.info('renaming done')
except slapos.slap.slap.ServerError:
log.info('Internal server error')
## Leader is always number 0
class ResilientInstance(object):
def __init__(self, comm, renamer, confpath):
self.comm = comm
self.id = 0
self.state = 'normal'
self.halter = 0
self.inElection = False
self.alive = True
self.lastPing = time.clock()
self.mainCanal = self.comm.canal(['ping', 'halt', 'victory'])
self.renamer = renamer
self.okCanal = self.comm.canal(['ok'])
self.confpath = confpath
self.loadConnectionInfos()
def loadConnectionInfos(self):
file = open(self.confpath, 'r')
params = file.read().split('\n')
file.close()
self.nbComp = len([x.strip("' ") for x in params[0].strip('[],').split(',')])
new_id = int(params[1])
if self.id != new_id:
self.halter = new_id
self.id = new_id
## Needs to be changed to use the master
def aliveManagement(self):
while self.alive:
log.info('XXX sleeping for %%d minutes' %% SLEEPING_MINS)
time.sleep(SLEEPING_MINS*60)
if self.id == 0:
continue
self.comm.send('ping', 0)
message, sender = self.okCanal.get()
if message:
continue
self.election()
def listen(self):
while self.alive:
self.comm.recv()
def main(self):
while self.alive:
message, sender = self.mainCanal.get()
if message == 'ping':
self.comm.send('ok', sender)
elif message == 'halt':
self.state = 'waitingConfirm'
self.halter = sender
self.comm.send('ok', sender)
elif message == 'victory':
if int(sender) == int(self.halter) and self.state == 'waitingConfirm':
log.info('{} thinks {} is the leader'.format(self.id, sender))
self.comm.send('ok', sender)
self.state = 'normal'
def election(self):
self.inElection = True
self.loadConnectionInfos()
#Check if I'm the highest instance alive
for higher in range(self.id + 1, self.nbComp):
self.comm.send('ping', higher)
message, sender = self.okCanal.get()
if message:
log.info('{} is alive ({})'.format(higher, self.id))
self.inElection = False
return False
continue
if not self.alive:
return False
#I should be the new coordinator, halt those below me
log.info('Should be ME : {}'.format(self.id))
self.state = 'election'
self.halter = self.id
ups = []
for lower in range(self.id):
self.comm.send('halt', lower)
message, sender = self.okCanal.get()
if message:
ups.append(lower)
#Broadcast Victory
self.state = 'reorganization'
for up in ups:
self.comm.send('victory', up)
message, sender = self.okCanal.get()
if message:
continue
log.info('Something is wrong... let\'s start over')
return self.election()
self.state = 'normal'
self.active = True
log.info('{} Is THE LEADER'.format(self.id))
self.renamer.failover()
self.inElection = False
return True
class FilteredCanal(object):
def __init__(self, accept, timeout):
self.accept = accept
self.list = []
self.lock = thread.allocate_lock()
self.timeout = timeout
def append(self, message, sender):
if message in self.accept:
self.lock.acquire()
self.list.append([message, sender])
self.lock.release()
def get(self):
start = time.clock()
while (time.clock() - start < self.timeout):
self.lock.acquire()
if self.list:
self.lock.release()
return self.list.pop(0)
self.lock.release()
return [None, None]
class Wrapper(object):
def __init__(self, confpath, timeout=20):
self.canals = []
self.ips = []
self.id = 0
self.timeout = timeout
self.confpath = confpath
self.getConnectionInfos()
self.socket = None
def getConnectionInfos(self):
file = open(self.confpath, 'r')
params = file.read().split('\n')
file.close()
self.ips = [x.strip("' ") for x in params[0].strip('[],').split(',')]
self.id = int(params[1])
def start(self):
self.getConnectionInfos()
self.socket = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
self.socket.bind((self.ips[self.id], BASE_PORT + self.id))
self.socket.listen(5)
def send(self, message, number):
self.getConnectionInfos()
try:
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
s.connect((self.ips[number], BASE_PORT + number))
s.send(message + (' {}\n'.format(self.id)))
except (socket.error, socket.herror, socket.gaierror, socket.timeout):
pass
finally:
s.close()
def canal(self, accept):
created = FilteredCanal(accept, self.timeout)
self.canals.append(created)
return created
def recv(self):
client, _ = self.socket.accept()
client_message = client.recv(1024)
if client_message:
message, sender = client_message.split()
for canal in self.canals:
canal.append(message, int(sender))
def main():
renamer = Renamer(server_url = '%(server_url)s',
key_file = '%(key_file)s',
cert_file = '%(cert_file)s',
computer_guid = '%(computer_id)s',
partition_id = '%(partition_id)s',
software_release = '%(software)s',
namebase = '%(namebase)s')
confpath = '%(confpath)s'
wrapper = Wrapper(confpath=confpath, timeout=20)
computer = ResilientInstance(wrapper, renamer=renamer, confpath=confpath)
#idle waiting for connection infos
while computer.nbComp < 2 :
computer.loadConnectionInfos()
time.sleep(30)
log.info('Starting')
computer.comm.start()
thread.start_new_thread(computer.listen, ())
thread.start_new_thread(computer.main, ())
thread.start_new_thread(computer.aliveManagement, ())
while True:
# XXX tight loop
continue
if __name__ == '__main__':
main()
...@@ -25,65 +25,42 @@ ...@@ -25,65 +25,42 @@
# #
############################################################################# #############################################################################
import os
import sys
import zc.buildout import zc.buildout
import slapos.slap from slapos.recipe.librecipe import GenericBaseRecipe
from slapos.recipe.librecipe import BaseSlapRecipe import sys
from slapos.recipe.librecipe import GenericSlapRecipe
import json
import ConfigParser
# XXX: BaseSlapRecipe and GenericSlapRecipe are deprecated, use class Recipe(GenericBaseRecipe):
# GenericBaseRecipe and move partition parameter fetching to software release.
class Recipe(BaseSlapRecipe, GenericSlapRecipe):
def install(self): def install(self):
self.path_list = [] path_list = []
crond = self.installCrond()
configuration_path = self.options["config"]
header = """[DEFAULT]
master_url = %s
key = %s
slap = slapos.slap.slap() cert = %s
slap.initializeConnection(self.server_url, self.key_file, self.cert_file)
parameter_dict = slap.registerComputerPartition( max_install_duration = %s
self.computer_id, max_uninstall_duration = %s
self.computer_partition_id, max_request_duration = %s
).getInstanceParameterDict() max_destroy_duration = %s
""" % (self.options["master-url"],
"\n ".join(self.options["key"].split("\n")),
"\n ".join(self.options["cert"].split("\n")),
self.options["default_max_install_duration"],
self.options["default_max_uninstall_duration"],
self.options["default_max_request_duration"],
self.options["default_max_destroy_duration"])
# XXX: should probably expect one more (SR-originating) parameter instead
# of using self.work_directory .
configuration_path = os.path.join(self.work_directory, "agent.cfg")
with open(configuration_path, "w") as configuration: with open(configuration_path, "w") as configuration:
configuration.write(parameter_dict["configuration"]) configuration.write(header + self.options["configuration"])
agent_crond_path = os.path.join(crond, "agent")
with open(agent_crond_path, "w") as agent_crond: path_list.append(self.createPythonScript(
agent_crond.write("*/5 * * * * %s -S %s --pidfile=%s --log=%s " self.options['wrapper'],
"%s 2>&1 > /dev/null\n" % ( 'slapos.recipe.librecipe.execute.execute',
self.options["python_binary"], [self.options["agent_binary"], '--pidfile=%s' % self.options["pidfile"],
self.options["agent_binary"], "--log=%s" % self.options["log"], configuration_path]))
self.options["pidfile"],
self.options["log"],
configuration_path,
))
return self.path_list + [configuration_path, agent_crond_path] path_list.append(configuration_path)
def installCrond(self): return path_list
_, ws = self.egg.working_set()
timestamps = self.createDataDirectory('cronstamps')
cron_output = os.path.join(self.log_directory, 'cron-output')
self._createDirectory(cron_output)
catcher = zc.buildout.easy_install.scripts([('catchcron',
__name__ + '.catdatefile', 'catdatefile')], ws, sys.executable,
self.bin_directory, arguments=[cron_output])[0]
self.path_list.append(catcher)
cron_d = os.path.join(self.etc_directory, 'cron.d')
crontabs = os.path.join(self.etc_directory, 'crontabs')
self._createDirectory(cron_d)
self._createDirectory(crontabs)
wrapper = zc.buildout.easy_install.scripts([('crond',
'slapos.recipe.librecipe.execute', 'execute')], ws, sys.executable,
self.wrapper_directory, arguments=[
self.options['dcrond_binary'].strip(), '-s', cron_d, '-c', crontabs,
'-t', timestamps, '-f', '-l', '5', '-M', catcher]
)[0]
self.path_list.append(wrapper)
return cron_d
...@@ -28,6 +28,7 @@ from slapos.recipe.librecipe import BaseSlapRecipe ...@@ -28,6 +28,7 @@ from slapos.recipe.librecipe import BaseSlapRecipe
import os import os
import pkg_resources import pkg_resources
import hashlib import hashlib
import operator
import sys import sys
import zc.buildout import zc.buildout
import zc.recipe.egg import zc.recipe.egg
...@@ -43,6 +44,9 @@ class Recipe(BaseSlapRecipe): ...@@ -43,6 +44,9 @@ class Recipe(BaseSlapRecipe):
'template/%s' % template_name) 'template/%s' % template_name)
def _install(self): def _install(self):
# Define directory not defined in deprecated lib
self.service_directory = os.path.join(self.etc_directory, 'service')
# Check for mandatory arguments # Check for mandatory arguments
frontend_domain_name = self.parameter_dict.get("domain") frontend_domain_name = self.parameter_dict.get("domain")
if frontend_domain_name is None: if frontend_domain_name is None:
...@@ -69,9 +73,17 @@ class Recipe(BaseSlapRecipe): ...@@ -69,9 +73,17 @@ class Recipe(BaseSlapRecipe):
rewrite_rule_list = [] rewrite_rule_list = []
rewrite_rule_zope_list = [] rewrite_rule_zope_list = []
rewrite_rule_zope_path_list = []
slave_dict = {} slave_dict = {}
service_dict = {} service_dict = {}
# Sort slave instance by reference to avoid most security issues
slave_instance_list = sorted(slave_instance_list,
key=operator.itemgetter('slave_reference'))
# dict of used domains, only used to track duplicates
domain_dict = {}
for slave_instance in slave_instance_list: for slave_instance in slave_instance_list:
backend_url = slave_instance.get("url", None) backend_url = slave_instance.get("url", None)
reference = slave_instance.get("slave_reference") reference = slave_instance.get("slave_reference")
...@@ -97,6 +109,12 @@ class Recipe(BaseSlapRecipe): ...@@ -97,6 +109,12 @@ class Recipe(BaseSlapRecipe):
domain = "%s.%s" % (reference.replace("-", "").lower(), domain = "%s.%s" % (reference.replace("-", "").lower(),
frontend_domain_name) frontend_domain_name)
if domain_dict.get(domain):
# This domain already has been processed, skip this new one
continue
else:
domain_dict[domain] = True
# Define the URL where the instance will be available # Define the URL where the instance will be available
# WARNING: we use default ports (443, 80) here. # WARNING: we use default ports (443, 80) here.
slave_dict[reference] = "%s%s/" % (scheme, domain) slave_dict[reference] = "%s%s/" % (scheme, domain)
...@@ -118,6 +136,9 @@ class Recipe(BaseSlapRecipe): ...@@ -118,6 +136,9 @@ class Recipe(BaseSlapRecipe):
# RewriteMap for Zope Virtual Host Monster websites. # RewriteMap for Zope Virtual Host Monster websites.
if slave_instance.get("type", "").lower() in ['zope']: if slave_instance.get("type", "").lower() in ['zope']:
rewrite_rule_zope_list.append(rewrite_rule) rewrite_rule_zope_list.append(rewrite_rule)
# For Zope, we have another dict containing the path e.g '/erp5/...
rewrite_rule_path = "%s %s" % (domain, slave_instance.get('path', ''))
rewrite_rule_zope_path_list.append(rewrite_rule_path)
else: else:
rewrite_rule_list.append(rewrite_rule) rewrite_rule_list.append(rewrite_rule)
...@@ -152,6 +173,7 @@ class Recipe(BaseSlapRecipe): ...@@ -152,6 +173,7 @@ class Recipe(BaseSlapRecipe):
name=frontend_domain_name, name=frontend_domain_name,
rewrite_rule_list=rewrite_rule_list, rewrite_rule_list=rewrite_rule_list,
rewrite_rule_zope_list=rewrite_rule_zope_list, rewrite_rule_zope_list=rewrite_rule_zope_list,
rewrite_rule_zope_path_list=rewrite_rule_zope_path_list,
key=key, certificate=certificate) key=key, certificate=certificate)
# Send connection informations about each slave # Send connection informations about each slave
...@@ -160,9 +182,12 @@ class Recipe(BaseSlapRecipe): ...@@ -160,9 +182,12 @@ class Recipe(BaseSlapRecipe):
"instance: %s" % reference) "instance: %s" % reference)
try: try:
connection_dict = { connection_dict = {
'frontend_ipv6_address': self.getGlobalIPv6Address(), # Send the public IPs (if possible) so that user knows what IP
'frontend_ipv4_address': self.getLocalIPv4Address(), # to bind to its domain name
'site_url': url 'frontend_ipv6_address': self.getGlobalIPv6Address(),
'frontend_ipv4_address': self.parameter_dict.get("public-ipv4",
self.getLocalIPv4Address()),
'site_url': url,
} }
self.setConnectionDict(connection_dict, reference) self.setConnectionDict(connection_dict, reference)
except: except:
...@@ -289,7 +314,7 @@ class Recipe(BaseSlapRecipe): ...@@ -289,7 +314,7 @@ class Recipe(BaseSlapRecipe):
self._createDirectory(crontabs) self._createDirectory(crontabs)
wrapper = zc.buildout.easy_install.scripts([('crond', wrapper = zc.buildout.easy_install.scripts([('crond',
'slapos.recipe.librecipe.execute', 'execute')], self.ws, sys.executable, 'slapos.recipe.librecipe.execute', 'execute')], self.ws, sys.executable,
self.wrapper_directory, arguments=[ self.service_directory, arguments=[
self.options['dcrond_binary'].strip(), '-s', cron_d, '-c', crontabs, self.options['dcrond_binary'].strip(), '-s', cron_d, '-c', crontabs,
'-t', timestamps, '-f', '-l', '5', '-M', catcher] '-t', timestamps, '-f', '-l', '5', '-M', catcher]
)[0] )[0]
...@@ -346,10 +371,13 @@ class Recipe(BaseSlapRecipe): ...@@ -346,10 +371,13 @@ class Recipe(BaseSlapRecipe):
) )
self._writeFile(openssl_configuration, pkg_resources.resource_string( self._writeFile(openssl_configuration, pkg_resources.resource_string(
__name__, 'template/openssl.cnf.ca.in') % config) __name__, 'template/openssl.cnf.ca.in') % config)
# XXX-Cedric: Don't use this, but use slapos.recipe.certificate_authority
# from the instance profile.
self.path_list.extend(zc.buildout.easy_install.scripts([ self.path_list.extend(zc.buildout.easy_install.scripts([
('certificate_authority', __name__ + '.certificate_authority', ('certificate_authority', __name__ + '.certificate_authority',
'runCertificateAuthority')], 'runCertificateAuthority')],
self.ws, sys.executable, self.wrapper_directory, arguments=[dict( self.ws, sys.executable, self.service_directory, arguments=[dict(
openssl_configuration=openssl_configuration, openssl_configuration=openssl_configuration,
openssl_binary=self.options['openssl_binary'], openssl_binary=self.options['openssl_binary'],
certificate=os.path.join(self.ca_dir, 'cacert.pem'), certificate=os.path.join(self.ca_dir, 'cacert.pem'),
...@@ -382,6 +410,8 @@ class Recipe(BaseSlapRecipe): ...@@ -382,6 +410,8 @@ class Recipe(BaseSlapRecipe):
name + '.lock') name + '.lock')
apache_conf['document_root'] = os.path.join(self.data_root_directory, apache_conf['document_root'] = os.path.join(self.data_root_directory,
'htdocs') 'htdocs')
apache_conf['instance_home'] = os.path.join(self.work_directory)
apache_conf['httpd_home'] = self.options['httpd_home']
apache_conf['ip_list'] = ip_list apache_conf['ip_list'] = ip_list
apache_conf['port'] = port apache_conf['port'] = port
apache_conf['server_admin'] = 'admin@' apache_conf['server_admin'] = 'admin@'
...@@ -419,10 +449,11 @@ class Recipe(BaseSlapRecipe): ...@@ -419,10 +449,11 @@ class Recipe(BaseSlapRecipe):
"-f", config_file, "-f", config_file,
"-a", varnish_config["port"], "-T", varnish_config["control_port"], "-a", varnish_config["port"], "-T", varnish_config["control_port"],
"-s", varnish_config["storage"]] "-s", varnish_config["storage"]]
environment = dict(PATH=self.options["binutils_directory"]) environment = dict(PATH="%s:%s" % (self.options["binutils_directory"],
os.environ.get('PATH')))
wrapper = zc.buildout.easy_install.scripts([(name, wrapper = zc.buildout.easy_install.scripts([(name,
'slapos.recipe.librecipe.execute', 'executee')], self.ws, 'slapos.recipe.librecipe.execute', 'executee')], self.ws,
sys.executable, self.wrapper_directory, arguments=[varnish_argument_list, sys.executable, self.service_directory, arguments=[varnish_argument_list,
environment])[0] environment])[0]
self.path_list.append(wrapper) self.path_list.append(wrapper)
...@@ -461,7 +492,7 @@ class Recipe(BaseSlapRecipe): ...@@ -461,7 +492,7 @@ class Recipe(BaseSlapRecipe):
stunnel_conf)) stunnel_conf))
wrapper = zc.buildout.easy_install.scripts([('stunnel', wrapper = zc.buildout.easy_install.scripts([('stunnel',
'slapos.recipe.librecipe.execute', 'execute_wait')], self.ws, 'slapos.recipe.librecipe.execute', 'execute_wait')], self.ws,
sys.executable, self.wrapper_directory, arguments=[ sys.executable, self.service_directory, arguments=[
[self.options['stunnel_binary'].strip(), stunnel_conf_path], [self.options['stunnel_binary'].strip(), stunnel_conf_path],
[certificate, key]] [certificate, key]]
)[0] )[0]
...@@ -470,8 +501,17 @@ class Recipe(BaseSlapRecipe): ...@@ -470,8 +501,17 @@ class Recipe(BaseSlapRecipe):
def installFrontendApache(self, ip_list, key, certificate, name, def installFrontendApache(self, ip_list, key, certificate, name,
port=4443, plain_http_port=8080, port=4443, plain_http_port=8080,
rewrite_rule_list=[], rewrite_rule_zope_list=[], rewrite_rule_list=None,
rewrite_rule_zope_list=None,
rewrite_rule_zope_path_list=None,
access_control_string=None): access_control_string=None):
if rewrite_rule_list is None:
rewrite_rule_list = []
if rewrite_rule_zope_list is None:
rewrite_rule_zope_list = []
if rewrite_rule_zope_path_list is None:
rewrite_rule_zope_path_list = []
# Create htdocs, populate it with default 404 document # Create htdocs, populate it with default 404 document
htdocs_location = os.path.join(self.data_root_directory, 'htdocs') htdocs_location = os.path.join(self.data_root_directory, 'htdocs')
self._createDirectory(htdocs_location) self._createDirectory(htdocs_location)
...@@ -488,16 +528,21 @@ class Recipe(BaseSlapRecipe): ...@@ -488,16 +528,21 @@ class Recipe(BaseSlapRecipe):
self._createDirectory(cache_directory_location) self._createDirectory(cache_directory_location)
self._createDirectory(mod_ssl_cache_location) self._createDirectory(mod_ssl_cache_location)
# Create "custom" apache configuration file if it does not exist. # Create "custom" apache configuration files if it does not exist.
# Note : This file won't be erased or changed when slapgrid is ran. # Note : Those files won't be erased or changed when slapgrid is ran.
# It can be freely customized by node admin. # It can be freely customized by node admin.
custom_apache_configuration_directory = os.path.join( custom_apache_configuration_directory = os.path.join(
self.data_root_directory, 'apache-conf.d') self.data_root_directory, 'apache-conf.d')
self._createDirectory(custom_apache_configuration_directory) self._createDirectory(custom_apache_configuration_directory)
# First one is included in the end of the apache configuration file
custom_apache_configuration_file_location = os.path.join( custom_apache_configuration_file_location = os.path.join(
custom_apache_configuration_directory, 'apache_frontend.custom.conf') custom_apache_configuration_directory, 'apache_frontend.custom.conf')
f = open(custom_apache_configuration_file_location, 'a') open(custom_apache_configuration_file_location, 'a')
f.close() # Second one is included in the virtualhost of apache configuration file
custom_apache_virtual_configuration_file_location = os.path.join(
custom_apache_configuration_directory,
'apache_frontend.virtualhost.custom.conf')
open(custom_apache_virtual_configuration_file_location, 'a')
# Create backup of custom apache configuration # Create backup of custom apache configuration
backup_path = self.createBackupDirectory('custom_apache_conf_backup') backup_path = self.createBackupDirectory('custom_apache_conf_backup')
...@@ -512,9 +557,14 @@ class Recipe(BaseSlapRecipe): ...@@ -512,9 +557,14 @@ class Recipe(BaseSlapRecipe):
# Create configuration file and rewritemaps # Create configuration file and rewritemaps
apachemap_name = "apachemap.txt" apachemap_name = "apachemap.txt"
apachemapzope_name = "apachemapzope.txt" apachemapzope_name = "apachemapzope.txt"
apachemapzopepath_name = "apachemapzopepath.txt"
self.createConfigurationFile(apachemap_name, "\n".join(rewrite_rule_list)) self.createConfigurationFile(apachemap_name, "\n".join(rewrite_rule_list))
self.createConfigurationFile(apachemapzope_name, self.createConfigurationFile(apachemapzope_name,
"\n".join(rewrite_rule_zope_list)) "\n".join(rewrite_rule_zope_list))
self.createConfigurationFile(apachemapzopepath_name,
"\n".join(rewrite_rule_zope_path_list))
apache_conf = self._getApacheConfigurationDict(name, ip_list, port) apache_conf = self._getApacheConfigurationDict(name, ip_list, port)
apache_conf['ssl_snippet'] = self.substituteTemplate( apache_conf['ssl_snippet'] = self.substituteTemplate(
self.getTemplateFilename('apache.ssl-snippet.conf.in'), self.getTemplateFilename('apache.ssl-snippet.conf.in'),
...@@ -532,16 +582,22 @@ class Recipe(BaseSlapRecipe): ...@@ -532,16 +582,22 @@ class Recipe(BaseSlapRecipe):
path = self.substituteTemplate( path = self.substituteTemplate(
self.getTemplateFilename('apache.conf.path-protected.in'), self.getTemplateFilename('apache.conf.path-protected.in'),
dict(path='/', access_control_string='none')) dict(path='/',
access_control_string='none',
document_root=apache_conf['document_root'],
)
)
apache_conf.update(**dict( apache_conf.update(**dict(
path_enable=path, path_enable=path,
apachemap_path=os.path.join(self.etc_directory, apachemap_name), apachemap_path=os.path.join(self.etc_directory, apachemap_name),
apachemapzope_path=os.path.join(self.etc_directory, apachemapzope_name), apachemapzope_path=os.path.join(self.etc_directory, apachemapzope_name),
apachemapzopepath_path=os.path.join(self.etc_directory, apachemapzopepath_name),
apache_domain=name, apache_domain=name,
https_port=port, https_port=port,
plain_http_port=plain_http_port, plain_http_port=plain_http_port,
custom_apache_conf=custom_apache_configuration_file_location, custom_apache_conf=custom_apache_configuration_file_location,
custom_apache_virtualhost_conf=custom_apache_virtual_configuration_file_location,
)) ))
apache_conf_string = self.substituteTemplate( apache_conf_string = self.substituteTemplate(
...@@ -553,7 +609,7 @@ class Recipe(BaseSlapRecipe): ...@@ -553,7 +609,7 @@ class Recipe(BaseSlapRecipe):
self.path_list.extend(zc.buildout.easy_install.scripts([( self.path_list.extend(zc.buildout.easy_install.scripts([(
'frontend_apache', 'slapos.recipe.erp5.apache', 'runApache')], self.ws, 'frontend_apache', 'slapos.recipe.erp5.apache', 'runApache')], self.ws,
sys.executable, self.wrapper_directory, arguments=[ sys.executable, self.service_directory, arguments=[
dict( dict(
required_path_list=[key, certificate], required_path_list=[key, certificate],
binary=self.options['httpd_binary'], binary=self.options['httpd_binary'],
......
...@@ -5,12 +5,13 @@ ...@@ -5,12 +5,13 @@
PidFile "%(pid_file)s" PidFile "%(pid_file)s"
ServerName %(server_name)s ServerName %(server_name)s
DocumentRoot %(document_root)s DocumentRoot %(document_root)s
ServerRoot %(instance_home)s
%(listen)s %(listen)s
ServerAdmin %(server_admin)s ServerAdmin %(server_admin)s
DefaultType text/plain DefaultType text/plain
TypesConfig conf/mime.types TypesConfig %(httpd_home)s/conf/mime.types
AddType application/x-compress .Z AddType application/x-compress .Z
AddType application/x-gzip .gz .tgz AddType application/x-gzip .gz .tgz
...@@ -22,8 +23,8 @@ ServerTokens Prod ...@@ -22,8 +23,8 @@ ServerTokens Prod
# Log configuration # Log configuration
ErrorLog "%(error_log)s" ErrorLog "%(error_log)s"
LogLevel warn LogLevel warn
LogFormat "%%h %%{REMOTE_USER}i %%l %%u %%t \"%%r\" %%>s %%b \"%%{Referer}i\" \"%%{User-Agent}i\"" combined LogFormat "%%h %%{REMOTE_USER}i %%{Host}i %%l %%u %%t \"%%r\" %%>s %%b \"%%{Referer}i\" \"%%{User-Agent}i\"" combined
LogFormat "%%h %%{REMOTE_USER}i %%l %%u %%t \"%%r\" %%>s %%b" common LogFormat "%%h %%{REMOTE_USER}i %%{Host}i %%l %%u %%t \"%%r\" %%>s %%b" common
CustomLog "%(access_log)s" common CustomLog "%(access_log)s" common
%(path_enable)s %(path_enable)s
...@@ -32,23 +33,23 @@ CustomLog "%(access_log)s" common ...@@ -32,23 +33,23 @@ CustomLog "%(access_log)s" common
#LoadModule unixd_module modules/mod_unixd.so #LoadModule unixd_module modules/mod_unixd.so
#LoadModule access_compat_module modules/mod_access_compat.so #LoadModule access_compat_module modules/mod_access_compat.so
#LoadModule authz_core_module modules/mod_authz_core.so #LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_host_module %(httpd_home)s/modules/mod_authz_host.so
LoadModule log_config_module modules/mod_log_config.so LoadModule log_config_module %(httpd_home)s/modules/mod_log_config.so
LoadModule deflate_module modules/mod_deflate.so LoadModule deflate_module %(httpd_home)s/modules/mod_deflate.so
LoadModule setenvif_module modules/mod_setenvif.so LoadModule setenvif_module %(httpd_home)s/modules/mod_setenvif.so
LoadModule version_module modules/mod_version.so LoadModule version_module %(httpd_home)s/modules/mod_version.so
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_module %(httpd_home)s/modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule proxy_http_module %(httpd_home)s/modules/mod_proxy_http.so
LoadModule ssl_module modules/mod_ssl.so LoadModule ssl_module %(httpd_home)s/modules/mod_ssl.so
LoadModule mime_module modules/mod_mime.so LoadModule mime_module %(httpd_home)s/modules/mod_mime.so
LoadModule dav_module modules/mod_dav.so LoadModule dav_module %(httpd_home)s/modules/mod_dav.so
LoadModule dav_fs_module modules/mod_dav_fs.so LoadModule dav_fs_module %(httpd_home)s/modules/mod_dav_fs.so
LoadModule negotiation_module modules/mod_negotiation.so LoadModule negotiation_module %(httpd_home)s/modules/mod_negotiation.so
LoadModule rewrite_module modules/mod_rewrite.so LoadModule rewrite_module %(httpd_home)s/modules/mod_rewrite.so
LoadModule headers_module modules/mod_headers.so LoadModule headers_module %(httpd_home)s/modules/mod_headers.so
LoadModule cache_module modules/mod_cache.so LoadModule cache_module %(httpd_home)s/modules/mod_cache.so
LoadModule mem_cache_module modules/mod_mem_cache.so LoadModule mem_cache_module %(httpd_home)s/modules/mod_mem_cache.so
LoadModule antiloris_module modules/mod_antiloris.so LoadModule antiloris_module %(httpd_home)s/modules/mod_antiloris.so
# The following directives modify normal HTTP response behavior to # The following directives modify normal HTTP response behavior to
# handle known problems with browser implementations. # handle known problems with browser implementations.
...@@ -99,17 +100,28 @@ Header append Vary User-Agent ...@@ -99,17 +100,28 @@ Header append Vary User-Agent
ProxyTimeout 600 ProxyTimeout 600
RewriteEngine On RewriteEngine On
# Define the two rewritemaps : one for zope, one generic # Include configuration file not operated by slapos. This file won't be erased
# or changed when slapgrid is ran. It can be freely customized by node admin.
Include %(custom_apache_virtualhost_conf)s
# Define the two RewriteMaps (key -> value store): one for Zope, one generic
# containing: rewritten URL -> original URL (a.k.a VirtualHostBase in Zope)
RewriteMap apachemapzope txt:%(apachemapzope_path)s RewriteMap apachemapzope txt:%(apachemapzope_path)s
RewriteMap apachemapgeneric txt:%(apachemap_path)s RewriteMap apachemapgeneric txt:%(apachemap_path)s
# Define another RewriteMap for Zope, containing:
# rewritten URL -> VirtualHostRoot
RewriteMap apachemapzopepath txt:%(apachemapzopepath_path)s
# First, we check if we have a zope backend server # First, we check if we have a zope backend server
# If so, let's use Virtual Host Daemon rewrite # If so, let's use Virtual Host Daemon rewrite
RewriteCond ${apachemapzope:%%{SERVER_NAME}} >"" RewriteCond ${apachemapzope:%%{SERVER_NAME}} >""
RewriteRule ^/(.*)$ ${apachemapzope:%%{SERVER_NAME}}/VirtualHostBase/https/%%{SERVER_NAME}:%%{SERVER_PORT}/VirtualHostRoot/$1 [L,P] # We suppose that Apache listens to 443 (even indirectly thanks to things like iptables)
RewriteRule ^/(.*)$ ${apachemapzope:%%{SERVER_NAME}}/VirtualHostBase/https/%%{SERVER_NAME}:443/${apachemapzopepath:%%{SERVER_NAME}}/VirtualHostRoot/$1 [L,P]
# If we have generic backend server, let's rewrite without virtual host daemon # If we have generic backend server, let's rewrite without virtual host daemon
RewriteCond ${apachemapgeneric:%%{SERVER_NAME}} >"" RewriteCond ${apachemapgeneric:%%{SERVER_NAME}} >""
# We suppose that Apache listens to 443 (even indirectly thanks to things like iptables)
RewriteRule ^/(.*)$ ${apachemapgeneric:%%{SERVER_NAME}}/$1 [L,P] RewriteRule ^/(.*)$ ${apachemapgeneric:%%{SERVER_NAME}}/$1 [L,P]
# If nothing exist : put a nice error # If nothing exist : put a nice error
...@@ -120,6 +132,10 @@ Header append Vary User-Agent ...@@ -120,6 +132,10 @@ Header append Vary User-Agent
RewriteEngine On RewriteEngine On
ProxyPreserveHost On ProxyPreserveHost On
# Include configuration file not operated by slapos. This file won't be erased
# or changed when slapgrid is ran. It can be freely customized by node admin.
Include %(custom_apache_virtualhost_conf)s
# We accept generic (i.e not lamp) backends on http # We accept generic (i.e not lamp) backends on http
RewriteMap apachemapgeneric txt:%(apachemap_path)s RewriteMap apachemapgeneric txt:%(apachemap_path)s
RewriteCond ${apachemapgeneric:%%{SERVER_NAME}} >"" RewriteCond ${apachemapgeneric:%%{SERVER_NAME}} >""
......
# Path protected <Directory %(path)s>
<Location %(path)s>
Order Deny,Allow Order Deny,Allow
Allow from %(access_control_string)s Allow from %(access_control_string)s
</Location> </Directory>
<Directory %(document_root)s>
Order Allow,Deny
Allow from All
</Directory>
...@@ -24,13 +24,17 @@ ...@@ -24,13 +24,17 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# #
############################################################################## ##############################################################################
import shutil import shutil
import os import os
import signal import signal
import subprocess
from binascii import b2a_uu as uuencode from binascii import b2a_uu as uuencode
from slapos.recipe.librecipe import GenericBaseRecipe from slapos.recipe.librecipe import GenericBaseRecipe
class Recipe(GenericBaseRecipe): class Recipe(GenericBaseRecipe):
def install(self): def install(self):
...@@ -66,11 +70,13 @@ class Recipe(GenericBaseRecipe): ...@@ -66,11 +70,13 @@ class Recipe(GenericBaseRecipe):
) )
path_list.append(httpd_conf) path_list.append(httpd_conf)
wrapper = self.createPythonScript(self.options['wrapper'], wrapper = self.createWrapper(name=self.options['wrapper'],
'slapos.recipe.librecipe.execute.execute', command=self.options['httpd-binary'],
[self.options['httpd-binary'], '-f', self.options['httpd-conf'], parameters=[
'-DFOREGROUND'] '-f',
) self.options['httpd-conf'],
'-DFOREGROUND'
])
path_list.append(wrapper) path_list.append(wrapper)
secret_key_filename = os.path.join(self.buildout['buildout']['directory'], secret_key_filename = os.path.join(self.buildout['buildout']['directory'],
...@@ -78,7 +84,7 @@ class Recipe(GenericBaseRecipe): ...@@ -78,7 +84,7 @@ class Recipe(GenericBaseRecipe):
if not os.path.exists(secret_key_filename): if not os.path.exists(secret_key_filename):
secret_key = uuencode(os.urandom(45)).strip() secret_key = uuencode(os.urandom(45)).strip()
# Remove unsafe characters # Remove unsafe characters
secret_key = secret_key.translate(None, '"\'') secret_key = secret_key.translate(None, '"\'\\')
with open(secret_key_filename, 'w') as secret_key_file: with open(secret_key_filename, 'w') as secret_key_file:
secret_key_file.write(secret_key) secret_key_file.write(secret_key)
else: else:
...@@ -110,12 +116,16 @@ class Recipe(GenericBaseRecipe): ...@@ -110,12 +116,16 @@ class Recipe(GenericBaseRecipe):
self.substituteTemplate(self.options['template'], application_conf)) self.substituteTemplate(self.options['template'], application_conf))
path_list.append(config) path_list.append(config)
if os.path.exists(self.options['pid-file']): # Reload apache configuration.
# Reload apache configuration # notez-bien: a graceful restart or a SIGUSR1 can somehow hang the apache threads.
with open(self.options['pid-file']) as pid_file:
pid = int(pid_file.read().strip(), 10) subprocess.call([
try: self.options['httpd-binary'],
os.kill(pid, signal.SIGUSR1) # Graceful restart '-f',
except OSError: self.options['httpd-conf'],
pass '-k',
'graceful'
])
return path_list return path_list
...@@ -15,4 +15,4 @@ date.timezone = Europe/Paris ...@@ -15,4 +15,4 @@ date.timezone = Europe/Paris
file_uploads = On file_uploads = On
upload_max_filesize = 8M upload_max_filesize = 8M
post_max_size = 8M post_max_size = 8M
magic_quotes_gpc=0ff magic_quotes_gpc=Off
...@@ -24,8 +24,7 @@ ...@@ -24,8 +24,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# #
############################################################################## ##############################################################################
import os import subprocess
import signal
from slapos.recipe.librecipe import GenericBaseRecipe from slapos.recipe.librecipe import GenericBaseRecipe
...@@ -50,17 +49,23 @@ class Recipe(GenericBaseRecipe): ...@@ -50,17 +49,23 @@ class Recipe(GenericBaseRecipe):
) )
path_list.append(httpd_conf) path_list.append(httpd_conf)
wrapper = self.createPythonScript(self.options['wrapper'], wrapper = self.createWrapper(name=self.options['wrapper'],
'slapos.recipe.librecipe.execute.execute', command=self.options['httpd-binary'],
[self.options['httpd-binary'], '-f', self.options['httpd-conf'], parameters=[
'-DFOREGROUND'] '-f',
) self.options['httpd-conf'],
'-DFOREGROUND',
])
path_list.append(wrapper) path_list.append(wrapper)
if os.path.exists(self.options['pid-file']): subprocess.call([
# Reload apache configuration self.options['httpd-binary'],
with open(self.options['pid-file']) as pid_file: '-f',
pid = int(pid_file.read().strip(), 10) self.options['httpd-conf'],
os.kill(pid, signal.SIGUSR1) # Graceful restart '-k',
'graceful',
])
return path_list return path_list
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
# Basic server configuration # Basic server configuration
PidFile "%(pid_file)s" PidFile "%(pid_file)s"
LockFile "%(lock_file)s"
Listen %(ip)s:%(port)s Listen %(ip)s:%(port)s
ServerAdmin someone@email ServerAdmin someone@email
DefaultType text/plain DefaultType text/plain
...@@ -22,13 +21,15 @@ CustomLog "%(access_log)s" common ...@@ -22,13 +21,15 @@ CustomLog "%(access_log)s" common
<Directory /> <Directory />
Options FollowSymLinks Options FollowSymLinks
AllowOverride None AllowOverride None
Order deny,allow Require all denied
Deny from all
</Directory> </Directory>
ProxyPass / %(backend_url)s ProxyPass / %(backend_url)s
# List of modules # List of modules
LoadModule unixd_module modules/mod_unixd.so
LoadModule access_compat_module modules/mod_access_compat.so
LoadModule authz_core_module modules/mod_authz_core.so
LoadModule authz_host_module modules/mod_authz_host.so LoadModule authz_host_module modules/mod_authz_host.so
LoadModule log_config_module modules/mod_log_config.so LoadModule log_config_module modules/mod_log_config.so
LoadModule setenvif_module modules/mod_setenvif.so LoadModule setenvif_module modules/mod_setenvif.so
......
# vim: set et sts=2:
############################################################################## ##############################################################################
# #
# Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved. # Copyright (c) 2011 Vifib SARL and Contributors. All Rights Reserved.
......
...@@ -7,15 +7,10 @@ import sys ...@@ -7,15 +7,10 @@ import sys
hostname = "%(hostname)s" hostname = "%(hostname)s"
port = %(port)s port = %(port)s
connection_okay = False
try: try:
s = socket.create_connection((hostname, port)) s = socket.create_connection((hostname, port))
connection_okay = True
s.close() s.close()
except (socket.error, socket.timeout): except (socket.error, socket.timeout):
connection_okay = False sys.stderr.write("%(port)s on %(hostname)s isn't listening\n")
if not connection_okay:
print >> sys.stderr, "%(port)s on %(hostname)s isn't listening"
sys.exit(127) sys.exit(127)
...@@ -9,7 +9,17 @@ if [ -z $URL ]; then ...@@ -9,7 +9,17 @@ if [ -z $URL ]; then
exit 3 exit 3
fi fi
CODE=$(%(curl_path)s -k -sL $URL -w %%{http_code} -o /dev/null) CODE=$(%(curl_path)s -g -k -sL $URL -w %%{http_code} -o /dev/null)
if [ $? -eq 3 ]; then
echo "URL malformed: $URL." >&2
exit 1
fi
if [ $? -eq 7 ]; then
echo "Failed to connect to host: $URL." >&2
exit 1
fi
if [ ! $CODE ]; then if [ ! $CODE ]; then
echo "$URL is not available (server not reachable)." >&2 echo "$URL is not available (server not reachable)." >&2
......
...@@ -33,26 +33,22 @@ class Recipe(GenericBaseRecipe): ...@@ -33,26 +33,22 @@ class Recipe(GenericBaseRecipe):
def install(self): def install(self):
self.logger.info("Installing dcron...") self.logger.info("Installing dcron...")
path_list = [] options = self.options
script = self.createWrapper(name=options['binary'],
command=options['dcrond-binary'].strip(),
parameters=[
'-s', options['cron-entries'],
'-c', options['crontabs'],
'-t', options['cronstamps'],
'-f', '-l', '5',
'-M', options['catcher']
])
cronstamps = self.options['cronstamps']
cron_d = self.options['cron-entries']
crontabs = self.options['crontabs']
catcher = self.options['catcher']
binary = self.options['binary']
script = self.createPythonScript(binary,
'slapos.recipe.librecipe.execute.execute',
[self.options['dcrond-binary'].strip(), '-s', cron_d, '-c', crontabs,
'-t', cronstamps, '-f', '-l', '5', '-M', catcher]
)
path_list.append(script)
self.logger.debug('Main cron executable created at : %r', script) self.logger.debug('Main cron executable created at : %r', script)
self.logger.info("dcron successfully installed.") self.logger.info("dcron successfully installed.")
return path_list return [script]
......
...@@ -158,6 +158,24 @@ class Client(GenericBaseRecipe): ...@@ -158,6 +158,24 @@ class Client(GenericBaseRecipe):
return [wrapper] return [wrapper]
def keysplit(s):
"""
Split a string like "ssh-rsa AKLFKJSL..... ssh-rsa AAAASAF...."
and return the individual key_type + key strings.
"""
si = iter(s.split(' '))
while True:
key_type = next(si)
try:
key_value = next(si)
except StopIteration:
# odd number of elements, should not happen, yield the last one by itself
yield key_type
break
yield '%s %s' % (key_type, key_value)
class AddAuthorizedKey(GenericBaseRecipe): class AddAuthorizedKey(GenericBaseRecipe):
def install(self): def install(self):
...@@ -167,6 +185,9 @@ class AddAuthorizedKey(GenericBaseRecipe): ...@@ -167,6 +185,9 @@ class AddAuthorizedKey(GenericBaseRecipe):
path_list.append(ssh) path_list.append(ssh)
authorized_keys = AuthorizedKeysFile(os.path.join(ssh, 'authorized_keys')) authorized_keys = AuthorizedKeysFile(os.path.join(ssh, 'authorized_keys'))
authorized_keys.append(self.options['key']) for key in keysplit(self.options['key']):
# XXX key might actually be the string 'None' or 'null'
authorized_keys.append(key)
return path_list return path_list
...@@ -30,17 +30,19 @@ class Recipe(GenericBaseRecipe): ...@@ -30,17 +30,19 @@ class Recipe(GenericBaseRecipe):
def install(self): def install(self):
commandline = [self.options['equeue-binary']] parameters = [
commandline.extend(['--database', self.options['database']]) '--database', self.options['database'],
commandline.extend(['-l', self.options['log']]) '-l', self.options['log'],
]
if 'loglevel' in self.options: if 'loglevel' in self.options:
commandline.extend(['--loglevel', self.options['loglevel']]) parameters.extend(['--loglevel', self.options['loglevel']])
commandline.append(self.options['socket']) parameters.append(self.options['socket'])
wrapper = self.createWrapper(name=self.options['wrapper'],
command=self.options['equeue-binary'],
parameters=parameters)
return [wrapper]
return [self.createPythonScript(
self.options['wrapper'],
'slapos.recipe.librecipe.execute.execute',
commandline,
)]
...@@ -33,14 +33,25 @@ class Recipe(GenericBaseRecipe): ...@@ -33,14 +33,25 @@ class Recipe(GenericBaseRecipe):
kvm instance configuration. kvm instance configuration.
""" """
def install(self): def install(self):
# Sanitize drive type parameter
self.options.setdefault('disk-type', 'virtio')
if not self.options.get('disk-type') in ['ide', 'scsi', 'sd',
'mtd', 'floppy', 'pflash', 'virtio']:
print 'Warning: "disk-type" parameter is not in allowed values. Using ' \
'"virtio" value.'
self.options['disk-type'] = 'virtio'
config = dict( config = dict(
tap_interface=self.options['tap'], tap_interface=self.options['tap'],
vnc_ip=self.options['vnc-ip'], vnc_ip=self.options['vnc-ip'],
vnc_port=self.options['vnc-port'], vnc_port=self.options['vnc-port'],
nbd_ip=self.options['nbd-ip'], nbd_ip=self.options['nbd-host'],
nbd_port=self.options['nbd-port'], nbd_port=self.options['nbd-port'],
nbd2_ip=self.options.get('nbd2-host', ''),
nbd2_port=self.options.get('nbd2-port', 1024),
disk_path=self.options['disk-path'], disk_path=self.options['disk-path'],
disk_size=self.options['disk-size'], disk_size=self.options['disk-size'],
disk_type=self.options['disk-type'],
mac_address=self.options['mac-address'], mac_address=self.options['mac-address'],
smp_count=self.options['smp-count'], smp_count=self.options['smp-count'],
ram_size=self.options['ram-size'], ram_size=self.options['ram-size'],
...@@ -50,7 +61,6 @@ class Recipe(GenericBaseRecipe): ...@@ -50,7 +61,6 @@ class Recipe(GenericBaseRecipe):
shell_path=self.options['shell-path'], shell_path=self.options['shell-path'],
qemu_path=self.options['qemu-path'], qemu_path=self.options['qemu-path'],
qemu_img_path=self.options['qemu-img-path'], qemu_img_path=self.options['qemu-img-path'],
# XXX Weak password
vnc_passwd=self.options['passwd'] vnc_passwd=self.options['passwd']
) )
...@@ -67,4 +77,3 @@ class Recipe(GenericBaseRecipe): ...@@ -67,4 +77,3 @@ class Recipe(GenericBaseRecipe):
return [runner_path, controller_path] return [runner_path, controller_path]
...@@ -30,26 +30,32 @@ def getSocketStatus(host, port): ...@@ -30,26 +30,32 @@ def getSocketStatus(host, port):
disk_path = '%(disk_path)s' disk_path = '%(disk_path)s'
if not os.path.exists(disk_path): if not os.path.exists(disk_path):
subprocess.Popen(['%(qemu_img_path)s', 'create' ,'-f', 'qcow2', subprocess.Popen(['%(qemu_img_path)s', 'create' ,'-f', 'qcow2',
'%(disk_path)s', '%(disk_size)sG']) disk_path, '%(disk_size)sG'])
kvm_argument_list = ['%(qemu_path)s', '-enable-kvm', '-net', 'nic,macaddr=%(mac_address)s', kvm_argument_list = ['%(qemu_path)s',
'-enable-kvm', '-net', 'nic,macaddr=%(mac_address)s',
'-net', 'tap,ifname=%(tap_interface)s,script=no,downscript=no', '-net', 'tap,ifname=%(tap_interface)s,script=no,downscript=no',
'-smp', '%(smp_count)s', '-smp', '%(smp_count)s',
'-m', '%(ram_size)s', '-m', '%(ram_size)s',
'-drive', 'file=%(disk_path)s,if=virtio,boot=on', '-drive', 'file=%(disk_path)s,if=%(disk_type)s',
'-vnc', '%(vnc_ip)s:1,ipv4,password', '-vnc', '%(vnc_ip)s:1,ipv4,password',
'-boot', 'menu=on', '-boot', 'menu=on',
'-qmp', 'unix:%(socket_path)s,server', '-qmp', 'unix:%(socket_path)s,server',
'-pidfile', '%(pid_file_path)s', '-pidfile', '%(pid_file_path)s',
] ]
# Try to connect to NBD server # Try to connect to NBD server (and second nbd if defined)
s = getSocketStatus('%(nbd_ip)s', %(nbd_port)s) for nbd_ip, nbd_port in (
if s is None: ('%(nbd_ip)s', %(nbd_port)s), ('%(nbd2_ip)s', %(nbd2_port)s)):
# NBD is not available : launch kvm without it if nbd_ip and nbd_port:
print 'Warning : Nbd is not available.' s = getSocketStatus(nbd_ip, nbd_port)
os.execv('%(qemu_path)s', kvm_argument_list) if s is None:
else: # NBD is not available : launch kvm without it
# NBD is available print 'Warning : Nbd is not available.'
kvm_argument_list.extend(['-cdrom', 'nbd:[%(nbd_ip)s]:%(nbd_port)s']) else:
os.execv('%(qemu_path)s', kvm_argument_list) # NBD is available
kvm_argument_list.extend([
'-drive',
'file=nbd:[%%s]:%%s,media=cdrom' %% (nbd_ip, nbd_port)])
os.execv('%(qemu_path)s', kvm_argument_list)
...@@ -106,13 +106,22 @@ class BaseSlapRecipe: ...@@ -106,13 +106,22 @@ class BaseSlapRecipe:
] ]
# SLAP related information # SLAP related information
slap_connection = buildout['slap_connection'] try:
self.computer_id = slap_connection['computer_id'] slap_connection = buildout['slap_connection']
self.computer_partition_id = slap_connection['partition_id'] self.computer_id = slap_connection['computer_id']
self.server_url = slap_connection['server_url'] self.computer_partition_id = slap_connection['partition_id']
self.software_release_url = slap_connection['software_release_url'] self.server_url = slap_connection['server_url']
self.key_file = slap_connection.get('key_file') self.software_release_url = slap_connection['software_release_url']
self.cert_file = slap_connection.get('cert_file') self.key_file = slap_connection.get('key_file')
self.cert_file = slap_connection.get('cert_file')
except zc.buildout.buildout.MissingSection:
slap_connection = buildout['slap-connection']
self.computer_id = slap_connection['computer-id']
self.computer_partition_id = slap_connection['partition-id']
self.server_url = slap_connection['server-url']
self.software_release_url = slap_connection['software-release-url']
self.key_file = slap_connection.get('key-file')
self.cert_file = slap_connection.get('cert-file')
# setup egg to give possibility to generate scripts # setup egg to give possibility to generate scripts
self.egg = zc.recipe.egg.Egg(buildout, options['recipe'], options) self.egg = zc.recipe.egg.Egg(buildout, options['recipe'], options)
...@@ -161,13 +170,6 @@ class BaseSlapRecipe: ...@@ -161,13 +170,6 @@ class BaseSlapRecipe:
self._writeExecutable(wrapper_path, file_content) self._writeExecutable(wrapper_path, file_content)
return wrapper_path return wrapper_path
def createReportRunningWrapper(self, file_content):
"""Creates report runnig wrapper and returns its path"""
report_wrapper_path = os.path.join(self.wrapper_report_directory,
'slapreport')
self._writeExecutable(report_wrapper_path, file_content)
return report_wrapper_path
def substituteTemplate(self, template_location, mapping_dict): def substituteTemplate(self, template_location, mapping_dict):
"""Returns template content after substitution""" """Returns template content after substitution"""
return open(template_location, 'r').read() % mapping_dict return open(template_location, 'r').read() % mapping_dict
......
# -*- coding: utf-8 -*-
# vim: set et sts=2:
############################################################################## ##############################################################################
# #
# Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved. # Copyright (c) 2010 Vifib SARL and Contributors. All Rights Reserved.
...@@ -24,6 +26,7 @@ ...@@ -24,6 +26,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# #
############################################################################## ##############################################################################
import io
import logging import logging
import os import os
import sys import sys
...@@ -35,6 +38,8 @@ import urlparse ...@@ -35,6 +38,8 @@ import urlparse
import pkg_resources import pkg_resources
import zc.buildout import zc.buildout
from slapos.recipe.librecipe import shlex
class GenericBaseRecipe(object): class GenericBaseRecipe(object):
"""Boilerplate class for all Buildout recipes providing helpful methods like """Boilerplate class for all Buildout recipes providing helpful methods like
creating configuration file, creating wrappers, generating passwords, etc. creating configuration file, creating wrappers, generating passwords, etc.
...@@ -88,6 +93,21 @@ class GenericBaseRecipe(object): ...@@ -88,6 +93,21 @@ class GenericBaseRecipe(object):
def createExecutable(self, name, content, mode=0700): def createExecutable(self, name, content, mode=0700):
return self.createFile(name, content, mode) return self.createFile(name, content, mode)
def addLineToFile(self, filepath, line, encoding='utf8'):
"""Append a single line to a text file, if the line does not exist yet.
line must be unicode."""
try:
lines = io.open(filepath, 'r', encoding=encoding).readlines()
except IOError:
lines = []
if not line in lines:
lines.append(line)
with io.open(filepath, 'w+', encoding=encoding) as f:
f.write(u'\n'.join(lines))
def createPythonScript(self, name, absolute_function, arguments=''): def createPythonScript(self, name, absolute_function, arguments=''):
"""Create a python script using zc.buildout.easy_install.scripts """Create a python script using zc.buildout.easy_install.scripts
...@@ -107,6 +127,34 @@ class GenericBaseRecipe(object): ...@@ -107,6 +127,34 @@ class GenericBaseRecipe(object):
path, arguments=arguments)[0] path, arguments=arguments)[0]
return script return script
def createWrapper(self, name, command, parameters, comments=[], parameters_extra=False):
"""
Creates a very simple (one command) shell script for process replacement.
Takes care of quoting.
"""
lines = [ '#!/bin/sh' ]
for comment in comments:
lines.append('# %s' % comment)
lines.append('exec %s' % shlex.quote(command))
for param in parameters:
if len(lines[-1]) < 40:
lines[-1] += ' ' + shlex.quote(param)
else:
lines[-1] += ' \\'
lines.append('\t' + shlex.quote(param))
if parameters_extra:
# pass-through further parameters
lines[-1] += ' \\'
lines.append('\t$@')
content = '\n'.join(lines) + '\n'
return self.createFile(name, content, 0700)
def createDirectory(self, parent, name, mode=0700): def createDirectory(self, parent, name, mode=0700):
path = os.path.join(parent, name) path = os.path.join(parent, name)
if not os.path.exists(path): if not os.path.exists(path):
......
# -*- coding: utf-8 -*-
"""
backported part of shlex.py from Python 3.3
"""
import re
_find_unsafe = re.compile(r'[^\w@%+=:,./-]', 256).search
def quote(s):
"""Return a shell-escaped version of the string *s*."""
if not s:
return "''"
if _find_unsafe(s) is None:
return s
# use single quotes, and put single quotes into double quotes
# the string $'b is then quoted as '$'"'"'b'
return "'" + s.replace("'", "'\"'\"'") + "'"
...@@ -28,85 +28,76 @@ import subprocess ...@@ -28,85 +28,76 @@ import subprocess
from slapos.recipe.librecipe import GenericBaseRecipe from slapos.recipe.librecipe import GenericBaseRecipe
def dump(args):
mydumper_cmd = [args['mydumper']]
mydumper_cmd.extend(['-B', args['database']])
if args['socket'] is not None: def _mydumper_base_cmd(mydumper, database, user, password,
mydumper_cmd.extend(['-S', args['socket']]) socket=None, host=None, port=None, **kw):
else: cmd = [mydumper]
mydumper_cmd.extend(['-h', args['host']]) cmd.extend(['-B', database])
mydumper_cmd.etxned(['-P', args['port']])
mydumper_cmd.extend(['-u', args['user']])
if args['password'] is not None:
mydumper_cmd.extend(['-p', args['password']])
if args['compression']:
mydumper_cmd.append('--compress')
if args['rows'] is not None: if socket:
mydumper_cmd.extend(['-r', args['rows']]) cmd.extend(['-S', socket])
else:
mydumper_cmd.extend(['-o', args['directory']]) cmd.extend(['-h', host])
cmd.extend(['-P', port])
subprocess.check_call(mydumper_cmd) cmd.extend(['-u', user])
if password:
cmd.extend(['-p', password])
return cmd
def do_import(args): def do_export(args):
mydumper_cmd = [args['mydumper']] cmd = _mydumper_base_cmd(**args)
mydumper_cmd.extend(['-B', args['database']])
if args['socket'] is not None: if args['compression']:
mydumper_cmd.extend(['-S', args['socket']]) cmd.append('--compress')
else:
mydumper_cmd.extend(['-h', args['host']])
mydumper_cmd.etxned(['-P', args['port']])
mydumper_cmd.extend(['-u', args['user']]) if args['rows'] is not None:
if args['password'] is not None: cmd.extend(['-r', args['rows']])
mydumper_cmd.extend(['-p', args['password']])
mydumper_cmd.append('--overwrite-tables') cmd.extend(['-o', args['directory']])
mydumper_cmd.extend(['-d', args['directory']]) subprocess.check_call(cmd)
subprocess.check_call(mydumper_cmd)
def do_import(args):
cmd = _mydumper_base_cmd(**args)
cmd.append('--overwrite-tables')
cmd.extend(['-d', args['directory']])
subprocess.check_call(cmd)
class Recipe(GenericBaseRecipe): class Recipe(GenericBaseRecipe):
def install(self): def install(self):
# Host or socket should be defined config = {
try: 'database': self.options['database'],
self.options['host'] 'directory': self.options['backup-directory'],
except: 'user': self.options['user'],
self.options['socket'] 'password': self.options.get('password'),
}
config = dict(database=self.options['database'],
socket=self.options.get('socket'), if self.options.get('host'):
host=self.options.get('host'), config['host'] = self.options['host']
port=self.options.get('port', 3306), config['port'] = self.options.get('port', 3306)
directory=self.options['backup-directory'], elif self.options.get('socket'):
user=self.options['user'], config['socket'] = self.options['socket']
password=self.options.get('password'), else:
) raise ValueError("host or socket must be defined")
name = __name__
if self.optionIsTrue('import', False): if self.optionIsTrue('import', False):
config.update(mydumper=self.options['myloader-binary']) function = do_import
name += '.do_import' config['mydumper'] = self.options['myloader-binary']
else: else:
config.update(mydumper=self.options['mydumper-binary'], function = do_export
compression=self.optionIsTrue('compression', default=False), config['mydumper'] = self.options['mydumper-binary']
rows=self.options.get('rows'), config['compression'] = self.optionIsTrue('compression', default=False)
) config['rows'] = self.options.get('rows')
name += '.dump'
wrapper = self.createPythonScript(self.options['wrapper'], wrapper = self.createPythonScript(name=self.options['wrapper'],
name, absolute_function = '%s.%s' % (__name__, function.func_name),
config) arguments=config)
return [wrapper] return [wrapper]
...@@ -31,6 +31,7 @@ import subprocess ...@@ -31,6 +31,7 @@ import subprocess
from slapos.recipe.librecipe import GenericBaseRecipe from slapos.recipe.librecipe import GenericBaseRecipe
from slapos.recipe.librecipe import filehash from slapos.recipe.librecipe import filehash
class Recipe(GenericBaseRecipe): class Recipe(GenericBaseRecipe):
def _options(self, options): def _options(self, options):
......
...@@ -31,59 +31,76 @@ from slapos.recipe.librecipe import GenericBaseRecipe ...@@ -31,59 +31,76 @@ from slapos.recipe.librecipe import GenericBaseRecipe
class Recipe(GenericBaseRecipe): class Recipe(GenericBaseRecipe):
def install(self): def install(self):
commandline = [self.options['server-binary']] options = self.options
commandline.extend(['--callbacks', self.options['callbacks']]) script = self.createWrapper(name=options['wrapper'],
commandline.extend(['--feeds', self.options['feeds']]) command=options['server-binary'],
commandline.extend(['--equeue-socket', self.options['equeue-socket']]) parameters=[
commandline.append(self.options['host']) '--callbacks', options['callbacks'],
commandline.append(self.options['port']) '--feeds', options['feeds'],
'--equeue-socket', options['equeue-socket'],
options['host'], options['port']
],
comments=[
'',
'Upon receiving a notification, execute the callback(s).',
''])
return [script]
return [self.createPythonScript(self.options['wrapper'],
'slapos.recipe.librecipe.execute.execute',
commandline)]
class Callback(GenericBaseRecipe): class Callback(GenericBaseRecipe):
def createCallback(self, notification_id, callback): def createCallback(self, notification_id, callback):
callback_id = sha512(notification_id).hexdigest() callback_id = sha512(notification_id).hexdigest()
callback = self.createFile(os.path.join(self.options['callbacks'],
callback_id), filepath = os.path.join(self.options['callbacks'], callback_id)
callback) self.addLineToFile(filepath, callback)
return callback return filepath
def install(self): def install(self):
# XXX this path is returned multiple times, one for each callback that has been added.
return [self.createCallback(self.options['on-notification-id'], return [self.createCallback(self.options['on-notification-id'],
self.options['callback'])] self.options['callback'])]
class Notify(GenericBaseRecipe): class Notify(GenericBaseRecipe):
def createNotifier(self, notifier_binary, executable, wrapper, **kwargs): def createNotifier(self, notifier_binary, wrapper, executable,
if not os.path.exists(kwargs['log']): log, title, notification_url, feed_url):
if not os.path.exists(log):
# Just a touch # Just a touch
open(kwargs['log'], 'w').close() open(log, 'w').close()
commandline = [notifier_binary, parameters = [
'-l', kwargs['log'], '-l', log,
'--title', kwargs['title'], '--title', title,
'--feed', kwargs['feed_url'], '--feed', feed_url,
'--notification-url', kwargs['notification_url'], '--notification-url',
executable] ]
return self.createPythonScript(wrapper, parameters.extend(notification_url.split(' '))
'slapos.recipe.librecipe.execute.execute', parameters.extend(['--executable', executable])
[str(i) for i in commandline])
return self.createWrapper(name=wrapper,
command=notifier_binary,
parameters=parameters,
comments=[
'',
'Call an executable and send notification(s).',
''])
def install(self): def install(self):
feedurl = self.unparseUrl(scheme='http', host=self.options['host'], feed_url = self.unparseUrl(scheme='http', host=self.options['host'],
port=self.options['port'], port=self.options['port'],
path='/get/%s' % self.options['name']) path='/get/%s' % self.options['name'])
script = self.createNotifier( log = os.path.join(self.options['feeds'], self.options['name'])
self.options['notifier-binary'],
wrapper=self.options['wrapper'], options = self.options
executable=self.options['executable'], script = self.createNotifier(notifier_binary=options['notifier-binary'],
log=os.path.join(self.options['feeds'], self.options['name']), wrapper=options['wrapper'],
title=self.options['title'], executable=options['executable'],
notification_url=self.options['notify'], log=log,
feed_url=feedurl, title=options['title'],
) notification_url=options['notify'],
feed_url=feed_url)
return [script] return [script]
...@@ -24,14 +24,15 @@ ...@@ -24,14 +24,15 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# #
############################################################################## ##############################################################################
from json import loads as unjson
from hashlib import sha512 from hashlib import sha512
from urlparse import urlparse import inspect
import json
import os import os
import signal
import subprocess import subprocess
import sys import sys
import signal import urlparse
import inspect
from slapos.recipe.librecipe import GenericSlapRecipe from slapos.recipe.librecipe import GenericSlapRecipe
from slapos.recipe.dropbear import KnownHostsFile from slapos.recipe.dropbear import KnownHostsFile
...@@ -43,8 +44,7 @@ from slapos import slap as slapmodule ...@@ -43,8 +44,7 @@ from slapos import slap as slapmodule
def promise(args): def promise(args):
def failed_ssh(partition, ssh): def failed_ssh(partition, ssh):
# Bad python 2 syntax, looking forward python 3 to have print(file=) sys.stderr.write("SSH Connection failed\n")
print >> sys.stderr, "SSH Connection failed"
try: try:
ssh.terminate() ssh.terminate()
except: except:
...@@ -75,16 +75,20 @@ def promise(args): ...@@ -75,16 +75,20 @@ def promise(args):
slap = slapmodule.slap() slap = slapmodule.slap()
slap.initializeConnection(args['server_url'], slap.initializeConnection(args['server_url'],
key_file=args.get('key_file'), cert_file=args.get('cert_file')) key_file=args.get('key_file'),
cert_file=args.get('cert_file'))
partition = slap.registerComputerPartition(args['computer_id'], partition = slap.registerComputerPartition(args['computer_id'],
args['partition_id']) args['partition_id'])
ssh = subprocess.Popen([args['ssh_client'], '%(user)s@%(host)s/%(port)s' % args],
stdin=subprocess.PIPE,
stdout=open(os.devnull, 'w'),
stderr=open(os.devnull, 'w'))
# Rdiff Backup protocol quit command # Rdiff Backup protocol quit command
quitcommand = 'q' + chr(255) + chr(0) * 7 quitcommand = 'q' + chr(255) + chr(0) * 7
ssh_cmdline = [args['ssh_client'], '%(user)s@%(host)s/%(port)s' % args]
ssh = subprocess.Popen(ssh_cmdline, stdin=subprocess.PIPE,
stdout=open(os.devnull), stderr=open(os.devnull))
ssh.stdin.write(quitcommand) ssh.stdin.write(quitcommand)
ssh.stdin.flush() ssh.stdin.flush()
ssh.stdin.close() ssh.stdin.close()
...@@ -113,7 +117,7 @@ class Recipe(GenericSlapRecipe, Notify, Callback): ...@@ -113,7 +117,7 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
promise_path = os.path.join(self.options['promises-directory'], promise_path = os.path.join(self.options['promises-directory'],
url_hash) url_hash)
parsed_url = urlparse(url) parsed_url = urlparse.urlparse(url)
promise_dict = self.promise_base_dict.copy() promise_dict = self.promise_base_dict.copy()
promise_dict.update(user=parsed_url.username, promise_dict.update(user=parsed_url.username,
host=parsed_url.hostname, host=parsed_url.hostname,
...@@ -127,15 +131,17 @@ class Recipe(GenericSlapRecipe, Notify, Callback): ...@@ -127,15 +131,17 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
host = parsed_url.hostname host = parsed_url.hostname
known_hosts_file[host] = entry['server-key'] known_hosts_file[host] = entry['server-key']
remote_schema = '%(ssh)s -p %%s %(user)s@%(host)s' % \ # XXX use -y because the host might not yet be in the
# trusted hosts file until the next time slapgrid is run.
remote_schema = '%(ssh)s -y -p %%s %(user)s@%(host)s' % \
{ {
'ssh': self.options['sshclient-binary'], 'ssh': self.options['sshclient-binary'],
'user': parsed_url.username, 'user': parsed_url.username,
'host': parsed_url.hostname, 'host': parsed_url.hostname,
} }
command = [self.options['rdiffbackup-binary']] parameters = ['--remote-schema', remote_schema]
command.extend(['--remote-schema', remote_schema])
remote_directory = '%(port)s::%(path)s' % {'port': parsed_url.port, remote_directory = '%(port)s::%(path)s' % {'port': parsed_url.port,
'path': parsed_url.path} 'path': parsed_url.path}
...@@ -144,38 +150,39 @@ class Recipe(GenericSlapRecipe, Notify, Callback): ...@@ -144,38 +150,39 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
name_hash) name_hash)
if entry['type'] == 'push': if entry['type'] == 'push':
command.extend(['--restore-as-of', 'now']) parameters.extend(['--restore-as-of', 'now'])
command.append('--force') parameters.append('--force')
command.extend([local_directory, remote_directory]) parameters.extend([local_directory, remote_directory])
comments = ['','Push data to a PBS *-import instance.','']
else: else:
command.extend([remote_directory, local_directory]) parameters.extend([remote_directory, local_directory])
comments = ['','Pull data from a PBS *-export instance.','']
wrapper_basepath = os.path.join(self.options['wrappers-directory'], wrapper_basepath = os.path.join(self.options['wrappers-directory'],
url_hash) url_hash)
wrapper_path = wrapper_basepath
if 'notify' in entry: if 'notify' in entry:
wrapper_path = '%s_raw' % wrapper_basepath wrapper_path = wrapper_basepath + '_raw'
else:
wrapper_path = wrapper_basepath
wrapper = self.createPythonScript( wrapper = self.createWrapper(name=wrapper_path,
wrapper_path, command=self.options['rdiffbackup-binary'],
'slapos.recipe.librecipe.execute.execute', parameters=parameters,
[str(i) for i in command] comments = comments)
)
path_list.append(wrapper) path_list.append(wrapper)
if 'notify' in entry: if 'notify' in entry:
feed_url = '%s/get/%s' % (self.options['notifier-url'], feed_url = '%s/get/%s' % (self.options['notifier-url'],
entry['notification-id']) entry['notification-id'])
wrapper = self.createNotifier( wrapper = self.createNotifier(notifier_binary=self.options['notifier-binary'],
self.options['notifier-binary'], wrapper=wrapper_basepath,
wrapper=wrapper_basepath, executable=wrapper_path,
executable=wrapper_path, log=os.path.join(self.options['feeds'], entry['notification-id']),
log=os.path.join(self.options['feeds'], entry['notification-id']), title=entry.get('title', 'Untitled'),
title=entry.get('title', 'Untitled'), notification_url=entry['notify'],
notification_url=entry['notify'], feed_url=feed_url,
feed_url=feed_url, )
)
path_list.append(wrapper) path_list.append(wrapper)
#self.setConnectionDict(dict(feed_url=feed_url), entry['slave_reference']) #self.setConnectionDict(dict(feed_url=feed_url), entry['slave_reference'])
...@@ -190,39 +197,39 @@ class Recipe(GenericSlapRecipe, Notify, Callback): ...@@ -190,39 +197,39 @@ class Recipe(GenericSlapRecipe, Notify, Callback):
return path_list return path_list
def _install(self): def _install(self):
path_list = [] path_list = []
if self.optionIsTrue('client', True): if self.optionIsTrue('client', True):
self.logger.info("Client mode") self.logger.info("Client mode")
slap_connection = self.buildout['slap-connection'] slap_connection = self.buildout['slap-connection']
self.promise_base_dict = dict( self.promise_base_dict = {
server_url=slap_connection['server-url'], 'server_url': slap_connection['server-url'],
computer_id=slap_connection['computer-id'], 'computer_id': slap_connection['computer-id'],
cert_file=slap_connection.get('cert-file'), 'cert_file': slap_connection.get('cert-file'),
key_file=slap_connection.get('key-file'), 'key_file': slap_connection.get('key-file'),
partition_id=slap_connection['partition-id'], 'partition_id': slap_connection['partition-id'],
ssh_client=self.options['sshclient-binary'], 'ssh_client': self.options['sshclient-binary'],
) }
slaves = unjson(self.options['slave-instance-list']) slaves = json.loads(self.options['slave-instance-list'])
known_hosts = KnownHostsFile(self.options['known-hosts']) known_hosts = KnownHostsFile(self.options['known-hosts'])
with known_hosts: with known_hosts:
# XXX this API could be cleaner
for slave in slaves: for slave in slaves:
path_list.extend(self.add_slave(slave, known_hosts)) path_list.extend(self.add_slave(slave, known_hosts))
else: else:
command = [self.options['rdiffbackup-binary']]
self.logger.info("Server mode") self.logger.info("Server mode")
command.extend(['--restrict', self.options['path']])
command.append('--server')
wrapper = self.createPythonScript( wrapper = self.createWrapper(name=self.options['wrapper'],
self.options['wrapper'], command=self.options['rdiffbackup-binary'],
'slapos.recipe.librecipe.execute.execute', parameters=[
command) '--restrict', self.options['path'],
'--server'
])
path_list.append(wrapper) path_list.append(wrapper)
return path_list return path_list
##############################################################################
#
# Copyright (c) 2010 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.
#
##############################################################################
import md5
import os
import subprocess
import textwrap
from zc.buildout import UserError
from slapos.recipe.librecipe import GenericBaseRecipe
class Recipe(GenericBaseRecipe):
"""\
This recipe creates:
- a Postgres cluster
- configuration to allow connections from IPv4, IPv6 or unix socket.
- a superuser with provided name and generated password
- a database with provided name
- a start script in the services directory
Required options:
bin
path to the 'initdb' and 'postgres' binaries.
dbname
name of the database to be used by the application.
ipv4
set of ipv4 to listen on.
ipv6
set of ipv6 to listen on.
pgdata-directory
path to postgres configuration and data.
services
must be ${buildout:directory}/etc/service.
superuser
name of the superuser to create.
Exposed options:
password
generated password for the superuser.
url
generated DBAPI connection string.
it can be used as-is (ie. in sqlalchemy) or by the _urlparse.py recipe.
"""
def _options(self, options):
options['password'] = self.generatePassword()
options['url'] = 'postgresql://%(superuser)s:%(password)s@[%(ipv6_random)s]:%(port)s/%(dbname)s' % options
def install(self):
pgdata = self.options['pgdata-directory']
# if the pgdata already exists, skip all steps, we don't need to do anything.
if not os.path.exists(pgdata):
self.createCluster()
self.createConfig()
self.createDatabase()
self.updateSuperuser()
self.createRunScript()
# install() methods usually return the pathnames of managed files.
# If they are missing, they will be rebuilt.
# In this case, we already check for the existence of pgdata,
# so we don't need to return anything here.
return []
def check_exists(self, path):
if not os.path.isfile(path):
raise IOError('File not found: %s' % path)
def createCluster(self):
"""\
A Postgres cluster is "a collection of databases that is managed
by a single instance of a running database server".
Here we create an empty cluster.
"""
initdb_binary = os.path.join(self.options['bin'], 'initdb')
self.check_exists(initdb_binary)
pgdata = self.options['pgdata-directory']
try:
subprocess.check_call([initdb_binary,
'-D', pgdata,
'-A', 'ident',
'-E', 'UTF8',
'-U', self.options['superuser'],
])
except subprocess.CalledProcessError:
raise UserError('Could not create cluster directory in %s' % pgdata)
def createConfig(self):
pgdata = self.options['pgdata-directory']
ipv4 = self.options['ipv4']
ipv6 = self.options['ipv6']
with open(os.path.join(pgdata, 'postgresql.conf'), 'wb') as cfg:
cfg.write(textwrap.dedent("""\
listen_addresses = '%s'
logging_collector = on
log_rotation_size = 50MB
max_connections = 100
datestyle = 'iso, mdy'
lc_messages = 'en_US.UTF-8'
lc_monetary = 'en_US.UTF-8'
lc_numeric = 'en_US.UTF-8'
lc_time = 'en_US.UTF-8'
default_text_search_config = 'pg_catalog.english'
unix_socket_directory = '%s'
unix_socket_permissions = 0700
""" % (
','.join(ipv4.union(ipv6)),
pgdata,
)))
with open(os.path.join(pgdata, 'pg_hba.conf'), 'wb') as cfg:
# see http://www.postgresql.org/docs/9.2/static/auth-pg-hba-conf.html
cfg_lines = [
'# TYPE DATABASE USER ADDRESS METHOD',
'',
'# "local" is for Unix domain socket connections only (check unix_socket_permissions!)',
'local all all ident',
'host all all 127.0.0.1/32 md5',
'host all all ::1/128 md5',
]
for ip in ipv4:
cfg_lines.append('host all all %s/32 md5' % ip)
for ip in ipv6:
cfg_lines.append('host all all %s/128 md5' % ip)
cfg.write('\n'.join(cfg_lines))
def createDatabase(self):
self.runPostgresCommand(cmd='CREATE DATABASE "%s"' % self.options['dbname'])
def updateSuperuser(self):
"""\
Set a password for the cluster administrator.
The application will also use it for its connections.
"""
# http://postgresql.1045698.n5.nabble.com/Algorithm-for-generating-md5-encrypted-password-not-found-in-documentation-td4919082.html
user = self.options['superuser']
password = self.options['password']
# encrypt the password to avoid storing in the logs
enc_password = 'md5' + md5.md5(password+user).hexdigest()
self.runPostgresCommand(cmd="""ALTER USER "%s" ENCRYPTED PASSWORD '%s'""" % (user, enc_password))
def runPostgresCommand(self, cmd):
"""\
Executes a command in single-user mode, with no daemon running.
Multiple commands can be executed by providing newlines,
preceeded by backslash, between them.
See http://www.postgresql.org/docs/9.1/static/app-postgres.html
"""
pgdata = self.options['pgdata-directory']
postgres_binary = os.path.join(self.options['bin'], 'postgres')
try:
p = subprocess.Popen([postgres_binary,
'--single',
'-D', pgdata,
'postgres',
], stdin=subprocess.PIPE)
p.communicate(cmd+'\n')
except subprocess.CalledProcessError:
raise UserError('Could not create database %s' % pgdata)
def createRunScript(self):
"""\
Creates a script that runs postgres in the foreground.
'exec' is used to allow easy control by supervisor.
"""
content = textwrap.dedent("""\
#!/bin/sh
exec %(bin)s/postgres \\
-D %(pgdata-directory)s
""" % self.options)
name = os.path.join(self.options['services'], 'postgres-start')
self.createExecutable(name, content=content)
class ExportRecipe(GenericBaseRecipe):
"""\
This recipe creates an exporter script for using with the resilient stack.
Required options:
backup-directory
folder that will contain the dump file.
bin
path to the 'pg_dump' binary.
dbname
name of the database to dump.
pgdata-directory
path to postgres configuration and data.
wrapper
full path of the exporter script to create.
"""
def install(self):
wrapper = self.options['wrapper']
self.createBackupScript(wrapper)
return [wrapper]
def createBackupScript(self, wrapper):
"""\
Create a script to backup the database in 'custom' format.
"""
content = textwrap.dedent("""\
#!/bin/sh
umask 077
%(bin)s/pg_dump \\
--host=%(pgdata-directory)s \\
--format=custom \\
--file=%(backup-directory)s/database.dump \\
%(dbname)s
""" % self.options)
self.createExecutable(wrapper, content=content)
class ImportRecipe(GenericBaseRecipe):
"""\
This recipe creates an importer script for using with the resilient stack.
Required options:
backup-directory
folder that contains the dump file.
bin
path to the 'pg_restore' binary.
dbname
name of the database to restore.
pgdata-directory
path to postgres configuration and data.
wrapper
full path of the importer script to create.
"""
def install(self):
wrapper = self.options['wrapper']
self.createRestoreScript(wrapper)
return [wrapper]
def createRestoreScript(self, wrapper):
"""\
Create a script to restore the database from 'custom' format.
"""
content = textwrap.dedent("""\
#!/bin/sh
%(bin)s/pg_restore \\
--host=%(pgdata-directory)s \\
--dbname=%(dbname)s \\
--clean \\
--no-owner \\
--no-acl \\
%(backup-directory)s/database.dump
""" % self.options)
self.createExecutable(wrapper, content=content)
...@@ -28,6 +28,10 @@ import logging ...@@ -28,6 +28,10 @@ import logging
from slapos.recipe.librecipe import wrap, JSON_SERIALISED_MAGIC_KEY from slapos.recipe.librecipe import wrap, JSON_SERIALISED_MAGIC_KEY
import json import json
from slapos import slap as slapmodule from slapos import slap as slapmodule
import slapos.recipe.librecipe.generic as librecipe
import traceback
DEFAULT_SOFTWARE_TYPE = 'RootSoftwareInstance'
class Recipe(object): class Recipe(object):
""" """
...@@ -98,17 +102,15 @@ class Recipe(object): ...@@ -98,17 +102,15 @@ class Recipe(object):
request = slap.registerComputerPartition( request = slap.registerComputerPartition(
options['computer-id'], options['partition-id']).request options['computer-id'], options['partition-id']).request
isSlave = options.get('slave', '').lower() in ['y', 'yes', 'true', '1']
return_parameters = [] return_parameters = []
if 'return' in options: if 'return' in options:
return_parameters = [str(parameter).strip() return_parameters = [str(parameter).strip()
for parameter in options['return'].split()] for parameter in options['return'].split()]
else: else:
self.logger.debug("No parameter to return to main instance." self.logger.debug("No parameter to return to main instance."
"Be careful about that...") "Be careful about that...")
software_type = options.get('software-type', 'RootInstanceSoftware') software_type = options.get('software-type', DEFAULT_SOFTWARE_TYPE)
filter_kw = {} filter_kw = {}
if 'sla' in options: if 'sla' in options:
...@@ -122,16 +124,33 @@ class Recipe(object): ...@@ -122,16 +124,33 @@ class Recipe(object):
options['config-%s' % config_parameter] options['config-%s' % config_parameter]
partition_parameter_kw = self._filterForStorage(partition_parameter_kw) partition_parameter_kw = self._filterForStorage(partition_parameter_kw)
self.instance = instance = request(software_url, software_type, isSlave = options.get('slave', '').lower() in \
name, partition_parameter_kw=partition_parameter_kw, librecipe.GenericBaseRecipe.TRUE_VALUES
filter_kw=filter_kw, shared=isSlave)
return_parameter_dict = self._getReturnParameterDict(instance, self._raise_request_exception = None
return_parameters) self._raise_request_exception_formatted = None
self.instance = None
try:
self.instance = request(software_url, software_type,
name, partition_parameter_kw=partition_parameter_kw,
filter_kw=filter_kw, shared=isSlave)
return_parameter_dict = self._getReturnParameterDict(self.instance,
return_parameters)
# XXX what is the right way to get a global id?
options['instance_guid'] = self.instance.getId()
except (slapmodule.NotFoundError, slapmodule.ServerError, slapmodule.ResourceNotReady) as exc:
self._raise_request_exception = exc
self._raise_request_exception_formatted = traceback.format_exc()
for param in return_parameters: for param in return_parameters:
options['connection-%s' % param] = ''
if not self.instance:
continue
try: try:
value = return_parameter_dict[param] value = return_parameter_dict[param]
except KeyError: except KeyError:
value = '' value = ''
except (slapmodule.NotFoundError, slapmodule.ServerError, slapmodule.ResourceNotReady):
if self.failed is None: if self.failed is None:
self.failed = param self.failed = param
options['connection-%s' % param] = value options['connection-%s' % param] = value
...@@ -149,12 +168,18 @@ class Recipe(object): ...@@ -149,12 +168,18 @@ class Recipe(object):
return result return result
def install(self): def install(self):
if self._raise_request_exception:
raise self._raise_request_exception
if self.failed is not None: if self.failed is not None:
# Check instance status to know if instance has been deployed # Check instance status to know if instance has been deployed
try: try:
status = self.instance.getState() if self.instance._computer_id is not None:
except slapmodule.NotFoundError: status = self.instance.getState()
status = 'not ready yet, please try again' else:
status = 'not ready yet'
except (slapmodule.NotFoundError, slapmodule.ServerError, slapmodule.ResourceNotReady):
status = 'not ready yet'
except AttributeError: except AttributeError:
status = 'unknown' status = 'unknown'
error_message = 'Connection parameter %s not found. '\ error_message = 'Connection parameter %s not found. '\
...@@ -166,6 +191,36 @@ class Recipe(object): ...@@ -166,6 +191,36 @@ class Recipe(object):
update = install update = install
class RequestOptional(Recipe):
"""
Request a SlapOS instance. Won't fail if request failed or is not ready.
Same as slapos.cookbook:request, but won't raise in case of problem.
"""
def install(self):
if self._raise_request_exception_formatted:
self.logger.warning('Optional request failed:')
self.logger.warning(self._raise_request_exception_formatted)
elif self.failed is not None:
# Check instance status to know if instance has been deployed
try:
if self.instance._computer_id is not None:
status = self.instance.getState()
else:
status = 'not ready yet'
except (slapmodule.NotFoundError, slapmodule.ServerError):
status = 'not ready yet'
except AttributeError:
status = 'unknown'
error_message = 'Connection parameter %s not found. '\
'Requested instance is currently %s. If this error persists, '\
'check status of this instance.' % (self.failed, status)
self.logger.warning(error_message)
return []
update = install
class Serialised(Recipe): class Serialised(Recipe):
def _filterForStorage(self, partition_parameter_kw): def _filterForStorage(self, partition_parameter_kw):
return wrap(partition_parameter_kw) return wrap(partition_parameter_kw)
......
...@@ -65,6 +65,10 @@ class Recipe(object): ...@@ -65,6 +65,10 @@ class Recipe(object):
Set of IPv4 addresses. Set of IPv4 addresses.
ipv6 ipv6
Set of IPv6 addresses. Set of IPv6 addresses.
ipv4_random
One of the IPv4 addresses.
ipv6_random
One of the IPv6 addresses.
tap tap
Set of TAP interfaces. Set of TAP interfaces.
configuration configuration
...@@ -122,6 +126,13 @@ class Recipe(object): ...@@ -122,6 +126,13 @@ class Recipe(object):
# XXX: emit warning on unknown address type ? # XXX: emit warning on unknown address type ?
options['ipv4'] = ipv4_set options['ipv4'] = ipv4_set
options['ipv6'] = ipv6_set options['ipv6'] = ipv6_set
# also export single ip values for those recipes that don't support sets.
if ipv4_set:
options['ipv4_random'] = list(ipv4_set)[0]
if ipv6_set:
options['ipv6_random'] = list(ipv6_set)[0]
options['tap'] = tap_set options['tap'] = tap_set
parameter_dict = self._expandParameterDict(options, parameter_dict) parameter_dict = self._expandParameterDict(options, parameter_dict)
match = self.OPTCRE_match match = self.OPTCRE_match
......
...@@ -24,31 +24,31 @@ ...@@ -24,31 +24,31 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# #
############################################################################## ##############################################################################
from slapos.recipe.librecipe import GenericBaseRecipe
class Recipe(GenericBaseRecipe): from slapos.recipe.librecipe import GenericBaseRecipe
"""
Slapmonitor instance configuration.
"""
def __init__(self, buildout, name, options): class MonitorRecipe(GenericBaseRecipe):
return GenericBaseRecipe.__init__(self, buildout, name, options)
def install(self): def install(self):
config = dict( options = self.options
pid_file_path=self.options['pid-file'], script = self.createWrapper(name=options['path'],
database_path=self.options['database-path'], command=options['slapmonitor-path'],
slapmonitor_path = self.options['slapmonitor-path'], parameters=[
shell_path=self.options['shell-path'], options['pid-file'],
) options['database-path'],
])
return [script]
# Runners
runner_path = self.createExecutable(
self.options['path'],
self.substituteTemplate(self.getTemplateFilename('slapmonitor_run.in'),
config))
return [runner_path] class MonitorXMLRecipe(GenericBaseRecipe):
def install(self):
options = self.options
script = self.createWrapper(name=options['path'],
command=options['slapmonitor-xml-path'],
parameters=[
options['database-path'],
],
parameters_extra=True)
return [script]
def update(self):
pass
#!%(shell_path)s
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
#
exec %(slapmonitor_path)s %(pid_file_path)s %(database_path)s
...@@ -24,36 +24,23 @@ ...@@ -24,36 +24,23 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# #
############################################################################## ##############################################################################
from slapos.recipe.librecipe import GenericBaseRecipe from slapos.recipe.librecipe import GenericBaseRecipe
class Recipe(GenericBaseRecipe): class Recipe(GenericBaseRecipe):
"""
Slapmonitor instance configuration.
"""
def __init__(self, buildout, name, options):
return GenericBaseRecipe.__init__(self, buildout, name, options)
def install(self): def install(self):
config = dict( options = self.options
pid_file_path=self.options['pid-file'], script = self.createWrapper(name=options['path'],
consumption_log_path=self.options['consumption-log-path'], command=options['slapreport-path'],
database_path=self.options['database-path'], parameters=[
slapreport_path = self.options['slapreport-path'], options['pid-file'],
logbox_ip = self.options['logbox-ip'], options['consumption-log-path'],
logbox_port = self.options['logbox-port'], options['database-path'],
logbox_user = self.options['logbox-user'], options['logbox-ip'],
logbox_passwd = self.options['logbox-passwd'], options['logbox-port'],
shell_path=self.options['shell-path'], options['logbox-user'],
) options['logbox-passwd'],
])
# Runners return [script]
runner_path = self.createExecutable(
self.options['path'],
self.substituteTemplate(self.getTemplateFilename('slapreport_run.in'),
config))
return [runner_path]
def update(self):
pass
#!%(shell_path)s
# BEWARE: This file is operated by slapgrid
# BEWARE: It will be overwritten automatically
#
exec %(slapreport_path)s %(pid_file_path)s %(consumption_log_path)s %(database_path)s %(logbox_ip)s %(logbox_port)s %(logbox_user)s %(logbox_passwd)s
...@@ -39,6 +39,7 @@ class Recipe(GenericBaseRecipe): ...@@ -39,6 +39,7 @@ class Recipe(GenericBaseRecipe):
self.instance_directory = options['instance-directory'].strip() self.instance_directory = options['instance-directory'].strip()
self.partition_amount = options['partition-amount'].strip() self.partition_amount = options['partition-amount'].strip()
self.cloud9_url = options['cloud9-url'].strip() self.cloud9_url = options['cloud9-url'].strip()
self.log_file = os.path.join(options['log_dir'].strip(), 'slaprunner.log')
# Set slaprunner access URL # Set slaprunner access URL
options['access-url'] = 'http://[%s]:%s' % (self.ipv6, self.runner_port) options['access-url'] = 'http://[%s]:%s' % (self.ipv6, self.runner_port)
...@@ -59,6 +60,8 @@ class Recipe(GenericBaseRecipe): ...@@ -59,6 +60,8 @@ class Recipe(GenericBaseRecipe):
'supervisord.conf'), 'supervisord.conf'),
runner_workdir=self.workdir, runner_workdir=self.workdir,
etc_dir=self.options['etc_dir'], etc_dir=self.options['etc_dir'],
run_dir=self.options['run_dir'],
log_dir=self.options['log_dir'],
runner_host=self.ipv6, runner_host=self.ipv6,
runner_port=self.runner_port, runner_port=self.runner_port,
ipv4_address=self.ipv4, ipv4_address=self.ipv4,
...@@ -79,10 +82,12 @@ class Recipe(GenericBaseRecipe): ...@@ -79,10 +82,12 @@ class Recipe(GenericBaseRecipe):
path_list.append(config_file) path_list.append(config_file)
environment = dict( environment = dict(
PATH=os.path.dirname(self.options['git-binary']) + ':' + os.environ['PATH'], PATH=os.path.dirname(
self.options['git-binary']) + ':' + os.environ['PATH'],
GIT_SSH=self.options['ssh_client'] GIT_SSH=self.options['ssh_client']
) )
launch_args = [self.options['slaprunner'].strip(), config_file] launch_args = [self.options['slaprunner'].strip(), config_file,
'--log_file', self.log_file]
if self.optionIsTrue('debug', default=False): if self.optionIsTrue('debug', default=False):
launch_args.append('--debug') launch_args.append('--debug')
...@@ -93,3 +98,71 @@ class Recipe(GenericBaseRecipe): ...@@ -93,3 +98,71 @@ class Recipe(GenericBaseRecipe):
path_list.append(wrapper) path_list.append(wrapper)
return path_list return path_list
class Test(GenericBaseRecipe):
def _options(self, options):
self.ipv4 = options['ipv4'].strip()
self.ipv6 = options['ipv6'].strip()
self.proxy_port = options['proxy_port'].strip()
self.runner_port = options['runner_port'].strip()
self.workdir = options['working-directory'].strip()
self.software_directory = options['software-directory'].strip()
self.instance_directory = options['instance-directory'].strip()
self.partition_amount = options['partition-amount'].strip()
self.cloud9_url = options['cloud9-url'].strip()
# Set slaprunner access URL
options['access-url'] = 'http://[%s]:%s' % (self.ipv6, self.runner_port)
def install(self):
path_list = []
configuration = dict(
software_root=self.software_directory,
instance_root=self.instance_directory,
master_url='http://%s:%s/' % (self.ipv4, self.proxy_port),
computer_id='slaprunner',
partition_amount=self.partition_amount,
slapgrid_sr=self.options['slapgrid_sr'],
slapgrid_cp=self.options['slapgrid_cp'],
slapproxy=self.options['slapproxy'],
supervisor=self.options['supervisor'],
supervisord_config=os.path.join(self.instance_directory, 'etc',
'supervisord.conf'),
runner_workdir=self.workdir,
etc_dir=self.options['etc_dir'],
run_dir=self.options['etc_dir'],
log_dir=self.workdir,
runner_host=self.ipv6,
runner_port=self.runner_port,
ipv4_address=self.ipv4,
ipv6_address=self.ipv6,
proxy_host=self.ipv4,
proxy_port=self.proxy_port,
proxy_database=os.path.join(self.workdir, 'proxy.db'),
git=self.options['git-binary'],
ssh_client=self.options['ssh_client'],
public_key=self.options['public_key'],
private_key=self.options['private_key'],
cloud9_url=self.cloud9_url
)
config_file = self.createFile(self.options['slapos.cfg'],
self.substituteTemplate(self.getTemplateFilename('slapos.cfg.in'),
configuration))
path_list.append(config_file)
environment = dict(
PATH=os.path.dirname(
self.options['git-binary']) + ':' + os.environ['PATH'],
GIT_SSH=self.options['ssh_client'],
CONFIG_FILE_PATH=config_file
)
launch_args = [self.options['slaprunnertest'].strip()]
wrapper = self.createPythonScript(self.options['wrapper'],
'slapos.recipe.librecipe.execute.executee',
(launch_args, environment)
)
path_list.append(wrapper)
return path_list
import os
def execute(args):
"""Portable execution with process replacement"""
if args.get("path", None):
os.environ['PATH'] = args["path"]
os.execv(args["launch_args"][0], args["launch_args"])
...@@ -20,6 +20,8 @@ runner_port = %(runner_port)s ...@@ -20,6 +20,8 @@ runner_port = %(runner_port)s
ipv4_address = %(ipv4_address)s ipv4_address = %(ipv4_address)s
ipv6_address = %(ipv6_address)s ipv6_address = %(ipv6_address)s
etc_dir = %(etc_dir)s etc_dir = %(etc_dir)s
run_dir = %(run_dir)s
log_dir = %(log_dir)s
[slapproxy] [slapproxy]
host = %(proxy_host)s host = %(proxy_host)s
......
...@@ -87,13 +87,17 @@ class Recipe: ...@@ -87,13 +87,17 @@ class Recipe:
computer_partition_id) computer_partition_id)
self.parameter_dict = self.computer_partition.getInstanceParameterDict() self.parameter_dict = self.computer_partition.getInstanceParameterDict()
software_type = self.parameter_dict['slap_software_type'] software_type = self.parameter_dict['slap_software_type']
self.logger.info('Deploying instance with software type %s' % \
software_type)
# Raise if request software_type does not exist ...
if software_type not in self.options: if software_type not in self.options:
if 'default' in self.options: # ... Except for backward compatibility. Then use "default".
if software_type in ['RootSoftwareInstance']:
software_type = 'default' software_type = 'default'
else: else:
raise zc.buildout.UserError("This software type isn't mapped. And " raise zc.buildout.UserError("This software type (%s) isn't mapped." % \
"there's no default software type.") software_type)
instance_file_path = self.options[software_type] instance_file_path = self.options[software_type]
......
...@@ -27,6 +27,9 @@ ...@@ -27,6 +27,9 @@
import os import os
import logging import logging
import zc.buildout
class Recipe: class Recipe:
def __init__(self, buildout, name, options): def __init__(self, buildout, name, options):
self.buildout = buildout self.buildout = buildout
......
##############################################################################
#
# Copyright (c) 2010 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 BaseSlapRecipe
import os
import pkg_resources
import zc.buildout
import zc.recipe.egg
import sys
CONFIG = dict(
proxy_port='5000',
computer_id='COMPUTER',
partition_reference='test0',
)
class Recipe(BaseSlapRecipe):
def __init__(self, buildout, name, options):
self.egg = zc.recipe.egg.Egg(buildout, options['recipe'], options)
BaseSlapRecipe.__init__(self, buildout, name, options)
def installSlapOs(self):
CONFIG['slapos_directory'] = self.createDataDirectory('slapos')
CONFIG['working_directory'] = self.createDataDirectory('testnode')
CONFIG['software_root'] = os.path.join(CONFIG['slapos_directory'],
'software')
CONFIG['instance_root'] = os.path.join(CONFIG['slapos_directory'],
'instance')
CONFIG['proxy_database'] = os.path.join(CONFIG['slapos_directory'],
'proxy.db')
CONFIG['proxy_host'] = self.getLocalIPv4Address()
CONFIG['master_url'] = 'http://%s:%s' % (CONFIG['proxy_host'],
CONFIG['proxy_port'])
self._createDirectory(CONFIG['software_root'])
self._createDirectory(CONFIG['instance_root'])
CONFIG['slapos_config'] = self.createConfigurationFile('slapos.cfg',
self.substituteTemplate(pkg_resources.resource_filename(__name__,
'template/slapos.cfg.in'), CONFIG))
self.path_list.append(CONFIG['slapos_config'])
def setupRunningWrapper(self):
self.path_list.extend(zc.buildout.easy_install.scripts([(
'testnode',
__name__+'.testnode', 'run')], self.ws,
sys.executable, self.wrapper_directory, arguments=[
dict(
environment=self.getRuntimeEnvironment(),
computer_id=CONFIG['computer_id'],
instance_dict=eval(self.parameter_dict.get('instance_dict', '{}')),
instance_root=CONFIG['instance_root'],
ipv4_address=self.getLocalIPv4Address(),
ipv6_address=self.getGlobalIPv6Address(),
master_url=CONFIG['master_url'],
profile_url=self.parameter_dict['profile_url'],
proxy_database=CONFIG['proxy_database'],
slapgrid_partition_binary=self.options['slapgrid_partition_binary'],
slapgrid_software_binary=self.options['slapgrid_software_binary'],
slapos_config=CONFIG['slapos_config'],
slapproxy_binary=self.options['slapproxy_binary'],
software_root=CONFIG['software_root'],
buildbot_binary=self.options['buildbot_binary'],
working_directory=CONFIG['working_directory'],
buildbot_host=self.parameter_dict['buildbot_host'],
slave_name=self.parameter_dict['slave_name'],
slave_password=self.parameter_dict['slave_password'],
bin_directory=self.bin_directory,
# botenvironemnt is splittable string of key=value to substitute
# environment of running bot
bot_environment=self.parameter_dict.get('bot_environment', ''),
partition_reference=CONFIG['partition_reference'],
)
]))
def installLocalSvn(self):
svn_dict = dict(svn_binary = self.options['svn_binary'])
svn_dict.update(self.parameter_dict)
svn_path = os.path.join(self.bin_directory, 'svn')
self._writeExecutable(svn_path, """\
#!/bin/sh
%(svn_binary)s --username %(svn_username)s --password %(svn_password)s \
--non-interactive --trust-server-cert --no-auth-cache "$@" """% svn_dict)
self.path_list.append(svn_path)
svnversion = os.path.join(self.bin_directory, 'svnversion')
if os.path.lexists(svnversion):
os.unlink(svnversion)
os.symlink(self.options['svnversion_binary'], svnversion)
self.path_list.append(svnversion)
def installLocalGit(self):
git = os.path.join(self.bin_directory, 'git')
if os.path.lexists(git):
os.unlink(git)
os.symlink(self.options['git_binary'], git)
self.path_list.append(git)
def installLocalZip(self):
zip = os.path.join(self.bin_directory, 'zip')
if os.path.lexists(zip):
os.unlink(zip)
os.symlink(self.options['zip_binary'], zip)
self.path_list.append(zip)
def installLocalPython(self):
"""Installs local python fully featured with eggs"""
self.path_list.extend(zc.buildout.easy_install.scripts([], self.ws,
sys.executable, self.bin_directory, scripts=None,
interpreter='python'))
def installLocalRunUnitTest(self):
link = os.path.join(self.bin_directory, 'runUnitTest')
destination = os.path.join(CONFIG['instance_root'],
CONFIG['partition_reference'], 'bin', 'runUnitTest')
if os.path.lexists(link):
if not os.readlink(link) != destination:
os.unlink(link)
if not os.path.lexists(link):
os.symlink(destination, link)
self.path_list.append(link)
def _installBuildbot(self):
self.setupRunningWrapper()
self.installLocalPython()
self.installLocalGit()
self.installLocalSvn()
self.installLocalRunUnitTest()
return self.path_list
def getRuntimeEnvironment(self):
env = {}
env['PATH'] = ':'.join([self.bin_directory] +
os.environ['PATH'].split(':'))
return env
def _installProfileTesting(self):
self.path_list.extend(zc.buildout.easy_install.scripts([(
'testnode',
__name__+'.profile_testnode', 'run')], self.ws,
sys.executable, self.wrapper_directory, arguments=[
dict(
environment=self.getRuntimeEnvironment(),
slapgrid_environment=eval(self.parameter_dict.get(
'slapgrid_environment', '{}')),
profile_path=self.parameter_dict.get('profile_path',
'slapos/software.cfg'),
repository=self.parameter_dict['repository'],
# Optional URL of test aggreagation system
test_suite_master_url=self.parameter_dict['test_suite_master_url'],
suite_name=self.parameter_dict['suite_name'],
branch=self.parameter_dict.get('branch', 'master'),
# internal parameters
software_root=CONFIG['software_root'],
computer_id=CONFIG['computer_id'],
git_binary=self.options['git_binary'],
master_url=CONFIG['master_url'],
proxy_database=CONFIG['proxy_database'],
slapgrid_software_binary=self.options['slapgrid_software_binary'],
slapos_config=CONFIG['slapos_config'],
slapproxy_binary=self.options['slapproxy_binary'],
working_directory=CONFIG['working_directory'],
bin_directory=self.bin_directory,
partition_reference=CONFIG['partition_reference'],
)
]))
return self.path_list
def _install(self):
self.requirements, self.ws = self.egg.working_set()
self.path_list = []
self.installSlapOs()
self.installLocalZip()
flavour = self.parameter_dict.get('flavour', 'buildbot')
if flavour == 'buildbot':
return self._installBuildbot()
elif flavour == 'profile-testing':
return self._installProfileTesting()
raise NotImplementedError('Falvour %r is unknown'% flavour)
import urlparse
import urllib
import httplib
import mimetools
from random import randint
import tempfile
import os
import stat
import zipfile
import mimetypes
import datetime
TB_SEP = "============================================================="\
"========="
def get_content_type(f):
return mimetypes.guess_type(f.name)[0] or 'application/octet-stream'
class ConnectionHelper:
def __init__(self, url):
self.conn = urlparse.urlparse(url)
if self.conn.scheme == 'http':
connection_type = httplib.HTTPConnection
if self.conn.port is None:
self.port = 80
else:
connection_type = httplib.HTTPSConnection
if self.conn.port is None:
self.port = 443
self.connection_type = connection_type
def _connect(self):
self.connection = self.connection_type(self.conn.hostname + ':' +
str(self.conn.port or self.port))
def POST(self, path, parameter_dict, file_list=None):
self._connect()
parameter_dict.update(__ac_name=self.conn.username,
__ac_password=self.conn.password)
header_dict = {'Content-type': "application/x-www-form-urlencoded"}
if file_list is None:
body = urllib.urlencode(parameter_dict)
else:
boundary = mimetools.choose_boundary()
header_dict['Content-type'] = 'multipart/form-data; boundary=%s' % (
boundary,)
body = ''
for k, v in parameter_dict.iteritems():
body += '--%s\r\n' % boundary
body += 'Content-Disposition: form-data; name="%s"\r\n' % k
body += '\r\n'
body += '%s\r\n' % v
for name, filename in file_list:
f = open(filename, 'r')
body += '--%s\r\n' % boundary
body += 'Content-Disposition: form-data; name="%s"; filename="%s"\r\n'\
% (name, name)
body += 'Content-Type: %s\r\n' % get_content_type(f)
body += 'Content-Length: %d\r\n' % os.fstat(f.fileno())[stat.ST_SIZE]
body += '\r\n'
body += f.read()
f.close()
body += '\r\n'
self.connection.request("POST", self.conn.path + '/' + path,
body, header_dict)
self.response = self.connection.getresponse()
class ERP5TestReportHandler:
def __init__(self, url, suite_name):
# random test id
self.test_id = "%s-%X" % (
("%s" % datetime.date.today()).replace("-", ""),
randint(1, 10000000000000000),
)
self.connection_helper = ConnectionHelper(url)
self.suite_name = suite_name
def reportStart(self):
# report that test is running
print 'Starting test with id %s' % self.test_id
self.connection_helper.POST('TestResultModule_reportRunning', dict(
test_suite=self.suite_name,
test_report_id=self.test_id,
))
def reportFinished(self, out_file, revision, success, duration, text):
# make file parsable by erp5_test_results
tempcmd = tempfile.mkstemp()[1]
tempcmd2 = tempfile.mkstemp()[1]
tempout = tempfile.mkstemp()[1]
templog = tempfile.mkstemp()[1]
log_lines = open(out_file, 'r').readlines()
tl = open(templog, 'w')
tl.write(TB_SEP + '\n')
if len(log_lines) > 900:
tl.write('...[truncated]... \n\n')
for log_line in log_lines[-900:]:
starts = log_line.startswith
if starts('Ran') or starts('FAILED') or starts('OK') or starts(TB_SEP):
continue
if starts('ERROR: ') or starts('FAIL: '):
tl.write('internal-test: ' + log_line)
continue
tl.write(log_line)
tl.write("----------------------------------------------------------------------\n")
tl.write('Ran 1 test in %.2fs\n' % duration)
if success:
tl.write('OK\n')
else:
tl.write('FAILED (failures=1)\n')
tl.write(TB_SEP + '\n')
tl.close()
open(tempcmd, 'w').write("""svn info dummy""")
open(tempcmd2, 'w').write(self.suite_name)
open(tempout, 'w').write("Revision: %s\n%s" % (revision, text))
# create nice zip archive
tempzip = tempfile.mkstemp()[1]
zip = zipfile.ZipFile(tempzip, 'w')
zip.write(tempcmd, 'dummy/001/cmdline')
zip.write(tempout, 'dummy/001/stdout')
zip.write(templog, 'dummy/001/stderr')
zip.write(tempout, '%s/002/stdout' % self.suite_name)
zip.write(templog, '%s/002/stderr' % self.suite_name)
zip.write(tempcmd2, '%s/002/cmdline' % self.suite_name)
zip.close()
os.unlink(templog)
os.unlink(tempcmd)
os.unlink(tempout)
os.unlink(tempcmd2)
# post it to ERP5
self.connection_helper.POST('TestResultModule_reportCompleted', dict(
test_report_id=self.test_id),
file_list=[('filepath', tempzip)]
)
os.unlink(tempzip)
import os
import socket
import signal
import shutil
import slapos.slap
import subprocess
import time
import atexit
from erp5testreporthandler import ERP5TestReportHandler
process_group_pid_list = []
def clean():
for pgpid in process_group_pid_list:
try:
os.killpg(pgpid, signal.SIGTERM)
except:
pass
def sigterm_handler(signal, frame):
clean()
def sigint_handler(signal, frame):
clean()
raise KeyboardInterrupt
signal.signal(signal.SIGINT, sigint_handler)
signal.signal(signal.SIGTERM, sigterm_handler)
atexit.register(clean)
def getCurrentBranchName(config, p):
r = subprocess.Popen([config['git_binary'], 'branch'], stdout=subprocess.PIPE, cwd=p).communicate()[0]
for f in r.splitlines():
if f.startswith('*'):
return f.split()[1]
return ''
def getRevision(config, p):
return subprocess.Popen([config['git_binary'], 'rev-parse', 'HEAD'], stdout=subprocess.PIPE, cwd=p).communicate()[0].strip()
def getCurrentFetchRemote(config, p):
r = subprocess.Popen([config['git_binary'], 'remote', '-v'], stdout=subprocess.PIPE, cwd=p).communicate()[0]
remote = ''
for f in r.splitlines():
if f.startswith('origin') and f.endswith('(fetch)'):
if remote != '':
raise ValueError('Too many remotes: %s' % r)
remote = r.split()[1]
return remote
def getMachineIdString():
"""Returns machine identification string"""
kw = dict(stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
idstr = subprocess.Popen(["uname", "-m"], **kw).communicate()[0].strip()
# try to detect gcc version
try:
gcc_list = subprocess.Popen(["gcc", "-v"], **kw).communicate()[0].split(
'\n')
for gcc in gcc_list:
if gcc.startswith('gcc version'):
idstr += ' gcc:' + gcc.split()[2]
break
except IndexError:
pass
# try to detect libc version
try:
libdir = os.path.sep + 'lib'
for libso in os.listdir(libdir):
if libso.startswith('libc.') and os.path.islink(os.path.join(libdir,
libso)):
libc = os.readlink(os.path.join(libdir, libso))
if libc.endswith('.so'):
idstr += ' libc:' + libc.split('-')[1][:-3]
else:
idstr += ' ' + libc
break
except IndexError:
pass
return idstr
def run(args):
config = args[0]
for k,v in config['environment'].iteritems():
os.environ[k] = v
proxy = None
slapgrid = None
last_revision_file = os.path.join(config['working_directory'],
'revision.txt')
if os.path.exists(last_revision_file):
os.unlink(last_revision_file)
# fetch repository from git
repository_clone = os.path.join(config['working_directory'], 'repository')
profile_path = os.path.join(repository_clone, config['profile_path'])
if os.path.exists(config['proxy_database']):
os.unlink(config['proxy_database'])
proxy = subprocess.Popen([config['slapproxy_binary'],
config['slapos_config']], close_fds=True, preexec_fn=os.setsid)
process_group_pid_list.append(proxy.pid)
slap = slapos.slap.slap()
slap.initializeConnection(config['master_url'])
while True:
try:
slap.registerSupply().supply(profile_path,
computer_guid=config['computer_id'])
except socket.error:
time.sleep(1)
pass
else:
break
while True:
info_list = []
a = info_list.append
while True:
try:
if os.path.exists(repository_clone):
if getCurrentFetchRemote(config, repository_clone) != config['repository']:
shutil.rmtree(repository_clone)
if not os.path.exists(repository_clone):
subprocess.check_call([config['git_binary'], 'clone',
config['repository'], repository_clone])
# switch to branch
branch = getCurrentBranchName(config, repository_clone)
if branch != config['branch']:
subprocess.check_call([config['git_binary'], 'checkout', '--force',
'--track', '-b', config['branch'], 'origin/'+config['branch']],
cwd=repository_clone)
subprocess.check_call([config['git_binary'], 'reset', '--hard',
'@{upstream}'], cwd=repository_clone)
except Exception:
print 'Retrying git in 60s'
time.sleep(60)
else:
break
a('Tested repository: %s' % config['repository'])
a('Machine identification: %s' % getMachineIdString())
erp5_report = ERP5TestReportHandler(config['test_suite_master_url'],
'@'.join([config['suite_name'], branch]))
last_revision = ''
if os.path.exists(last_revision_file):
last_revision = open(last_revision_file).read().strip()
revision = getRevision(config, repository_clone)
open(last_revision_file, 'w').write(revision)
if revision != last_revision:
print 'Running for revision %r' % revision
while True:
try:
erp5_report.reportStart()
except Exception:
print 'Retrying in 5s'
time.sleep(5)
else:
break
if os.path.exists(config['software_root']):
shutil.rmtree(config['software_root'])
os.mkdir(config['software_root'])
out_file = os.path.join(config['working_directory'], 'slapgrid.out')
if os.path.exists(out_file):
os.unlink(out_file)
out = open(out_file, 'w')
begin = time.time()
slapgrid_environment = os.environ.copy()
for k, v in config['slapgrid_environment'].iteritems():
slapgrid_environment[k] = v
a('Slapgrid environment: %r'% config['slapgrid_environment'])
slapgrid = subprocess.Popen([config['slapgrid_software_binary'], '-vc',
config['slapos_config']], close_fds=True, preexec_fn=os.setsid,
stdout=out, stderr=subprocess.STDOUT, env=slapgrid_environment)
process_group_pid_list.append(slapgrid.pid)
slapgrid.communicate()
out.close()
while True:
try:
erp5_report.reportFinished(out_file,revision,
slapgrid.returncode == 0, time.time() - begin,
'\n'.join(info_list))
except Exception:
print 'Retrying in 5s'
time.sleep(5)
else:
break
print 'Sleeping for 600s'
time.sleep(600)
[slapos]
software_root = %(software_root)s
instance_root = %(instance_root)s
master_url = %(master_url)s
computer_id = %(computer_id)s
[slapproxy]
host = %(proxy_host)s
port = %(proxy_port)s
database_uri = %(proxy_database)s
from xml_marshaller import xml_marshaller
import os
import signal
import slapos.slap
import socket
import subprocess
import sys
import time
process_group_pid_list = []
process_pid_file_list = []
process_command_list = []
def sigterm_handler(signal, frame):
for pgpid in process_group_pid_list:
try:
os.killpg(pgpid, signal.SIGTERM)
except:
pass
for pid_file in process_pid_file_list:
try:
os.kill(int(open(pid_file).read().strip()), signal.SIGTERM)
except:
pass
for p in process_command_list:
try:
subprocess.call(p)
except:
pass
sys.exit(1)
signal.signal(signal.SIGTERM, sigterm_handler)
def run(args):
config = args[0]
for k,v in config['environment'].iteritems():
os.environ[k] = v
proxy = None
slapgrid = None
supervisord_pid_file = os.path.join(config['instance_root'], 'var', 'run',
'supervisord.pid')
if os.path.exists(config['proxy_database']):
os.unlink(config['proxy_database'])
try:
proxy = subprocess.Popen([config['slapproxy_binary'],
config['slapos_config']], close_fds=True, preexec_fn=os.setsid)
process_group_pid_list.append(proxy.pid)
slap = slapos.slap.slap()
slap.initializeConnection(config['master_url'])
while True:
try:
slap.registerSupply().supply(config['profile_url'],
computer_guid=config['computer_id'])
except socket.error:
time.sleep(1)
pass
else:
break
while True:
slapgrid = subprocess.Popen([config['slapgrid_software_binary'], '-vc',
config['slapos_config']], close_fds=True, preexec_fn=os.setsid)
process_group_pid_list.append(slapgrid.pid)
slapgrid.wait()
if slapgrid.returncode == 0:
print 'Software installed properly'
break
print 'Problem with software installation, trying again'
time.sleep(600)
computer = slap.registerComputer(config['computer_id'])
partition_reference = config['partition_reference']
partition_path = os.path.join(config['instance_root'], partition_reference)
if not os.path.exists(partition_path):
os.mkdir(partition_path)
os.chmod(partition_path, 0750)
computer.updateConfiguration(xml_marshaller.dumps({
'address': config['ipv4_address'],
'instance_root': config['instance_root'],
'netmask': '255.255.255.255',
'partition_list': [{'address_list': [{'addr': config['ipv4_address'],
'netmask': '255.255.255.255'},
{'addr': config['ipv6_address'],
'netmask': 'ffff:ffff:ffff::'},
],
'path': partition_path,
'reference': partition_reference,
'tap': {'name': partition_reference},
}
],
'reference': config['computer_id'],
'software_root': config['software_root']}))
slap.registerOpenOrder().request(config['profile_url'],
partition_reference='testing partition',
partition_parameter_kw=config['instance_dict'])
slapgrid = subprocess.Popen([config['slapgrid_partition_binary'], '-vc',
config['slapos_config']], close_fds=True, preexec_fn=os.setsid)
slapgrid.wait()
if slapgrid.returncode != 0:
raise ValueError('Slapgrid instance failed')
runUnitTest = os.path.join(partition_path, 'bin', 'runUnitTest')
if not os.path.exists(runUnitTest):
raise ValueError('No %r provided' % runUnitTest)
except:
try:
if os.path.exists(supervisord_pid_file):
os.kill(int(open(supervisord_pid_file).read().strip()), signal.SIGTERM)
except:
pass
raise
finally:
# Nice way to kill *everything* generated by run process -- process
# groups working only in POSIX compilant systems
# Exceptions are swallowed during cleanup phase
if proxy is not None:
os.killpg(proxy.pid, signal.SIGTERM)
if os.path.exists(config['proxy_database']):
os.unlink(config['proxy_database'])
if slapgrid is not None and slapgrid.returncode is None:
os.killpg(slapgrid.pid, signal.SIGTERM)
try:
bot_env = os.environ.copy()
bot_env['PATH'] = ':'.join([config['bin_directory']] +
bot_env['PATH'].split(':'))
for l in config['bot_environment'].split():
k, v = l.split('=')
bot_env[k] = v
if subprocess.call([config['buildbot_binary'], 'create-slave', '-f',
config['working_directory'], config['buildbot_host'],
config['slave_name'], config['slave_password']]) != 0:
raise ValueError('Buildbot call failed')
process_command_list.append([config['buildbot_binary'], 'stop',
config['working_directory']])
if os.path.exists(os.path.join(config['working_directory'],
'buildbot.tac.new')):
tac = os.path.join(config['working_directory'], 'buildbot.tac')
if os.path.exists(tac):
os.unlink(tac)
os.rename(os.path.join(config['working_directory'],
'buildbot.tac.new'), tac)
if subprocess.call([config['buildbot_binary'], 'start',
config['working_directory']], env=bot_env) != 0:
raise ValueError('Issue during starting buildbot')
while True:
time.sleep(3600)
finally:
try:
subprocess.call([config['buildbot_binary'], 'stop',
config['working_directory']])
except:
pass
try:
if os.path.exists(supervisord_pid_file):
os.kill(int(open(supervisord_pid_file).read().strip()), signal.SIGTERM)
except:
pass
[buildout]
parts =
instance
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
agent_binary = ${buildout:directory}/bin/agent
pidfile = $${directory:srv}/agent.pid
log = $${directory:agentlog}/agent.log
wrapper = $${directory:run}/agent
config = $${directory:etc}/agent.cfg
master-url = $${slap-parameter:master-url}
key = $${slap-parameter:userkey}
cert = $${slap-parameter:usercertificate}
configuration = $${slap-parameter:configuration}
default_max_install_duration = $${slap-parameter:default_max_install_duration}
default_max_uninstall_duration = $${slap-parameter:default_max_uninstall_duration}
default_max_request_duration = $${slap-parameter:default_max_request_duration}
default_max_destroy_duration = $${slap-parameter:default_max_destroy_duration}
[directory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc
run = $${:etc}/run
agentlog = $${buildout:directory}/var/log/agent
srv = $${buildout:directory}/srv
bin = $${buildout:directory}/bin
[buildout] [buildout]
parts = parts =
instance switch_softwaretype
eggs-directory = ${buildout:eggs-directory} eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory} develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[instance] [switch_softwaretype]
recipe = ${instance-recipe:egg}:${instance-recipe:module} recipe = slapos.cookbook:softwaretype
agent_binary = ${buildout:directory}/bin/agent default = ${template-agent:output}
report_start = ${buildout:directory}/bin/report_start
report_stop = ${buildout:directory}/bin/report_stop
dcrond_binary = ${dcron:location}/sbin/crond
python_binary = ${python2.7:location}/bin/python
pidfile = $${rootdirectory:run}/agent.pid
log = $${rootdirectory:agentlog}/agent.log
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
run = $${buildout:directory}/etc/run
agentlog = $${buildout:directory}/var/log/agent
srv = $${buildout:directory}/srv
bin = $${buildout:directory}/bin
[buildout] [buildout]
extends = extends =
../../component/dcron/buildout.cfg
../../component/python-2.7/buildout.cfg
../../component/lxml-python/buildout.cfg ../../component/lxml-python/buildout.cfg
../../component/git/buildout.cfg
../../stack/slapos.cfg ../../stack/slapos.cfg
develop =
${:parts-directory}/slapos.cookbook-repository
${:parts-directory}/slapos.toolbox-repository
parts = parts =
template template
eggs template-agent
slapos.cookbook-repository
check-recipe
slapos.toolbox-repository
check-recipe-toolbox
instance-recipe-egg instance-recipe-egg
dcron
python2.7
script script
# Local development
[slapos.cookbook-repository]
recipe = plone.recipe.command
stop-on-error = true
branch = agent
location = ${buildout:parts-directory}/${:_buildout_section_name_}
command = ${git:location}/bin/git clone --branch ${:branch} --quiet http://git.erp5.org/repos/slapos.git ${:location}
update-command = cd ${:location} && ${git:location}/bin/git pull --quiet
[check-recipe]
recipe = plone.recipe.command
stop-on-error = true
update-command = ${:command}
command = grep parts ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link
[slapos.toolbox-repository]
recipe = plone.recipe.command
stop-on-error = true
branch = agent
location = ${buildout:parts-directory}/${:_buildout_section_name_}
command = ${git:location}/bin/git clone --branch ${:branch} --quiet http://git.erp5.org/repos/slapos.toolbox.git ${:location}
update-command = cd ${:location} && ${git:location}/bin/git pull --quiet
[check-recipe-toolbox]
recipe = plone.recipe.command
stop-on-error = true
update-command = ${:command}
command = grep parts ${buildout:develop-eggs-directory}/slapos.toolbox.egg-link
[instance-recipe] [instance-recipe]
# XXX-Cedric: it can use newest slapos.cfg to not have duplication
egg = slapos.cookbook egg = slapos.cookbook
module = agent module = agent
[instance-recipe-egg] [instance-recipe-egg]
# XXX-Cedric: it can use newest slapos.cfg to not have duplication
recipe = zc.recipe.egg recipe = zc.recipe.egg
python = python2.7 eggs =
eggs = ${instance-recipe:egg} ${lxml-python:egg}
${instance-recipe:egg}
[template] [template]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg url = ${:_profile_base_location_}/instance.cfg
output = ${buildout:directory}/template.cfg output = ${buildout:directory}/template.cfg
md5sum = c7cb98594f394d05baedabe424643f6f md5sum = bcd3b3cb8a305c83bb048d5ac1c583fe
mode = 0644 mode = 0644
[eggs] [template-agent]
python = python2.7 recipe = slapos.recipe.template
recipe = zc.recipe.egg url = ${:_profile_base_location_}/instance-agent.cfg
eggs = output = ${buildout:directory}/template-agent.cfg
${lxml-python:egg} md5sum = fd9670d8473be402b10990398b553b00
slapos.cookbook mode = 0644
slapos.toolbox
erp5.util
[lxml-python]
python = python2.7
[script] [script]
recipe = z3c.recipe.scripts recipe = z3c.recipe.scripts
python = python2.7
eggs = eggs =
zc.buildout zc.buildout
${lxml-python:egg}
slapos.core slapos.core
slapos.cookbook
slapos.toolbox[agent] slapos.toolbox[agent]
erp5.util
[networkcache] [networkcache]
# signature certificates of the following uploaders. # signature certificates of the following uploaders.
# Romain Courteaud # Romain Courteaud
# Cedric de Saint Martin
# Rafael Monnerat
# Test agent
signature-certificate-list = signature-certificate-list =
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIB4DCCAUkCADANBgkqhkiG9w0BAQsFADA5MQswCQYDVQQGEwJGUjEZMBcGA1UE MIIB4DCCAUkCADANBgkqhkiG9w0BAQsFADA5MQswCQYDVQQGEwJGUjEZMBcGA1UE
...@@ -68,3 +101,42 @@ signature-certificate-list = ...@@ -68,3 +101,42 @@ signature-certificate-list =
q7jdfWO18Zp/BG7tagz0jmmC4y/8akzHsVlruo2+2du2freE8dK746uoMlXlP93g q7jdfWO18Zp/BG7tagz0jmmC4y/8akzHsVlruo2+2du2freE8dK746uoMlXlP93g
QUUGLQ== QUUGLQ==
-----END CERTIFICATE----- -----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
BAMMCENPTVAtMjMyMCAXDTEyMDIxNjExMTAyM1oYDzIxMTIwMTIzMTExMDIzWjAT
MREwDwYDVQQDDAhDT01QLTIzMjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
wi/3Z8W9pUiegUXIk/AiFDQ0UJ4JFAwjqr+HSRUirlUsHHT+8DzH/hfcTDX1I5BB
D1ADk+ydXjMm3OZrQcXjn29OUfM5C+g+oqeMnYQImN0DDQIOcUyr7AJc4xhvuXQ1
P2pJ5NOd3tbd0kexETa1LVhR6EgBC25LyRBRae76qosCAwEAAaNQME4wHQYDVR0O
BBYEFMDmW9aFy1sKTfCpcRkYnP6zUd1cMB8GA1UdIwQYMBaAFMDmW9aFy1sKTfCp
cRkYnP6zUd1cMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAskbFizHr
b6d3iIyN+wffxz/V9epbKIZVEGJd/6LrTdLiUfJPec7FaxVCWNyKBlCpINBM7cEV
Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby
If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAOcKrOH/2Da6MA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
BAMMCENPTVAtMjk3MCAXDTEyMDYyNjAzMDU1MVoYDzIxMTIwNjAyMDMwNTUxWjAT
MREwDwYDVQQDDAhDT01QLTI5NzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
xzbOGlcoin2q+Mtp52r26Njliz2aoxIXbnOBUyDc/OGtk9nWA5uBtTc2zwR17um6
KV0bGyvuBA78XcvU+AIV/5s0ohBAX7yjRKmEhAYcFvov3EyWSdjOrqqo4qFSzOrK
sVQBlxIDpjQBH4F3lf6dBv6/M+tCT3iSv3aOZbsG0E8CAwEAAaNQME4wHQYDVR0O
BBYEFLqtrfTu+BIVt+TFiRUkIoiWIYrxMB8GA1UdIwQYMBaAFLqtrfTu+BIVt+TF
iRUkIoiWIYrxMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAc8N5P5gW
Jrdk9gF/3Cpp6THDiy93+WcuAm7zFwXPFNttJtFKMNObP2YRZvsQkvjezfrZoRBF
j8LgKB3tZCbBj+HDj+AeD+q9V+cqMFLKc6LezvQYUuum6bZdfUNnPv1K1ULYSPjq
/jsRBbabCWSXqxR6gYEM6ooauj3udBMXhHE=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAKRvzcy7OH0UMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
BAMMCENPTVAtNzcyMCAXDTEyMDgxMDE1NDI1MVoYDzIxMTIwNzE3MTU0MjUxWjAT
MREwDwYDVQQDDAhDT01QLTc3MjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
o7aipd6MbnuGDeR1UJUjuMLQUariAyQ2l2ZDS6TfOwjHiPw/mhzkielgk73kqN7A
sUREx41eTcYCXzTq3WP3xCLE4LxLg1eIhd4nwNHj8H18xR9aP0AGjo4UFl5BOMa1
mwoyBt3VtfGtUmb8whpeJgHhqrPPxLoON+i6fIbXDaUCAwEAAaNQME4wHQYDVR0O
BBYEFEfjy3OopT2lOksKmKBNHTJE2hFlMB8GA1UdIwQYMBaAFEfjy3OopT2lOksK
mKBNHTJE2hFlMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAaNRx6YN2
M/p3R8/xS6zvH1EqJ3FFD7XeAQ52WuQnKSREzuw0dsw12ClxjcHiQEFioyTiTtjs
5pW18Ry5Ie7iFK4cQMerZwWPxBodEbAteYlRsI6kePV7Gf735Y1RpuN8qZ2sYL6e
x2IMeSwJ82BpdEI5niXxB+iT0HxhmR+XaMI=
-----END CERTIFICATE-----
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
delete = install
table_name = utilisateur
constraint = `id_utilisateur`>0
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://www.agora-project.net/agora-project.zip
md5sum = 3fecb27ca5d3bb6c263dbd87113f3cce
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
...@@ -9,15 +9,22 @@ It means that a single main instance of Apache will be used to act as frontend ...@@ -9,15 +9,22 @@ It means that a single main instance of Apache will be used to act as frontend
for many slaves. for many slaves.
How to use How to deploy a frontend server
========== ===============================
First, you will need to request a "master" instance of Apache Frontend with This is to deploy an entire frontend server with a public IPv4.
"domain" parameter, like:: If you want to use an already deployed frontend to make your service available
via ipv4, switch to the "Example" parts.
First, you will need to request a "master" instance of Apache Frontend with:
* A "domain" parameter where the frontend will be available
* A "public-ipv4" parameter to state which public IPv4 will be used
like::
<?xml version='1.0' encoding='utf-8'?> <?xml version='1.0' encoding='utf-8'?>
<instance> <instance>
<parameter id="domain">moulefrite.org</parameter> <parameter id="domain">moulefrite.org</parameter>
<parameter id="port">443</parameter> <parameter id="public-ipv4">xxx.xxx.xxx.xxx</parameter>
</instance> </instance>
Then, it is possible to request many slave instances Then, it is possible to request many slave instances
...@@ -69,11 +76,11 @@ url of backend to use. ...@@ -69,11 +76,11 @@ url of backend to use.
"url" is a mandatory parameter. "url" is a mandatory parameter.
Example: http://mybackend.com/myresource Example: http://mybackend.com/myresource
cache enable_cache
~~~~~ ~~~~~
Specify if slave instance should use a varnish / stunnel to connect to backend. Specify if slave instance should use a varnish / stunnel to connect to backend.
Possible values: "true", "false". Possible values: "true", "false".
"cache" is an optional parameter. Defaults to "false". "enable_cache" is an optional parameter. Defaults to "false".
Example: true Example: true
type type
...@@ -81,30 +88,83 @@ type ...@@ -81,30 +88,83 @@ type
Specify if slave instance will redirect to a zope backend. If specified, Apache Specify if slave instance will redirect to a zope backend. If specified, Apache
RewriteRule will use Zope's Virtual Host Daemon. RewriteRule will use Zope's Virtual Host Daemon.
Possible values: "zope", "default". Possible values: "zope", "default".
"type" is an optional parameter. Defaults to "default". "type" is an optional parameter. Defaults to "default".
Example: zope Example: zope
custom_domain custom_domain
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
Domain name to use as frontend. The frontend will be accessible from this domain. Domain name to use as frontend. The frontend will be accessible from this domain.
"custom_domain" is an optional parameter. Defaults to "custom_domain" is an optional parameter. Defaults to
[instancereference].[masterdomain]. [instancereference].[masterdomain].
Example: www.mycustomdomain.com Example: www.mycustomdomain.com
path
~~~~
Only used if type is "zope".
Will append the specified path to the "VirtualHostRoot" of the zope's
VirtualHostMonster.
"path" is an optional parameter, ignored if not specified.
Example of value: "/erp5/web_site_module/hosting/"
Examples
========
Here are some example of how to make your SlapOS service available through
an already deployed frontend.
Simple Example
--------------
Request slave frontend instance so that https://[1:2:3:4:5:6:7:8]:1234 will be
redirected and accessible from the proxy::
instance = request(
software_release=apache_frontend,
software_type="RootSoftwareInstance",
partition_reference='my frontend',
shared=True,
partition_parameter_kw={
"url":"https://[1:2:3:4:5:6:7:8]:1234",
}
)
Zope Example
------------
Request slave frontend instance using a Zope backend so that
https://[1:2:3:4:5:6:7:8]:1234 will be redirected and accessible from the
proxy::
instance = request(
software_release=apache_frontend,
software_type="RootSoftwareInstance",
partition_reference='my frontend',
shared=True,
partition_parameter_kw={
"url":"https://[1:2:3:4:5:6:7:8]:1234",
"type":"zope",
}
)
Advanced example Advanced example
================ ----------------
Request slave frontend instance using a Zope backend, with Varnish activated, Request slave frontend instance using a Zope backend, with Varnish activated,
listening to a custom domain:: listening to a custom domain and redirecting to /erp5/ so that
https://[1:2:3:4:5:6:7:8]:1234/erp5/ will be redirected and accessible from
the proxy::
instance = request( instance = request(
software_release=apache_frontend, software_release=apache_frontend,
partition_reference='frontend2', software_type="RootSoftwareInstance",
partition_reference='my frontend',
shared=True, shared=True,
partition_parameter_kw={ partition_parameter_kw={
"url":"https://[1:2:3:4]:1234/someresource", "url":"https://[1:2:3:4:5:6:7:8]:1234",
"cache":"true", "enable_cache":"true",
"type":"zope", "type":"zope",
"path":"/erp5",
"custom_domain":"mycustomdomain.com", "custom_domain":"mycustomdomain.com",
} }
) )
...@@ -115,5 +175,9 @@ Notes ...@@ -115,5 +175,9 @@ Notes
It is not possible with slapos to listen to port <= 1024, because process are It is not possible with slapos to listen to port <= 1024, because process are
not run as root. It is a good idea then to go on the node where the instance is not run as root. It is a good idea then to go on the node where the instance is
and set some iptables rules like (if using default ports):: and set some iptables rules like (if using default ports)::
iptables -t nat -A PREROUTING -p tcp -d {public ip} --dport 443 -j DNAT --to-destination {listening ip}:4443
iptables -t nat -A PREROUTING -p tcp -d {public_ip} --dport 80 -j DNAT --to-destination {listening ip}:8080 iptables -t nat -A PREROUTING -p tcp -d {public_ipv4} --dport 443 -j DNAT --to-destination {listening_ipv4}:4443
iptables -t nat -A PREROUTING -p tcp -d {public_ipv4} --dport 80 -j DNAT --to-destination {listening_ipv4}:8080
Where {public ip} is the public IP of your server, or at least the LAN IP to where your NAT will forward to.
{listening ip} is the private ipv4 (like 10.0.34.123) that the instance is using and sending as connection parameter.
[buildout]
extends =
../../component/binutils/buildout.cfg
../../component/lxml-python/buildout.cfg
../../component/apache/buildout.cfg
../../component/stunnel/buildout.cfg
../../component/varnish/buildout.cfg
../../component/dcron/buildout.cfg
../../component/logrotate/buildout.cfg
../../component/rdiff-backup/buildout.cfg
../../stack/slapos.cfg
parts =
template
binutils
apache-2.2
apache-antiloris-apache-2.2
stunnel
varnish-2.1
dcron
logrotate
rdiff-backup
# Buildoutish
eggs
instance-recipe-egg
[instance-recipe]
# Note: In case if specific instantiation recipe is used this is the place to
# put its name
egg = slapos.cookbook
module = apache.frontend
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs = ${instance-recipe:egg}
[eggs]
recipe = zc.recipe.egg
eggs =
${lxml-python:egg}
[template]
# Default template for apache instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
md5sum = fea902a2b9dbf8c80ff201bcf73f9396
output = ${buildout:directory}/template.cfg
mode = 0644
\ No newline at end of file
# Development profile of apache-frontend.
# Exactly the same as software.cfg, but fetch the slapos.cookbook
# from git repository instead of fetching stable version,
# allowing to play with bleeding edge environment.
# You'll need to run buildout twice for this profile.
[buildout]
extends =
# Extend in this order, otherwise "parts" will be taken from git profile
../../component/git/buildout.cfg
common.cfg
parts +=
slapos.cookbook-repository
develop =
${:parts-directory}/slapos.cookbook-repository
[slapos.cookbook-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.git
branch = frontend
git-executable = ${git:location}/bin/git
[check-recipe]
recipe = plone.recipe.command
stop-on-error = true
update-command = ${:command}
command =
grep parts ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link &&
[buildout] [buildout]
parts = parts =
directory
instance instance
configtest
eggs-directory = ${buildout:eggs-directory} eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory} develop-eggs-directory = ${buildout:develop-eggs-directory}
# Create all needed directories
[directory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/
var = $${buildout:directory}/var/
srv = $${buildout:directory}/srv/
bin = $${buildout:directory}/bin/
service = $${:etc}/service
# Deploy Apache (old way, with monolithic recipe)
[instance] [instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module} recipe = ${instance-recipe:egg}:${instance-recipe:module}
httpd_home = ${apache-2.2:location}
httpd_binary = ${apache-2.2:location}/bin/httpd httpd_binary = ${apache-2.2:location}/bin/httpd
logrotate_binary = ${logrotate:location}/usr/sbin/logrotate logrotate_binary = ${logrotate:location}/usr/sbin/logrotate
openssl_binary = ${openssl:location}/bin/openssl openssl_binary = ${openssl:location}/bin/openssl
...@@ -14,5 +28,12 @@ dcrond_binary = ${dcron:location}/sbin/crond ...@@ -14,5 +28,12 @@ dcrond_binary = ${dcron:location}/sbin/crond
varnishd_binary = ${varnish-2.1:location}/sbin/varnishd varnishd_binary = ${varnish-2.1:location}/sbin/varnishd
stunnel_binary = ${stunnel:location}/bin/stunnel stunnel_binary = ${stunnel:location}/bin/stunnel
rdiff_backup_binary = ${buildout:bin-directory}/rdiff-backup rdiff_backup_binary = ${buildout:bin-directory}/rdiff-backup
gcc_binary = ${gcc-java-minimal:location}/bin/gcc gcc_binary = gcc
binutils_directory = ${binutils:location}/bin/ binutils_directory = ${binutils:location}/bin/
# Create wrapper for "apachectl conftest" in bin
[configtest]
recipe = slapos.cookbook:wrapper
command-line = $${instance:httpd_binary} -f $${directory:etc}/apache_frontend.conf -t
output = $${directory:bin}/apache-configtest
[buildout] [buildout]
versions = versions extends = common.cfg
extends =
../../component/binutils/buildout.cfg
../../component/gcc/buildout.cfg
../../component/lxml-python/buildout.cfg
../../component/apache/buildout.cfg
../../component/stunnel/buildout.cfg
../../component/varnish/buildout.cfg
../../component/dcron/buildout.cfg
../../component/logrotate/buildout.cfg
../../component/rdiff-backup/buildout.cfg
../../stack/slapos.cfg
parts =
template
binutils
gcc-java-minimal
apache-2.2
apache-antiloris-apache-2.2
stunnel
varnish-2.1
dcron
logrotate
rdiff-backup
# Buildoutish
eggs
instance-recipe-egg
[instance-recipe]
# Note: In case if specific instantiation recipe is used this is the place to
# put its name
egg = slapos.cookbook
module = apache.frontend
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs = ${instance-recipe:egg}
[eggs]
recipe = zc.recipe.egg
eggs =
${lxml-python:egg}
[template]
# Default template for apache instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
md5sum = 74c0f41246d167c020854a212e919ce4
output = ${buildout:directory}/template.cfg
mode = 0644
[versions] [versions]
Jinja2 = 2.6 Jinja2 = 2.6
Werkzeug = 0.8.3 Werkzeug = 0.8.3
buildout-versions = 1.7 buildout-versions = 1.7
hexagonit.recipe.cmmi = 1.5.0 hexagonit.recipe.cmmi = 1.6
meld3 = 0.6.8 meld3 = 0.6.10
rdiff-backup = 1.0.5 rdiff-backup = 1.0.5
slapos.cookbook = 0.52 slapos.cookbook = 0.71.1
slapos.recipe.template = 2.3 slapos.recipe.build = 0.11.5
slapos.recipe.template = 2.4.2
# Required by: # Required by:
# slapos.core==0.24 # slapos.core==0.33.1
Flask = 0.8 Flask = 0.9
# Required by: # Required by:
# slapos.cookbook==0.52 # hexagonit.recipe.cmmi==1.6
PyXML = 0.8.4 hexagonit.recipe.download = 1.6
# Required by: # Required by:
# slapos.cookbook==0.52 # slapos.cookbook==0.71.1
inotifyx = 0.2.0 inotifyx = 0.2.0
# Required by: # Required by:
# slapos.cookbook==0.52 # slapos.cookbook==0.71.1
# slapos.core==0.24 # slapos.core==0.33.1
# xml-marshaller==0.9.7 # xml-marshaller==0.9.7
lxml = 2.3.4 lxml = 3.0.2
# Required by: # Required by:
# slapos.cookbook==0.52 # slapos.cookbook==0.71.1
netaddr = 0.7.6 netaddr = 0.7.10
# Required by: # Required by:
# slapos.core==0.24 # slapos.core==0.33.1
netifaces = 0.8 netifaces = 0.8
# Required by: # Required by:
# slapos.cookbook==0.52 # slapos.cookbook==0.71.1
# slapos.core==0.24 pytz = 2012j
# zc.buildout==1.6.0-dev-SlapOS-004
# Required by:
# slapos.cookbook==0.71.1
# slapos.core==0.33.1
# zc.buildout==1.6.0-dev-SlapOS-010
# zc.recipe.egg==1.3.2 # zc.recipe.egg==1.3.2
setuptools = 0.6c12dev-r88846 setuptools = 0.6c12dev-r88846
# Required by: # Required by:
# slapos.cookbook==0.52 # slapos.cookbook==0.71.1
slapos.core = 0.24 slapos.core = 0.33.1
# Required by: # Required by:
# slapos.core==0.24 # slapos.core==0.33.1
supervisor = 3.0a12 supervisor = 3.0b1
# Required by: # Required by:
# slapos.cookbook==0.52 # slapos.cookbook==0.71.1
xml-marshaller = 0.9.7 xml-marshaller = 0.9.7
# Required by: # Required by:
# slapos.cookbook==0.52 # slapos.core==0.33.1
zc.recipe.egg = 1.3.2 zope.interface = 4.0.3
# Required by:
# slapos.core==0.24
zope.interface = 4.0.0
[networkcache] [networkcache]
# Cedric de Saint Martin signature certificate # signature certificates of the following uploaders.
# Cedric de Saint Martin
# Romain Courteaud
# Test Agent
signature-certificate-list = signature-certificate-list =
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
...@@ -133,3 +85,29 @@ signature-certificate-list = ...@@ -133,3 +85,29 @@ signature-certificate-list =
Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby
If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY= If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY=
-----END CERTIFICATE----- -----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIB4DCCAUkCADANBgkqhkiG9w0BAQsFADA5MQswCQYDVQQGEwJGUjEZMBcGA1UE
CBMQRGVmYXVsdCBQcm92aW5jZTEPMA0GA1UEChMGTmV4ZWRpMB4XDTExMDkxNTA5
MDAwMloXDTEyMDkxNTA5MDAwMlowOTELMAkGA1UEBhMCRlIxGTAXBgNVBAgTEERl
ZmF1bHQgUHJvdmluY2UxDzANBgNVBAoTBk5leGVkaTCBnzANBgkqhkiG9w0BAQEF
AAOBjQAwgYkCgYEApYZv6OstoqNzxG1KI6iE5U4Ts2Xx9lgLeUGAMyfJLyMmRLhw
boKOyJ9Xke4dncoBAyNPokUR6iWOcnPHtMvNOsBFZ2f7VA28em3+E1JRYdeNUEtX
Z0s3HjcouaNAnPfjFTXHYj4um1wOw2cURSPuU5dpzKBbV+/QCb5DLheynisCAwEA
ATANBgkqhkiG9w0BAQsFAAOBgQBCZLbTVdrw3RZlVVMFezSHrhBYKAukTwZrNmJX
mHqi2tN8tNo6FX+wmxUUAf3e8R2Ymbdbn2bfbPpcKQ2fG7PuKGvhwMG3BlF9paEC
q7jdfWO18Zp/BG7tagz0jmmC4y/8akzHsVlruo2+2du2freE8dK746uoMlXlP93g
QUUGLQ==
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAKRvzcy7OH0UMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
BAMMCENPTVAtNzcyMCAXDTEyMDgxMDE1NDI1MVoYDzIxMTIwNzE3MTU0MjUxWjAT
MREwDwYDVQQDDAhDT01QLTc3MjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
o7aipd6MbnuGDeR1UJUjuMLQUariAyQ2l2ZDS6TfOwjHiPw/mhzkielgk73kqN7A
sUREx41eTcYCXzTq3WP3xCLE4LxLg1eIhd4nwNHj8H18xR9aP0AGjo4UFl5BOMa1
mwoyBt3VtfGtUmb8whpeJgHhqrPPxLoON+i6fIbXDaUCAwEAAaNQME4wHQYDVR0O
BBYEFEfjy3OopT2lOksKmKBNHTJE2hFlMB8GA1UdIwQYMBaAFEfjy3OopT2lOksK
mKBNHTJE2hFlMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAaNRx6YN2
M/p3R8/xS6zvH1EqJ3FFD7XeAQ52WuQnKSREzuw0dsw12ClxjcHiQEFioyTiTtjs
5pW18Ry5Ie7iFK4cQMerZwWPxBodEbAteYlRsI6kePV7Gf735Y1RpuN8qZ2sYL6e
x2IMeSwJ82BpdEI5niXxB+iT0HxhmR+XaMI=
-----END CERTIFICATE-----
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
delete = install
table_name = users
constraint = `userId`>0
\ No newline at end of file
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://script.arfooo.com/telecharger/arfooo-2.0.2.zip
md5sum = 51ca32fa2c66d8ad810f15a45edbf5a7
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
\ No newline at end of file
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://chamilo.googlecode.com/files/chamilo-1.8.8.4.zip
md5sum = 38ea9bc58e1ef5baa334a9b103dda98c
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs = ${instance-recipe:egg}
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
delete = claroline/install
table_name = category
constraint = `id`>0
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://garr.dl.sourceforge.net/project/claroline/Claroline/Claroline%201.10.6/claroline1106.tar.gz
md5sum = 28b198c90a12fda0eabbbea1dc9ef042
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
\ No newline at end of file
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
downloadcache-workaround
extends =
../../stack/lamp.cfg
../../stack/shacache-client.cfg
[application]
recipe = hexagonit.recipe.download
url = http://www.splitbrain.org/_media/projects/dokuwiki/dokuwiki-2011-05-25a.tgz
md5sum = 6452eff54afa35e031e15fec9a737dd1
#If provided tarball does not contain top directory, option shall be changed to false
strip-top-level-dir = true
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs = ${instance-recipe:egg}
[versions]
# Use SlapOS patched zc.buildout
zc.buildout = 1.5.3-dev-SlapOS-010
[downloadcache-workaround]
# workaround irritating problem of hexagonit.recipe.cmmi which automatically
# creates download cache, which in turn switches builout to "semi-offline" mode
recipe = plone.recipe.command
# in hexagonit.recipe.cmmi if there is no ${buildout:download-cache} set it resolves
# to ${buildout:directory}/downloads but this variable is available late, that's
# why it is hardcoded only for required case
download-cache = ${buildout:directory}/downloads
command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
update-command = ${:command}
stop-on-error = True
\ No newline at end of file
...@@ -16,7 +16,7 @@ extends = ...@@ -16,7 +16,7 @@ extends =
[application] [application]
recipe = slapos.recipe.build:download-unpacked recipe = slapos.recipe.build:download-unpacked
url = http://download.dotclear.net/latest-2.0.tar.gz url = http://download.dotclear.net/latest-2.0.tar.gz
md5sum = 98263b4734f93b7c54d3ab436bf344e3 md5sum = 4ca12cbd12228ceee0b7c0f697e1ff09
[application-template] [application-template]
recipe = slapos.recipe.download recipe = slapos.recipe.download
......
...@@ -200,12 +200,23 @@ ...@@ -200,12 +200,23 @@
* ); * );
* @endcode * @endcode
*/ */
/*
+ * The apachephp recipe provided with both host+port in the same string.
+ * Split them again, php way.
+ * And it could be an ipv6 as well, so beware of colons.
+ */
$mysql_host_port = '%(mysql_host)s';
$mysql_port = substr(strrchr($mysql_host_port, ":"), 1);
$mysql_host = substr($mysql_host_port, 0, strlen($mysql_host_port) - strlen($mysql_port) - 1);
$databases['default']['default'] = array( $databases['default']['default'] = array(
'driver' => 'mysql', 'driver' => 'mysql',
'database' => '%(mysql_database)s', 'database' => '%(mysql_database)s',
'username' => '%(mysql_user)s', 'username' => '%(mysql_user)s',
'password' => '%(mysql_password)s', 'password' => '%(mysql_password)s',
'host' => '%(mysql_host)s', 'host' => $mysql_host,
'port' => $mysql_port,
'prefix' => '', 'prefix' => '',
); );
......
...@@ -3,15 +3,30 @@ ...@@ -3,15 +3,30 @@
extends = extends =
../../stack/lamp/buildout.cfg ../../stack/lamp/buildout.cfg
parts +=
patch-hide-dbsetup
[application] [application]
recipe = slapos.recipe.build:download-unpacked recipe = slapos.recipe.build:download-unpacked
url = http://ftp.drupal.org/files/projects/drupal-7.15.tar.gz url = http://ftp.drupal.org/files/projects/drupal-7.16.tar.gz
md5sum = f42c9baccd74e1d035d61ff537ae21b4 md5sum = 352497b2df94b5308e31cb8da020b631
[download-patch-hide-dbsetup]
recipe = hexagonit.recipe.download
url = ${:_profile_base_location_}/${:filename}
md5sum = 44a1689173bc8c51cc384218296d826e
download-only = true
filename = system.theme.css.patch
[patch-hide-dbsetup]
recipe = cp.recipe.cmd
install_cmd = patch ${application:location}/modules/system/system.theme.css <${download-patch-hide-dbsetup:location}/${download-patch-hide-dbsetup:filename}
[application-template] [application-template]
recipe = slapos.recipe.download recipe = slapos.recipe.download
url = ${:_profile_base_location_}/settings.php.in url = ${:_profile_base_location_}/settings.php.in
md5sum = add9e4e96094a9d3fb7cf0f4d26ae544 md5sum = b0ef5548c3ac1de8ca56882e51e6eb6d
download-only = True download-only = True
filename = template.in filename = template.in
mode = 0644 mode = 0644
......
--- a/system.theme.css Mon Oct 29 11:20:30 2012 +0100
+++ b/system.theme.css Mon Oct 29 11:20:53 2012 +0100
@@ -1,3 +1,14 @@
+
+#install-settings-form .form-item-driver,
+#install-settings-form #edit-mysql * {
+ display: none;
+}
+
+#install-settings-form #edit-mysql:before {
+ content: "The database has been set up by SlapOS.";
+ font-weight: bold;
+ font-size: 120%;
+}
/**
* @file
[buildout]
parts =
test-runner
sh-environment
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[create-directory]
recipe = slapos.cookbook:mkdirectory
bin = $${buildout:directory}/bin
etc = $${buildout:directory}/etc
services = $${:etc}/run
srv = $${buildout:directory}/srv
source-code = $${:srv}/eggs-source-code
[download-source]
recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git
# Local development
[erp5-util]
<= download-source
repository = ${erp5-util-repository:location}
[test-runner]
recipe = slapos.cookbook:egg_test
run-test-suite = $${create-directory:bin}/runTestSuite
run-test-suite-binary = ${buildout:bin-directory}/runTestSuite
# The list of executables should be defined here and a combination
# of tests should dynamically generated.
#python-list = $${}
test-list =
$${erp5-util:location}
prepend-path = ${git:location}/bin:${libxslt:location}/bin:${python2.7:location}/bin
environment = environment
[environment]
CPPFLAGS = -I${python2.7:location}/include/python2.7 -I${libxml2:location}/include -I${libxslt:location}/include
LDFLAGS = -L${python2.7:location}/lib -L${libxml2:location}/lib -L${libxslt:location}/lib -L${zlib:location}/lib
PYTHONPATH = ${python-setuptools:location}
LD_LIBRARY_PATH = ${libxslt:location}/lib
[sh-environment]
# Section exposes testing default environment as sh file. It is thus easy
# to directly develop and test the egg inside of this instance.
recipe = collective.recipe.template
input = inline:
export PATH="$${test-runner:prepend-path}:$PATH"
export CPPFLAGS="$${environment:CPPFLAGS}"
export LDFLAGS="$${environment:LDFLAGS}"
export PYTHONPATH="$${environment:PYTHONPATH}"
export PS1="[slapos-testing env Active] $PS1"
output = $${create-directory:bin}/environment.sh
mode = 755
[buildout]
extends =
../../component/git/buildout.cfg
../../component/lxml-python/buildout.cfg
../../component/libxml2/buildout.cfg
../../component/libxslt/buildout.cfg
../../component/python-2.7/buildout.cfg
../../component/python-setuptools/buildout.cfg
../../component/zlib/buildout.cfg
../../stack/slapos.cfg
parts =
slapos.cookbook-repository
erp5-util-repository
eggs
template
[eggs]
recipe = zc.recipe.egg
eggs =
${lxml-python:egg}
erp5.util
slapos.cookbook
collective.recipe.template
entry-points =
runTestSuite=erp5.util.testsuite:runTestSuite
scripts =
runTestSuite
[slapos.cookbook-repository]
recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git
forbid-download-cache = true
repository = http://git.erp5.org/repos/slapos.git
branch = master
[erp5-util-repository]
recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git
forbid-download-cache = true
repository = http://git.erp5.org/repos/erp5.git
branch = master
[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
md5sum = 0cdfaa1df03885bd6004755d285e69b5
output = ${buildout:directory}/template.cfg
mode = 640
[versions]
Jinja2 = 2.6
Werkzeug = 0.8.3
buildout-versions = 1.7
erp5.util = 0.4.7
hexagonit.recipe.cmmi = 1.6
lxml = 2.3.6
meld3 = 0.6.8
plone.recipe.command = 1.1
slapos.cookbook = 0.65
slapos.libnetworkcache = 0.13.2
slapos.recipe.build = 0.11.2
slapos.recipe.download = 1.0.dev-r4053
slapos.recipe.template = 2.4.2
# Required by:
# slapos.core==0.28.5
Flask = 0.9
# Required by:
# slapos.cookbook==0.65
PyXML = 0.8.4
# Required by:
# hexagonit.recipe.cmmi==1.6
hexagonit.recipe.download = 1.5.1
# Required by:
# slapos.cookbook==0.65
inotifyx = 0.2.0
# Required by:
# slapos.cookbook==0.65
netaddr = 0.7.10
# Required by:
# slapos.core==0.28.5
netifaces = 0.8
# Required by:
# erp5.util==0.4.7
# slapos.cookbook==0.65
# slapos.core==0.28.5
# zc.buildout==1.6.0-dev-SlapOS-006
# zc.recipe.egg==1.3.2
setuptools = 0.6c12dev-r88846
# Required by:
# slapos.cookbook==0.65
slapos.core = 0.28.5
# Required by:
# slapos.core==0.28.5
supervisor = 3.0a12
# Required by:
# slapos.cookbook==0.65
xml-marshaller = 0.9.7
# Required by:
# slapos.cookbook==0.65
zc.recipe.egg = 1.3.2
# Required by:
# slapos.core==0.28.5
zope.interface = 4.0.1
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://freefr.dl.sourceforge.net/project/opengoo/fengoffice/fengoffice_2.0.0/fengoffice_2.0.0.zip
md5sum = 2f673962ac377da7942ba8a09429ddbf
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${instance-recipe:egg}
\ No newline at end of file
# -*- coding: utf-8 -*-
import sys
import os
def setup(args):
base_url, htdocs, renamed, mysql_user, mysql_password, mysql_database, mysql_host = args
os.rename(os.path.join(htdocs, "config.inc.php"), os.path.join(htdocs, "config.php"))
config_php = os.path.join(htdocs, "config.php")
os.chmod(config_php, 0444)
if __name__ == '__main__':
setup(sys.argv[1:])
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
template = ${application-template:location}/${application-template:filename}
configuration = ${application-configuration:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
table_name = users
constraint = `id`>1
script = ${configure-script:location}/${configure-script:filename}
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
configure-script
extends =
../../stack/lamp.cfg
[application]
recipe = hexagonit.recipe.download:download-unpacked
url = http://fluxbb.org/download/releases/1.4.7/fluxbb-1.4.7.tar.bz2
md5sum = bc2168205d404421729cc3b040d6fe15
[configure-script]
recipe = hexagonit.recipe.download
location = ${buildout:parts-directory}/${:_buildout_section_name_}
url = ${:_profile_base_location_}/configure-fluxbb.py
filename = configure-fluxbb.py
[application-template]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/template/config.inc.php.in
filename = template.in
mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[application-configuration]
location = config.inc.php
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
\ No newline at end of file
<?php
$db_type = 'mysql';
$db_host = '%(mysql_host)s';
$db_name = '%(mysql_database)s';
$db_username = '%(mysql_user)s';
$db_password = '%(mysql_password)s';
$db_prefix = 'fbb_';
$p_connect = false;
$cookie_name = 'pun_cookie_357edd';
$cookie_domain = '';
$cookie_path = '/';
$cookie_secure = 0;
$cookie_seed = 'aba88f605e01bfe2';
define('PUN', 1);
# -*- coding: utf-8 -*-
import sys
import os
def setup(args):
'''
Freeglobes doesn't put the good url of the application
this script ensure the url is the good one
'''
mysql_port, mysql_host, mysql_user, mysql_password, mysql_database, base_url, htdocs = args
config_file = os.path.join(htdocs, "conf/config.php")
new_config_file = os.path.join(htdocs, "conf/config_new.php")
install_dir = os.path.join(htdocs, "install")
software_url = "$CONFIG['site_url'] = '%s'; " % base_url
f = open(config_file, 'r')
f1 = open(new_config_file, 'w+')
for line in f.readlines():
if "$CONFIG['site_url']" not in line:
f1.write(line)
else:
f1.write(software_url)
f.close()
f1.close()
os.remove(config_file)
os.rename(new_config_file, config_file)
os.rename(install_dir, '%s_done' % install_dir)
if __name__ == '__main__':
setup(sys.argv[1:])
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
table_name = user
constraint = `id`=1
script = ${configure-script:location}/${configure-script:filename}
\ No newline at end of file
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
downloadcache-workaround
configure-script
extends =
../../stack/lamp.cfg
../../stack/shacache-client.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://www.freeglobes.net/freeglobes-03.01.2009.zip
md5sum = 80e373c4a23fab7506d6e00a3ec11473
#If provided tarball does not contain top directory, option shall be changed to false
strip-top-level-dir = true
[configure-script]
recipe = hexagonit.recipe.download
location = ${buildout:parts-directory}/${:_buildout_section_name_}
url = ${:_profile_base_location_}/configure-freeglobes.py
md5sum = 30d9bbcd410f35afc58c7b9ad101b1ec
filename = configure-freeglobes.py
download-only = True
mode = 0744
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
[versions]
# Use SlapOS patched zc.buildout
zc.buildout = 1.5.3-dev-SlapOS-010
[downloadcache-workaround]
# workaround irritating problem of hexagonit.recipe.cmmi which automatically
# creates download cache, which in turn switches builout to "semi-offline" mode
recipe = plone.recipe.command
# in hexagonit.recipe.cmmi if there is no ${buildout:download-cache} set it resolves
# to ${buildout:directory}/downloads but this variable is available late, that's
# why it is hardcoded only for required case
download-cache = ${buildout:directory}/downloads
command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
update-command = ${:command}
stop-on-error = True
\ No newline at end of file
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
table_name = shipping_weight
constraint = `id`=2
delete = install.php
\ No newline at end of file
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
downloadcache-workaround
extends =
../../stack/lamp.cfg
../../stack/shacache-client.cfg
[application]
recipe = slapos.recipe.build
url = http://www.chaozz.nl/binaries/freewebshop/FreeWebshop.org2.2.9_R2.zip
md5sum = 9a32bfa3feb47e33c4eb81a9e00271e6
script =
if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[guessPlatform()].split(' ')
extract_dir = self.extract(self.download(self.options['url'], self.options.get('md5sum')))
workdir = guessworkdir(extract_dir)
self.copyTree(workdir, "${buildout:parts-directory}/${:_buildout_section_name_}")
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
[versions]
# Use SlapOS patched zc.buildout
zc.buildout = 1.5.3-dev-SlapOS-010
[downloadcache-workaround]
# workaround irritating problem of hexagonit.recipe.cmmi which automatically
# creates download cache, which in turn switches builout to "semi-offline" mode
recipe = plone.recipe.command
# in hexagonit.recipe.cmmi if there is no ${buildout:download-cache} set it resolves
# to ${buildout:directory}/downloads but this variable is available late, that's
# why it is hardcoded only for required case
download-cache = ${buildout:directory}/downloads
command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
update-command = ${:command}
stop-on-error = True
\ No newline at end of file
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://garr.dl.sourceforge.net/project/frontaccounting/FrontAccounting-2.3/2.3.7/frontaccounting-2.3.7.tgz
md5sum = d16899327dd316becd0d1abe0b19ff3e
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${instance-recipe:egg}
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
file_token = install.lock
delete = install.php
\ No newline at end of file
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
downloadcache-workaround
extends =
../../stack/lamp.cfg
../../stack/shacache-client.cfg
[application]
recipe = slapos.recipe.build
url = http://downloads.sourceforge.net/project/fnews/fnews/3.9.6-p1/fusionnews-3.9.6-p1.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Ffnews%2Ffiles%2F&ts=1320325550&use_mirror=freefr
md5sum = dc4c00be8f4abab11fbab178e016c581
script =
if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[guessPlatform()].split(' ')
extract_dir = self.extract(self.download(self.options['url'], self.options.get('md5sum')))
workdir = guessworkdir(extract_dir)
self.copyTree(workdir + "/upload", "${buildout:parts-directory}/${:_buildout_section_name_}")
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
[versions]
# Use SlapOS patched zc.buildout
zc.buildout = 1.5.3-dev-SlapOS-010
[downloadcache-workaround]
# workaround irritating problem of hexagonit.recipe.cmmi which automatically
# creates download cache, which in turn switches builout to "semi-offline" mode
recipe = plone.recipe.command
# in hexagonit.recipe.cmmi if there is no ${buildout:download-cache} set it resolves
# to ${buildout:directory}/downloads but this variable is available late, that's
# why it is hardcoded only for required case
download-cache = ${buildout:directory}/downloads
command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
update-command = ${:command}
stop-on-error = True
\ No newline at end of file
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
delete = install
table_name = texts
constraint = `tid`>0
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://download.tuxfamily.org/galette/galette-0.7.0.tar.bz2
md5sum = 7aadd2f8c4922f7e168d29d595b75702
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
\ No newline at end of file
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = https://forge.indepnet.net/attachments/download/1151/glpi-0.83.1.tar.gz
md5sum = 3f9cfb11c09c457a0f0a8fa1563b45a7
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${instance-recipe:egg}
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
downloadcache-workaround
extends =
../../stack/lamp.cfg
../../stack/shacache-client.cfg
[application]
recipe = hexagonit.recipe.download
url = http://www.freeguppy.org/file/guppy4619.zip
md5sum = 5d993b0818e195385a775880ce5d4be7
#If provided tarball does not contain top directory, option shall be changed to false
strip-top-level-dir = false
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs = ${instance-recipe:egg}
[versions]
# Use SlapOS patched zc.buildout
zc.buildout = 1.5.3-dev-SlapOS-010
[downloadcache-workaround]
# workaround irritating problem of hexagonit.recipe.cmmi which automatically
# creates download cache, which in turn switches builout to "semi-offline" mode
recipe = plone.recipe.command
# in hexagonit.recipe.cmmi if there is no ${buildout:download-cache} set it resolves
# to ${buildout:directory}/downloads but this variable is available late, that's
# why it is hardcoded only for required case
download-cache = ${buildout:directory}/downloads
command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
update-command = ${:command}
stop-on-error = True
\ No newline at end of file
...@@ -163,6 +163,7 @@ hexagonit.recipe.download = 1.5.1 ...@@ -163,6 +163,7 @@ hexagonit.recipe.download = 1.5.1
[networkcache] [networkcache]
# signature certificates of the following uploaders. # signature certificates of the following uploaders.
# Łukasz Nowak # Łukasz Nowak
# Test Agent
signature-certificate-list = signature-certificate-list =
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJANLesB1hoQIEMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV MIIB9jCCAV+gAwIBAgIJANLesB1hoQIEMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
...@@ -177,3 +178,16 @@ signature-certificate-list = ...@@ -177,3 +178,16 @@ signature-certificate-list =
9LnVeCSkC4Ct8kvkT/WdRFF/nqprbZ6bUrhx2yAKTH6CMhIjDJ8F7fAkH48fLD7M 9LnVeCSkC4Ct8kvkT/WdRFF/nqprbZ6bUrhx2yAKTH6CMhIjDJ8F7fAkH48fLD7M
HPuwnRO7OewFpzT/gfQgFKpmVBNUYq7YddE= HPuwnRO7OewFpzT/gfQgFKpmVBNUYq7YddE=
-----END CERTIFICATE----- -----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAKRvzcy7OH0UMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
BAMMCENPTVAtNzcyMCAXDTEyMDgxMDE1NDI1MVoYDzIxMTIwNzE3MTU0MjUxWjAT
MREwDwYDVQQDDAhDT01QLTc3MjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
o7aipd6MbnuGDeR1UJUjuMLQUariAyQ2l2ZDS6TfOwjHiPw/mhzkielgk73kqN7A
sUREx41eTcYCXzTq3WP3xCLE4LxLg1eIhd4nwNHj8H18xR9aP0AGjo4UFl5BOMa1
mwoyBt3VtfGtUmb8whpeJgHhqrPPxLoON+i6fIbXDaUCAwEAAaNQME4wHQYDVR0O
BBYEFEfjy3OopT2lOksKmKBNHTJE2hFlMB8GA1UdIwQYMBaAFEfjy3OopT2lOksK
mKBNHTJE2hFlMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAaNRx6YN2
M/p3R8/xS6zvH1EqJ3FFD7XeAQ52WuQnKSREzuw0dsw12ClxjcHiQEFioyTiTtjs
5pW18Ry5Ie7iFK4cQMerZwWPxBodEbAteYlRsI6kePV7Gf735Y1RpuN8qZ2sYL6e
x2IMeSwJ82BpdEI5niXxB+iT0HxhmR+XaMI=
-----END CERTIFICATE-----
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
delete = install
table_name = users
constraint = (`user_id`>0) and (`user_password`<>'0000000000000000000000000000000000000000')
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://www.igalerie.org/igalerie-2.1.5.zip
md5sum = de7279fb1dc4cf4318218d35b0776f95
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
[buildout] [buildout]
versions = versions
extends = extends =
../../stack/lamp/buildout.cfg ../../stack/lamp/buildout.cfg
../../stack/shacache-client.cfg
[application] [application]
recipe = slapos.recipe.build:download-unpacked recipe = slapos.recipe.build:download-unpacked
...@@ -16,7 +11,7 @@ strip-top-level-dir = false ...@@ -16,7 +11,7 @@ strip-top-level-dir = false
[application-template] [application-template]
recipe = slapos.recipe.download recipe = slapos.recipe.download
url = ${:_profile_base_location_}/database.xml-in url = ${:_profile_base_location_}/database.xml-in
md5sum = 6ae063318a251b70ae7d037e3ae375d6 md5sum = 6ae063318a251b70ae7d037e3ae375d6
download-only = True download-only = True
filename = template.in filename = template.in
mode = 0644 mode = 0644
...@@ -24,15 +19,3 @@ location = ${buildout:parts-directory}/${:_buildout_section_name_} ...@@ -24,15 +19,3 @@ location = ${buildout:parts-directory}/${:_buildout_section_name_}
[application-configuration] [application-configuration]
location = installation/models/forms/database.xml location = installation/models/forms/database.xml
[downloadcache-workaround]
# workaround irritating problem of hexagonit.recipe.cmmi which automatically
# creates download cache, which in turn switches builout to "semi-offline" mode
recipe = plone.recipe.command
# in hexagonit.recipe.cmmi if there is no ${buildout:download-cache} set it resolves
# to ${buildout:directory}/downloads but this variable is available late, that's
# why it is hardcoded only for required case
download-cache = ${buildout:directory}/downloads
command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
update-command = ${:command}
stop-on-error = True
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://www.kubelabs.com/files/kubeblog%201.1.2.zip
md5sum = 21aa12d766dca6ed632ae1806206c7cf
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${instance-recipe:egg}
\ No newline at end of file
...@@ -18,6 +18,8 @@ parts = ...@@ -18,6 +18,8 @@ parts =
eggs eggs
instance-recipe-egg instance-recipe-egg
find-links += http://www.nexedi.org/static/packages/source/
[instance-recipe] [instance-recipe]
egg = slapos.cookbook egg = slapos.cookbook
module = kumofs module = kumofs
...@@ -41,6 +43,7 @@ mode = 0644 ...@@ -41,6 +43,7 @@ mode = 0644
[networkcache] [networkcache]
# Cedric de Saint Martin signature certificate # Cedric de Saint Martin signature certificate
# Test Agent
signature-certificate-list = signature-certificate-list =
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
...@@ -55,3 +58,80 @@ signature-certificate-list = ...@@ -55,3 +58,80 @@ signature-certificate-list =
Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby
If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY= If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY=
-----END CERTIFICATE----- -----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAKRvzcy7OH0UMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
BAMMCENPTVAtNzcyMCAXDTEyMDgxMDE1NDI1MVoYDzIxMTIwNzE3MTU0MjUxWjAT
MREwDwYDVQQDDAhDT01QLTc3MjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
o7aipd6MbnuGDeR1UJUjuMLQUariAyQ2l2ZDS6TfOwjHiPw/mhzkielgk73kqN7A
sUREx41eTcYCXzTq3WP3xCLE4LxLg1eIhd4nwNHj8H18xR9aP0AGjo4UFl5BOMa1
mwoyBt3VtfGtUmb8whpeJgHhqrPPxLoON+i6fIbXDaUCAwEAAaNQME4wHQYDVR0O
BBYEFEfjy3OopT2lOksKmKBNHTJE2hFlMB8GA1UdIwQYMBaAFEfjy3OopT2lOksK
mKBNHTJE2hFlMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAaNRx6YN2
M/p3R8/xS6zvH1EqJ3FFD7XeAQ52WuQnKSREzuw0dsw12ClxjcHiQEFioyTiTtjs
5pW18Ry5Ie7iFK4cQMerZwWPxBodEbAteYlRsI6kePV7Gf735Y1RpuN8qZ2sYL6e
x2IMeSwJ82BpdEI5niXxB+iT0HxhmR+XaMI=
-----END CERTIFICATE-----
[versions]
Jinja2 = 2.6
Werkzeug = 0.8.3
buildout-versions = 1.7
erp5.recipe.cmmiforcei686 = 0.1.3
hexagonit.recipe.cmmi = 1.6
meld3 = 0.6.10
rdiff-backup = 1.0.5
slapos.cookbook = 0.71.1
slapos.recipe.template = 2.4.2
# Required by:
# slapos.core==0.33.1
Flask = 0.9
# Required by:
# hexagonit.recipe.cmmi==1.6
hexagonit.recipe.download = 1.6
# Required by:
# slapos.cookbook==0.71.1
inotifyx = 0.2.0
# Required by:
# slapos.cookbook==0.71.1
# slapos.core==0.33.1
# xml-marshaller==0.9.7
lxml = 3.1beta1
# Required by:
# slapos.cookbook==0.71.1
netaddr = 0.7.10
# Required by:
# slapos.core==0.33.1
netifaces = 0.8
# Required by:
# slapos.cookbook==0.71.1
pytz = 2012j
# Required by:
# slapos.cookbook==0.71.1
# slapos.core==0.33.1
# zc.buildout==1.6.0-dev-SlapOS-010
# zc.recipe.egg==1.3.2
setuptools = 0.6c12dev-r88846
# Required by:
# slapos.cookbook==0.71.1
slapos.core = 0.33.1
# Required by:
# slapos.core==0.33.1
supervisor = 3.0b1
# Required by:
# slapos.cookbook==0.71.1
xml-marshaller = 0.9.7
# Required by:
# slapos.core==0.33.1
zope.interface = 4.0.3
...@@ -7,6 +7,8 @@ Introduction ...@@ -7,6 +7,8 @@ Introduction
This software release is used to deploy KVM instances, NBD instances and This software release is used to deploy KVM instances, NBD instances and
Frontend instances of KVM. Frontend instances of KVM.
For extensive parameters definition, please look at parameter-input-schema.json.
Examples Examples
-------- --------
......
{
"name": "Input Parameters",
"properties": {
"ram-size": {
"title": "RAM size",
"description": "RAM size, in MB.",
"type": "integer",
"default": 1024,
"minimum": 128,
"divisibleBy": 128,
"maximum": 16384
},
"disk-size": {
"title": "Disk size",
"description": "Disk size, in GB.",
"type": "integer",
"default": 10,
"minimum": 1,
"maximum": 80
},
"disk-type": {
"title": "Disk type",
"description": "Type of QEMU disk drive.",
"type": "string",
"default": "virtio",
"enum": ["ide", "scsi", "sd", "mtd", "floppy", "pflash", "virtio"]
},
"cpu-count": {
"title": "CPU count",
"description": "Number of CPU cores.",
"type": "integer",
"minimum": 1,
"maximum": 8
},
"nbd-host": {
"title": "NBD hostname",
"description": "hostname (or IP) of the NBD server containing the boot image.",
"type": "string",
"format": ["host-name", "ip-address", "ipv6"],
"default": "debian.nbd.vifib.net"
},
"nbd-port": {
"title": "NBD port",
"description": "Port of the NBD server containing the boot image.",
"type": "integer",
"default": 1024,
"minimum": 1,
"maximum": 65535
},
"nbd2-host": {
"title": "Second NBD hostname",
"description": "hostname (or IP) of the second NBD server (containing drivers for example).",
"type": "string",
"format": ["host-name", "ip-address", "ipv6"],
},
"nbd2-port": {
"title": "Second NBD port",
"description": "Port of the second NBD server containing the boot image.",
"type": "integer",
"minimum": 1,
"maximum": 65535
},
"frontend-instance-guid": {
"title": "Frontend Instance ID",
"description": "Unique identifier of the frontend instance, like \"SOFTINST-11031\".",
"type": "string",
"default": "SOFTINST-11031"
},
"frontend-software-type": {
"title": "Frontend Software Type",
"description": "Type of the frontend instance, like \"frontend\".",
"type": "string",
"default": "frontend"
},
"frontend-software-url": {
"title": "Frontend Software URL",
"description": "Software Release URL of the frontend instance, like \"http://example.com/path/to/software.cfg\".",
"type": "string",
"format": "uri",
"default": "http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.92:/software/kvm/software.cfg"
}
}
}
{
"name": "Output Parameters",
"properties": {
"backend-url": {
"title": "Backend URL",
"description": "URL used to connect directly to backend without frontend. Requires IPv6.",
"type": "uri",
"required": true
},
"url": {
"title": "URL",
"description": "URL used to connect to the service.",
"type": "uri",
"required": false
},
"password": {
"title": "Password",
"description": "Password used to authenticate in the service webpage.",
"type": "uri",
"required": true
}
}
}
...@@ -17,46 +17,49 @@ eggs-directory = ${buildout:eggs-directory} ...@@ -17,46 +17,49 @@ eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory} develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true offline = true
[rootdirectory] [directory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc etc = $${buildout:directory}/etc
bin = $${buildout:directory}/bin bin = $${buildout:directory}/bin
srv = $${buildout:directory}/srv srv = $${buildout:directory}/srv
var = $${buildout:directory}/var var = $${buildout:directory}/var
scripts = $${:etc}/run
[basedirectory] services = $${:etc}/service
recipe = slapos.cookbook:mkdirectory promises = $${:etc}/promise
services = $${rootdirectory:etc}/run novnc-conf = $${:etc}/novnc
promises = $${rootdirectory:etc}/promise run = $${:var}/run
novnc-conf = $${rootdirectory:etc}/novnc ca-dir = $${:srv}/ssl
run = $${rootdirectory:var}/run
ca-dir = $${rootdirectory:srv}/ssl
[create-mac] [create-mac]
recipe = slapos.cookbook:generate.mac recipe = slapos.cookbook:generate.mac
storage-path = $${rootdirectory:srv}/mac storage-path = $${directory:srv}/mac
[gen-passwd] [gen-passwd]
recipe = slapos.cookbook:generate.password recipe = slapos.cookbook:generate.password
storage-path = $${rootdirectory:srv}/passwd storage-path = $${directory:srv}/passwd
bytes = 4 bytes = 4
[kvm-instance] [kvm-instance]
# XXX-Cedric: change "KVM" recipe to simple "create wrappers". No need for this
# Specific code
recipe = slapos.cookbook:kvm recipe = slapos.cookbook:kvm
vnc-ip = $${slap-network-information:local-ipv4} vnc-ip = $${slap-network-information:local-ipv4}
vnc-port = 5901 vnc-port = 5901
nbd-ip = $${slap-parameter:nbd_ip} nbd-host = $${slap-parameter:nbd-host}
nbd-port = $${slap-parameter:nbd_port} nbd-port = $${slap-parameter:nbd-port}
nbd2-host = $${slap-parameter:nbd2-host}
nbd2-port = $${slap-parameter:nbd2-port}
tap = $${slap-network-information:network-interface} tap = $${slap-network-information:network-interface}
disk-path = $${rootdirectory:srv}/virtual.qcow2 disk-path = $${directory:srv}/virtual.qcow2
disk-size = 10 disk-size = $${slap-parameter:disk-size}
socket-path = $${rootdirectory:var}/qmp_socket disk-type = $${slap-parameter:disk-type}
pid-path = $${basedirectory:run}/pid_file socket-path = $${directory:var}/qmp_socket
smp-count = 1 pid-path = $${directory:run}/pid_file
ram-size = 1024 smp-count = $${slap-parameter:cpu-count}
ram-size = $${slap-parameter:ram-size}
mac-address = $${create-mac:mac-address} mac-address = $${create-mac:mac-address}
runner-path = $${basedirectory:services}/kvm runner-path = $${directory:services}/kvm
controller-path = $${basedirectory:services}/kvm_controller controller-path = $${directory:scripts}/kvm_controller
shell-path = ${dash:location}/bin/dash shell-path = ${dash:location}/bin/dash
qemu-path = ${kvm:location}/bin/qemu-system-x86_64 qemu-path = ${kvm:location}/bin/qemu-system-x86_64
qemu-img-path = ${kvm:location}/bin/qemu-img qemu-img-path = ${kvm:location}/bin/qemu-img
...@@ -64,7 +67,7 @@ passwd = $${gen-passwd:passwd} ...@@ -64,7 +67,7 @@ passwd = $${gen-passwd:passwd}
[kvm-promise] [kvm-promise]
recipe = slapos.cookbook:check_port_listening recipe = slapos.cookbook:check_port_listening
path = $${basedirectory:promises}/vnc_promise path = $${directory:promises}/vnc_promise
hostname = $${kvm-instance:vnc-ip} hostname = $${kvm-instance:vnc-ip}
port = $${kvm-instance:vnc-port} port = $${kvm-instance:vnc-port}
...@@ -83,15 +86,15 @@ ssl-cert-path = $${ca-novnc:cert-file} ...@@ -83,15 +86,15 @@ ssl-cert-path = $${ca-novnc:cert-file}
[websockify-sighandler] [websockify-sighandler]
recipe = slapos.cookbook:signalwrapper recipe = slapos.cookbook:signalwrapper
wrapper-path = $${basedirectory:services}/websockify wrapper-path = $${directory:services}/websockify
wrapped-path = $${novnc-instance:path} wrapped-path = $${novnc-instance:path}
[certificate-authority] [certificate-authority]
recipe = slapos.cookbook:certificate_authority recipe = slapos.cookbook:certificate_authority
openssl-binary = ${openssl:location}/bin/openssl openssl-binary = ${openssl:location}/bin/openssl
ca-dir = $${basedirectory:ca-dir} ca-dir = $${directory:ca-dir}
requests-directory = $${cadirectory:requests} requests-directory = $${cadirectory:requests}
wrapper = $${basedirectory:services}/certificate_authority wrapper = $${directory:services}/certificate_authority
ca-private = $${cadirectory:private} ca-private = $${cadirectory:private}
ca-certs = $${cadirectory:certs} ca-certs = $${cadirectory:certs}
ca-newcerts = $${cadirectory:newcerts} ca-newcerts = $${cadirectory:newcerts}
...@@ -99,30 +102,30 @@ ca-crl = $${cadirectory:crl} ...@@ -99,30 +102,30 @@ ca-crl = $${cadirectory:crl}
[cadirectory] [cadirectory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
requests = $${basedirectory:ca-dir}/requests/ requests = $${directory:ca-dir}/requests/
private = $${basedirectory:ca-dir}/private/ private = $${directory:ca-dir}/private/
certs = $${basedirectory:ca-dir}/certs/ certs = $${directory:ca-dir}/certs/
newcerts = $${basedirectory:ca-dir}/newcerts/ newcerts = $${directory:ca-dir}/newcerts/
crl = $${basedirectory:ca-dir}/crl/ crl = $${directory:ca-dir}/crl/
[ca-novnc] [ca-novnc]
<= certificate-authority <= certificate-authority
recipe = slapos.cookbook:certificate_authority.request recipe = slapos.cookbook:certificate_authority.request
key-file = $${basedirectory:novnc-conf}/novnc.key key-file = $${directory:novnc-conf}/novnc.key
cert-file = $${basedirectory:novnc-conf}/novnc.crt cert-file = $${directory:novnc-conf}/novnc.crt
executable = $${rootdirectory:bin}/novnc executable = $${directory:bin}/novnc
wrapper = $${rootdirectory:bin}/websockify wrapper = $${directory:bin}/websockify
[novnc-promise] [novnc-promise]
recipe = slapos.cookbook:check_port_listening recipe = slapos.cookbook:check_port_listening
path = $${basedirectory:promises}/novnc_promise path = $${directory:promises}/novnc_promise
hostname = $${novnc-instance:ip} hostname = $${novnc-instance:ip}
port = $${novnc-instance:port} port = $${novnc-instance:port}
[kvm-monitor] [kvm-monitor]
recipe = slapos.cookbook:generic.slapmonitor recipe = slapos.cookbook:generic.slapmonitor
db-path = $${rootdirectory:srv}/slapmonitor_database db-path = $${directory:srv}/slapmonitor_database
[request-slave-frontend] [request-slave-frontend]
...@@ -145,7 +148,7 @@ sla-instance_guid = $${slap-parameter:frontend-instance-guid} ...@@ -145,7 +148,7 @@ sla-instance_guid = $${slap-parameter:frontend-instance-guid}
[publish-kvm-backend-connection-information] [publish-kvm-backend-connection-information]
recipe = slapos.cookbook:publish recipe = slapos.cookbook:publish
backend_url = https://[$${novnc-instance:ip}]:$${novnc-instance:port}/vnc_auto.html?host=[$${novnc-instance:ip}]&port=$${novnc-instance:port}&encrypt=1 backend-url = https://[$${novnc-instance:ip}]:$${novnc-instance:port}/vnc_auto.html?host=[$${novnc-instance:ip}]&port=$${novnc-instance:port}&encrypt=1
password = $${kvm-instance:passwd} password = $${kvm-instance:passwd}
[publish-kvm-frontend-connection-information] [publish-kvm-frontend-connection-information]
...@@ -154,7 +157,7 @@ url = $${request-slave-frontend:connection-url}/vnc_auto.html?host=$${request-sl ...@@ -154,7 +157,7 @@ url = $${request-slave-frontend:connection-url}/vnc_auto.html?host=$${request-sl
[frontend-promise] [frontend-promise]
recipe = slapos.cookbook:check_url_available recipe = slapos.cookbook:check_url_available
path = $${basedirectory:promises}/frontend_promise path = $${directory:promises}/frontend_promise
url = $${publish-kvm-frontend-connection-information:url} url = $${publish-kvm-frontend-connection-information:url}
dash_path = ${dash:location}/bin/dash dash_path = ${dash:location}/bin/dash
curl_path = ${curl:location}/bin/curl curl_path = ${curl:location}/bin/curl
...@@ -164,5 +167,14 @@ curl_path = ${curl:location}/bin/curl ...@@ -164,5 +167,14 @@ curl_path = ${curl:location}/bin/curl
frontend-instance-guid = SOFTINST-11031 frontend-instance-guid = SOFTINST-11031
frontend-software-type = frontend frontend-software-type = frontend
frontend-software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.92:/software/kvm/software.cfg frontend-software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.92:/software/kvm/software.cfg
nbd_port = 1024
nbd_ip = debian.nbd.vifib.net nbd-port = 1024
nbd-host = debian.nbd.vifib.net
nbd2-port = 1024
nbd2-host =
ram-size = 1024
disk-size = 10
disk-type = virtio
cpu-count = 1
\ No newline at end of file
...@@ -3,10 +3,12 @@ ...@@ -3,10 +3,12 @@
# Instanciate kvm+ # Instanciate kvm+
# #
############################# #############################
# Deprecated. Just specify amount of RAM / disk you want in instance parameter.
[buildout] [buildout]
extends = ${template-kvm:output} extends = ${template-kvm:output}
[kvm-instance] [slap-parameter]
disk-size = 20
smp-count = 2
ram-size = 2048 ram-size = 2048
disk-size = 20
\ No newline at end of file
[buildout] [buildout]
extensions =
buildout-versions
extends = extends =
../../component/gzip/buildout.cfg ../../component/curl/buildout.cfg
../../component/dash/buildout.cfg
../../component/dcron/buildout.cfg ../../component/dcron/buildout.cfg
../../component/logrotate/buildout.cfg
../../component/git/buildout.cfg ../../component/git/buildout.cfg
../../component/gnutls/buildout.cfg ../../component/gnutls/buildout.cfg
../../component/gzip/buildout.cfg
../../component/libpng/buildout.cfg ../../component/libpng/buildout.cfg
../../component/libuuid/buildout.cfg ../../component/libuuid/buildout.cfg
../../component/logrotate/buildout.cfg
../../component/lxml-python/buildout.cfg
../../component/noVNC/buildout.cfg ../../component/noVNC/buildout.cfg
../../component/openssl/buildout.cfg ../../component/openssl/buildout.cfg
../../component/dash/buildout.cfg
../../component/lxml-python/buildout.cfg
../../component/curl/buildout.cfg
../../stack/nodejs.cfg ../../stack/nodejs.cfg
../../stack/slapos.cfg
develop = develop =
${:parts-directory}/websockify ${:parts-directory}/websockify
parts = parts =
template template
dash
kvm
eggs eggs
check-local-eggs check-local-eggs
nodejs
http-proxy
proxy-by-url
npm-modules
dcron
logrotate
versions = versions
#XXX-Cedric : Currently, one can only access to KVM using noVNC. #XXX-Cedric : Currently, one can only access to KVM using noVNC.
# Ideally one should be able to access KVM by using either NoVNC or VNC. # Ideally one should be able to access KVM by using either NoVNC or VNC.
# Problem is : no native crypto support in web browsers. So we have to disable ssl # Problem is : no native crypto support in web browsers. So we have to disable ssl
# In qemu builtin vnc server, and make it available only for localhost # In qemu builtin vnc server, and make it available only for localhost
# so that only novnc can listen to it. # so that only novnc can listen to it.
#XXX-Cedric: Check status of https://github.com/kanaka/noVNC/issues/13 to see #XXX-Cedric: Check status of https://github.com/kanaka/noVNC/issues/13 to see
# When qemu has builtin support for websockets in vnc server to get rid of # When qemu has builtin support for websockets in vnc server to get rid of
# Websockify (socket <-> websocket proxy server) when it is ready. # Websockify (socket <-> websocket proxy server) when it is ready.
# May solve previous XXX depending on the implementation. # May solve previous XXX depending on the implementation.
...@@ -129,35 +118,35 @@ command = ...@@ -129,35 +118,35 @@ command =
[template-kvm] [template-kvm]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-kvm.cfg url = ${:_profile_base_location_}/instance-kvm.cfg.in
md5sum = 6aaa9b6ef059a2ed2f022834151086ab md5sum = 5607cb6b6af58694d55b87411880d368
output = ${buildout:directory}/template-kvm.cfg output = ${buildout:directory}/template-kvm.cfg
mode = 0644 mode = 0644
[template-kvmplus] [template-kvmplus]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-kvmplus.cfg url = ${:_profile_base_location_}/instance-kvmplus.cfg.in
md5sum = 301fbe4eaaab5648e1a933a4c853f5b9 md5sum = c8e92237eeda93caca1132b5202c3a02
output = ${buildout:directory}/template-kvmplus.cfg output = ${buildout:directory}/template-kvmplus.cfg
mode = 0644 mode = 0644
[template-nbd] [template-nbd]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-nbd.cfg url = ${:_profile_base_location_}/instance-nbd.cfg.in
md5sum = c030e7be231aba25ee0f51703e60ce67 md5sum = c030e7be231aba25ee0f51703e60ce67
output = ${buildout:directory}/template-nbd.cfg output = ${buildout:directory}/template-nbd.cfg
mode = 0644 mode = 0644
[template-frontend] [template-frontend]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-frontend.cfg url = ${:_profile_base_location_}/instance-frontend.cfg.in
md5sum = 73359b52013b1b65f75005e8698ed180 md5sum = 73359b52013b1b65f75005e8698ed180
output = ${buildout:directory}/template-frontend.cfg output = ${buildout:directory}/template-frontend.cfg
mode = 0644 mode = 0644
[template] [template]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg url = ${:_profile_base_location_}/instance.cfg.in
md5sum = 68788763d23f70f24b9e575871c903a8 md5sum = 68788763d23f70f24b9e575871c903a8
output = ${buildout:directory}/template.cfg output = ${buildout:directory}/template.cfg
mode = 0644 mode = 0644
...@@ -210,50 +199,43 @@ signature-certificate-list = ...@@ -210,50 +199,43 @@ signature-certificate-list =
[versions] [versions]
lxml = 2.3.6
Jinja2 = 2.6 Jinja2 = 2.6
Pygments = 1.5
Werkzeug = 0.8.3 Werkzeug = 0.8.3
apache-libcloud = 0.11.1 apache-libcloud = 0.11.3
async = 0.6.1 async = 0.6.1
buildout-versions = 1.7 buildout-versions = 1.7
docutils = 0.9.1
gitdb = 0.5.4 gitdb = 0.5.4
hexagonit.recipe.cmmi = 1.6 hexagonit.recipe.cmmi = 1.6
ipython = 0.13 meld3 = 0.6.9
lxml = 2.3.5
meld3 = 0.6.8
plone.recipe.command = 1.1 plone.recipe.command = 1.1
pycrypto = 2.6 pycrypto = 2.6
slapos.cookbook = 0.60 slapos.cookbook = 0.70
slapos.recipe.build = 0.10.2 slapos.recipe.build = 0.11.5
slapos.recipe.template = 2.4.1 slapos.recipe.template = 2.4.2
slapos.toolbox = 0.28 slapos.toolbox = 0.31.1
smmap = 0.8.2 smmap = 0.8.2
z3c.recipe.scripts = 1.0.1 z3c.recipe.scripts = 1.0.1
# Required by: # Required by:
# slapos.core==0.27 # slapos.core==0.32.2
# slapos.toolbox==0.28 # slapos.toolbox==0.31.1
Flask = 0.9 Flask = 0.9
# Required by: # Required by:
# slapos.toolbox==0.28 # slapos.toolbox==0.31.1
GitPython = 0.3.2.RC1 GitPython = 0.3.2.RC1
# Required by: # Required by:
# slapos.cookbook==0.60 # slapos.cookbook==0.70
PyXML = 0.8.4 PyXML = 0.8.4
# Required by: # Required by:
# netaddr==0.7.7 # slapos.toolbox==0.31.1
Sphinx = 1.1.3
# Required by:
# slapos.toolbox==0.28
atomize = 0.1.1 atomize = 0.1.1
# Required by: # Required by:
# slapos.toolbox==0.28 # slapos.toolbox==0.31.1
feedparser = 5.1.2 feedparser = 5.1.2
# Required by: # Required by:
...@@ -261,15 +243,15 @@ feedparser = 5.1.2 ...@@ -261,15 +243,15 @@ feedparser = 5.1.2
hexagonit.recipe.download = 1.5.1 hexagonit.recipe.download = 1.5.1
# Required by: # Required by:
# slapos.cookbook==0.60 # slapos.cookbook==0.70
inotifyx = 0.2.0 inotifyx = 0.2.0
# Required by: # Required by:
# slapos.cookbook==0.60 # slapos.cookbook==0.70
netaddr = 0.7.7 netaddr = 0.7.10
# Required by: # Required by:
# slapos.core==0.27 # slapos.core==0.32.2
netifaces = 0.8 netifaces = 0.8
# Required by: # Required by:
...@@ -277,37 +259,41 @@ netifaces = 0.8 ...@@ -277,37 +259,41 @@ netifaces = 0.8
numpy = 1.6.2 numpy = 1.6.2
# Required by: # Required by:
# slapos.toolbox==0.28 # slapos.toolbox==0.31.1
paramiko = 1.7.7.2 paramiko = 1.8.0
# Required by:
# slapos.toolbox==0.31.1
psutil = 0.6.1
# Required by: # Required by:
# slapos.toolbox==0.28 # slapos.cookbook==0.70
psutil = 0.6.0 pytz = 2012f
# Required by: # Required by:
# slapos.cookbook==0.60 # slapos.cookbook==0.70
# slapos.core==0.27 # slapos.core==0.32.2
# slapos.toolbox==0.28 # slapos.toolbox==0.31.1
setuptools = 0.6c12dev-r88846 setuptools = 0.6c12dev-r88846
# Required by: # Required by:
# slapos.cookbook==0.60 # slapos.cookbook==0.70
# slapos.toolbox==0.28 # slapos.toolbox==0.31.1
slapos.core = 0.27 slapos.core = 0.32.2
# Required by: # Required by:
# slapos.core==0.27 # slapos.core==0.32.2
supervisor = 3.0a12 supervisor = 3.0b1
# Required by: # Required by:
# slapos.cookbook==0.60 # slapos.cookbook==0.70
# slapos.toolbox==0.28 # slapos.toolbox==0.31.1
xml-marshaller = 0.9.7 xml-marshaller = 0.9.7
# Required by: # Required by:
# slapos.cookbook==0.60 # slapos.cookbook==0.70
zc.recipe.egg = 1.3.2 zc.recipe.egg = 1.3.2
# Required by: # Required by:
# slapos.core==0.27 # slapos.core==0.32.2
zope.interface = 4.0.1 zope.interface = 4.0.1
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
delete = wizard.php
table_name = blogs
constraint = `id`>0
\ No newline at end of file
*** lifetype/install/dbschemas.properties.php 2006-12-25 14:30:00.000000000 +0000
--- lifetype_formysql5/install/dbschemas.properties.php 2012-04-04 16:36:54.000000000 +0000
***************
*** 2,9 ****
$Tables["articles"]["schema"] = "
id I(10) UNSIGNED NOTNULL AUTOINCREMENT PRIMARY,
! date T(14) NOTNULL,
! modification_date T(14) NOTNULL,
user_id I(10) UNSIGNED NOTNULL DEFAULT '0',
blog_id I(10) UNSIGNED NOTNULL DEFAULT '0',
status I(5) NOTNULL DEFAULT 1,
--- 2,9 ----
$Tables["articles"]["schema"] = "
id I(10) UNSIGNED NOTNULL AUTOINCREMENT PRIMARY,
! date T(6) NOTNULL,
! modification_date T(6) NOTNULL,
user_id I(10) UNSIGNED NOTNULL DEFAULT '0',
blog_id I(10) UNSIGNED NOTNULL DEFAULT '0',
status I(5) NOTNULL DEFAULT 1,
***************
*** 30,36 ****
name C(255) NOTNULL DEFAULT '',
url C(255) NOTNULL DEFAULT '',
blog_id I(10) UNSIGNED NOTNULL DEFAULT '0',
! last_modification T(14) NOTNULL,
in_main_page I1(1) NOTNULL DEFAULT '1',
parent_id I(10) NOTNULL DEFAULT '0',
description TEXT NOTNULL DEFAULT '',
--- 30,36 ----
name C(255) NOTNULL DEFAULT '',
url C(255) NOTNULL DEFAULT '',
blog_id I(10) UNSIGNED NOTNULL DEFAULT '0',
! last_modification T(6) NOTNULL,
in_main_page I1(1) NOTNULL DEFAULT '1',
parent_id I(10) NOTNULL DEFAULT '0',
description TEXT NOTNULL DEFAULT '',
***************
*** 51,57 ****
blog_id I(10) UNSIGNED NOTNULL DEFAULT 0,
topic TEXT NOTNULL,
text X,
! date T(14) NOTNULL,
user_id I(10) DEFAULT '0',
user_email C(255) DEFAULT '',
user_url C(255) DEFAULT '',
--- 51,57 ----
blog_id I(10) UNSIGNED NOTNULL DEFAULT 0,
topic TEXT NOTNULL,
text X,
! date T(6) NOTNULL,
user_id I(10) DEFAULT '0',
user_email C(255) DEFAULT '',
user_url C(255) DEFAULT '',
***************
*** 96,103 ****
mangled_blog varchar(50) NOTNULL DEFAULT '',
status I(4) NOTNULL DEFAULT '1',
show_in_summary I(4) NOTNULL DEFAULT '1',
! create_date T(14) NOTNULL,
! last_update_date T(14) NOTNULL,
num_posts I(10) NOTNULL DEFAULT '0',
num_comments I(10) NOTNULL DEFAULT '0',
num_trackbacks I(10) NOTNULL DEFAULT '0',
--- 96,103 ----
mangled_blog varchar(50) NOTNULL DEFAULT '',
status I(4) NOTNULL DEFAULT '1',
show_in_summary I(4) NOTNULL DEFAULT '1',
! create_date T(6) NOTNULL,
! last_update_date T(6) NOTNULL,
num_posts I(10) NOTNULL DEFAULT '0',
num_comments I(10) NOTNULL DEFAULT '0',
num_trackbacks I(10) NOTNULL DEFAULT '0',
***************
*** 118,124 ****
description TEXT NOTNULL,
blog_id I(10) UNSIGNED NOTNULL DEFAULT '0',
rss_feed C(255) NOTNULL DEFAULT '',
! date T(14) NOTNULL,
properties TEXT NOTNULL DEFAULT '',
INDEX blog_id (blog_id),
INDEX category_id (category_id)
--- 118,124 ----
description TEXT NOTNULL,
blog_id I(10) UNSIGNED NOTNULL DEFAULT '0',
rss_feed C(255) NOTNULL DEFAULT '',
! date T(6) NOTNULL,
properties TEXT NOTNULL DEFAULT '',
INDEX blog_id (blog_id),
INDEX category_id (category_id)
***************
*** 129,135 ****
id I(10) NOTNULL AUTOINCREMENT PRIMARY,
name varchar(100) NOTNULL DEFAULT '',
blog_id I(10) NOTNULL DEFAULT '0',
! last_modification T(14) NOTNULL,
properties TEXT NOTNULL DEFAULT '',
num_links I(10) NOTNULL DEFAULT '0',
INDEX blog_id (blog_id)
--- 129,135 ----
id I(10) NOTNULL AUTOINCREMENT PRIMARY,
name varchar(100) NOTNULL DEFAULT '',
blog_id I(10) NOTNULL DEFAULT '0',
! last_modification T(6) NOTNULL,
properties TEXT NOTNULL DEFAULT '',
num_links I(10) NOTNULL DEFAULT '0',
INDEX blog_id (blog_id)
***************
*** 151,157 ****
article_id I(10) NOTNULL DEFAULT '0',
blog_id I(10) NOTNULL DEFAULT '0',
hits I(10) DEFAULT '1',
! last_date T(14),
INDEX article_id (article_id),
INDEX blog_id_article_id (blog_id, article_id)
";
--- 151,157 ----
article_id I(10) NOTNULL DEFAULT '0',
blog_id I(10) NOTNULL DEFAULT '0',
hits I(10) DEFAULT '1',
! last_date T(6),
INDEX article_id (article_id),
INDEX blog_id_article_id (blog_id, article_id)
";
***************
*** 168,174 ****
status I(4) NOTNULL DEFAULT 1,
resource_picture_id I(10) NOTNULL DEFAULT 0,
site_admin I(10) NOTNULL DEFAULT '0',
! last_login T(14),
UNIQUE user (user)
";
$Tables["users"]["options"] = "TYPE=MyISAM";
--- 168,174 ----
status I(4) NOTNULL DEFAULT 1,
resource_picture_id I(10) NOTNULL DEFAULT 0,
site_admin I(10) NOTNULL DEFAULT '0',
! last_login T(6),
UNIQUE user (user)
";
$Tables["users"]["options"] = "TYPE=MyISAM";
***************
*** 208,214 ****
reg_exp X,
blog_id I(10) NOTNULL DEFAULT '0',
reason X,
! date T(14) NOTNULL,
INDEX blog_id (blog_id)
";
$Tables["filtered_content"]["options"] = "TYPE=MyISAM";
--- 208,214 ----
reg_exp X,
blog_id I(10) NOTNULL DEFAULT '0',
reason X,
! date T(6) NOTNULL,
INDEX blog_id (blog_id)
";
$Tables["filtered_content"]["options"] = "TYPE=MyISAM";
***************
*** 216,222 ****
$Tables["host_blocking_rules"]["schema"] = "
id I(10) NOTNULL AUTOINCREMENT PRIMARY,
reason X,
! date T(14) NOTNULL,
blog_id I(10) NOTNULL DEFAULT '0',
block_type I(1) DEFAULT '1',
list_type I(1) DEFAULT '1',
--- 216,222 ----
$Tables["host_blocking_rules"]["schema"] = "
id I(10) NOTNULL AUTOINCREMENT PRIMARY,
reason X,
! date T(6) NOTNULL,
blog_id I(10) NOTNULL DEFAULT '0',
block_type I(1) DEFAULT '1',
list_type I(1) DEFAULT '1',
***************
*** 232,238 ****
owner_id I(10) NOTNULL DEFAULT '0',
album_id I(10) NOTNULL DEFAULT '0',
description X,
! date T(14) NOTNULL,
flags I(10) DEFAULT '0',
resource_type I(3) DEFAULT NULL,
file_path C(255) DEFAULT '',
--- 232,238 ----
owner_id I(10) NOTNULL DEFAULT '0',
album_id I(10) NOTNULL DEFAULT '0',
description X,
! date T(6) NOTNULL,
flags I(10) DEFAULT '0',
resource_type I(3) DEFAULT NULL,
file_path C(255) DEFAULT '',
***************
*** 257,263 ****
name C(255) NOTNULL DEFAULT '',
flags I(10) NOTNULL DEFAULT '0',
parent_id I(10) NOTNULL DEFAULT '0',
! date T(14) NOTNULL,
properties TEXT NOTNULL DEFAULT '',
show_album I1(1) DEFAULT 1,
normalized_description TEXT NOTNULL DEFAULT '',
--- 257,263 ----
name C(255) NOTNULL DEFAULT '',
flags I(10) NOTNULL DEFAULT '0',
parent_id I(10) NOTNULL DEFAULT '0',
! date T(6) NOTNULL,
properties TEXT NOTNULL DEFAULT '',
show_album I1(1) DEFAULT 1,
normalized_description TEXT NOTNULL DEFAULT '',
***************
*** 308,314 ****
field_type I(2) NOTNULL DEFAULT '1',
field_values TEXT NOTNULL DEFAULT '',
blog_id I(10) NOTNULL DEFAULT '0',
! date T(14),
searchable I1(1) DEFAULT 1,
hidden I1(1) DEFAULT 1,
INDEX blog_id (blog_id)
--- 308,314 ----
field_type I(2) NOTNULL DEFAULT '1',
field_values TEXT NOTNULL DEFAULT '',
blog_id I(10) NOTNULL DEFAULT '0',
! date T(6),
searchable I1(1) DEFAULT 1,
hidden I1(1) DEFAULT 1,
INDEX blog_id (blog_id)
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
lifetype-patch
patch
extends =
../../stack/lamp.cfg
[lifetype-patch]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/lifetype_for_mysql5.patch
md5sum = c52bea61ea452b9f3caa82426a5819e5
location = ${buildout:parts-directory}/${:_buildout_section_name_}
filename = lifetype_for_mysql5.patch
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://garr.dl.sourceforge.net/project/lifetype/lifetype/lifetype-1.2.11/lifetype-1.2.11.tar.bz2
md5sum = 50e329dfdb6c5876c0600abe30a379fb
strip-top-level-dir = true
[patch]
recipe = iw.recipe.cmd
on_install = true
on_update = true
cmds= patch -d ${application:location} -p1 < ${lifetype-patch:location}/${lifetype-patch:filename}
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
# Exactly the same as software.cfg, but fetch the slapos.cookbook and
# slapos.toolbox from git repository instead of fetching stable version,
# allowing to play with bleeding edge environment.
# You'll need to run buildout twice for this profile.
[buildout]
extends =
../../component/git/buildout.cfg
software.cfg
parts +=
# Development parts
slapos.cookbook-repository
slapos.core-repository
slapos.toolbox-repository
slapos.recipe.maarch-repository
check-recipe
develop =
${:parts-directory}/slapos.cookbook-repository
${:parts-directory}/slapos.core-repository
${:parts-directory}/slapos.toolbox-repository
${:parts-directory}/slapos.recipe.maarch-repository
[slapos.toolbox-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.toolbox.git
branch = master
git-executable = ${git:location}/bin/git
[slapos.cookbook-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.git
branch = lapp-resilient3
git-executable = ${git:location}/bin/git
[slapos.core-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.core.git
branch = master
git-executable = ${git:location}/bin/git
[slapos.recipe.maarch-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.recipe.maarch.git
branch = master
git-executable = ${git:location}/bin/git
[check-recipe]
recipe = plone.recipe.command
stop-on-error = true
update-command = ${:command}
command =
grep parts ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link &&
grep parts ${buildout:develop-eggs-directory}/slapos.core.egg-link &&
grep parts ${buildout:develop-eggs-directory}/slapos.toolbox.egg-link &&
grep parts ${buildout:develop-eggs-directory}/slapos.recipe.maarch.egg-link
# Unpin versions, in case they have been pinned in software.cfg
[versions]
slapos.cookbook =
slapos.toolbox =
slapos.core =
slapos.recipe.maarch =
[buildout]
[maarch-configuration]
recipe = slapos.recipe.maarch:default
htdocs = $${apache-php:htdocs}
db_host = $${postgres-urlparse:host}
db_port = $${postgres-urlparse:port}
db_dbname = $${postgres-urlparse:path}
db_username = $${postgres-urlparse:username}
db_password = $${postgres-urlparse:password}
language = en
php_ini = $${directory:php-ini-dir}/php.ini
root_docservers = $${buildout:directory}/srv/docservers
dependency = $${apache-php:recipe}
[buildout]
extends =
../../component/git/buildout.cfg
../../stack/lapp/buildout.cfg
develop =
${:parts-directory}/slapos.cookbook-repository
${:parts-directory}/slapos.recipe.maarch-repository
# += since we need rdiff-backup and friends
parts +=
slapos-cookbook
apache-php-postgres
pear-modules
eggs
instance
instance-apache-php
slapos.cookbook-repository
slapos.recipe.maarch-repository
check-recipe
[versions]
slapos.cookbook =
slapos.recipe.maarch =
[slapos.recipe.maarch-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.recipe.maarch.git
branch = master
git-executable = ${git:location}/bin/git
[slapos.cookbook-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.git
branch = lapp-resilient3
git-executable = ${git:location}/bin/git
[check-recipe]
recipe = plone.recipe.command
stop-on-error = true
update-command = ${:command}
command =
grep parts ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link &&
grep parts ${buildout:develop-eggs-directory}/slapos.recipe.maarch.egg-link
#----------------
#--
#-- Main application part
#-- XXX provide a better URL
[application]
url = http://downloads.sourceforge.net/project/maarch/Maarch%20Entreprise/MaarchEntreprise-1.3.zip?r=http%3A%2F%2Fwww.maarch.org%2Ftelecharger&ts=1347961624&use_mirror=ignum
md5sum = 5c2c859dee9d0dde3ba959474fd5fc86
#----------------
#--
#-- Define parts that will be executed later, in the instance.
#--
[custom-application-deployment]
path = ${custom-application-deployment-template:output}
part-list = maarch-configuration
[custom-application-deployment-template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-custom.cfg.in
output = ${buildout:directory}/instance-custom.cfg
md5sum = 22d8e4d8bb1a5b1c42c6cfb42ee490a0
mode = 0644
#----------------
#--
#-- Install PHP channels and modules (only if they are not already installed).
#--
[pear-modules]
recipe = cp.recipe.cmd
pear = ${apache-php-postgres:location}/bin/pear
install_cmd =
${:pear} channel-info pear.maarch.org >/dev/null || ${:pear} channel-discover pear.maarch.org
${:pear} info maarch/CLITools-0.3.1 >/dev/null || ${:pear} install maarch/CLITools-0.3.1
${:pear} info MIME_Type >/dev/null || ${:pear} install MIME_Type
#----------------
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
file_token = config_inc.php
delete = admin
\ No newline at end of file
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
downloadcache-workaround
extends =
../../stack/lamp.cfg
../../stack/shacache-client.cfg
[application]
recipe = hexagonit.recipe.download
url = http://downloads.sourceforge.net/project/mantisbt/mantis-stable/1.2.10/mantisbt-1.2.10.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmantisbt%2F&ts=1334735181&use_mirror=freefr
md5sum = f653408a24f76723929567cba606861c
#If provided tarball does not contain top directory, option shall be changed to false
strip-top-level-dir = true
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
[versions]
# Use SlapOS patched zc.buildout
zc.buildout = 1.5.3-dev-SlapOS-010
[downloadcache-workaround]
# workaround irritating problem of hexagonit.recipe.cmmi which automatically
# creates download cache, which in turn switches builout to "semi-offline" mode
recipe = plone.recipe.command
# in hexagonit.recipe.cmmi if there is no ${buildout:download-cache} set it resolves
# to ${buildout:directory}/downloads but this variable is available late, that's
# why it is hardcoded only for required case
download-cache = ${buildout:directory}/downloads
command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
update-command = ${:command}
stop-on-error = True
\ No newline at end of file
...@@ -66,3 +66,20 @@ url = ${:_profile_base_location_}/instance-recover.cfg ...@@ -66,3 +66,20 @@ url = ${:_profile_base_location_}/instance-recover.cfg
md5sum = a8df936b6abf82d0d798b83ddfebdc8a md5sum = a8df936b6abf82d0d798b83ddfebdc8a
output = ${buildout:directory}/template-recover.cfg output = ${buildout:directory}/template-recover.cfg
mode = 0644 mode = 0644
[networkcache]
# Test agent
signature-certificate-list =
-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAKRvzcy7OH0UMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
BAMMCENPTVAtNzcyMCAXDTEyMDgxMDE1NDI1MVoYDzIxMTIwNzE3MTU0MjUxWjAT
MREwDwYDVQQDDAhDT01QLTc3MjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
o7aipd6MbnuGDeR1UJUjuMLQUariAyQ2l2ZDS6TfOwjHiPw/mhzkielgk73kqN7A
sUREx41eTcYCXzTq3WP3xCLE4LxLg1eIhd4nwNHj8H18xR9aP0AGjo4UFl5BOMa1
mwoyBt3VtfGtUmb8whpeJgHhqrPPxLoON+i6fIbXDaUCAwEAAaNQME4wHQYDVR0O
BBYEFEfjy3OopT2lOksKmKBNHTJE2hFlMB8GA1UdIwQYMBaAFEfjy3OopT2lOksK
mKBNHTJE2hFlMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAaNRx6YN2
M/p3R8/xS6zvH1EqJ3FFD7XeAQ52WuQnKSREzuw0dsw12ClxjcHiQEFioyTiTtjs
5pW18Ry5Ie7iFK4cQMerZwWPxBodEbAteYlRsI6kePV7Gf735Y1RpuN8qZ2sYL6e
x2IMeSwJ82BpdEI5niXxB+iT0HxhmR+XaMI=
-----END CERTIFICATE-----
\ No newline at end of file
...@@ -86,6 +86,7 @@ zope.interface = 3.8.0 ...@@ -86,6 +86,7 @@ zope.interface = 3.8.0
[networkcache] [networkcache]
# Cedric de Saint Martin signature certificate # Cedric de Saint Martin signature certificate
# Test Agent
signature-certificate-list = signature-certificate-list =
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
...@@ -100,3 +101,16 @@ signature-certificate-list = ...@@ -100,3 +101,16 @@ signature-certificate-list =
Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby
If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY= If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY=
-----END CERTIFICATE----- -----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAKRvzcy7OH0UMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
BAMMCENPTVAtNzcyMCAXDTEyMDgxMDE1NDI1MVoYDzIxMTIwNzE3MTU0MjUxWjAT
MREwDwYDVQQDDAhDT01QLTc3MjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
o7aipd6MbnuGDeR1UJUjuMLQUariAyQ2l2ZDS6TfOwjHiPw/mhzkielgk73kqN7A
sUREx41eTcYCXzTq3WP3xCLE4LxLg1eIhd4nwNHj8H18xR9aP0AGjo4UFl5BOMa1
mwoyBt3VtfGtUmb8whpeJgHhqrPPxLoON+i6fIbXDaUCAwEAAaNQME4wHQYDVR0O
BBYEFEfjy3OopT2lOksKmKBNHTJE2hFlMB8GA1UdIwQYMBaAFEfjy3OopT2lOksK
mKBNHTJE2hFlMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAaNRx6YN2
M/p3R8/xS6zvH1EqJ3FFD7XeAQ52WuQnKSREzuw0dsw12ClxjcHiQEFioyTiTtjs
5pW18Ry5Ie7iFK4cQMerZwWPxBodEbAteYlRsI6kePV7Gf735Y1RpuN8qZ2sYL6e
x2IMeSwJ82BpdEI5niXxB+iT0HxhmR+XaMI=
-----END CERTIFICATE-----
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
template = ${application-template:location}/${application-template:filename}
configuration = ${application-configuration:location}
httpd_binary = ${apache:location}/bin/httpd
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
[buildout]
extends =
../../component/postgresql/buildout.cfg
../../component/apache-perl/buildout.cfg
../../stack/slapos.cfg
[networkcache]
# Cedric de Saint Martin signature certificate
# Test agent
signature-certificate-list =
-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
BAMMCENPTVAtMjMyMCAXDTEyMDIxNjExMTAyM1oYDzIxMTIwMTIzMTExMDIzWjAT
MREwDwYDVQQDDAhDT01QLTIzMjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
wi/3Z8W9pUiegUXIk/AiFDQ0UJ4JFAwjqr+HSRUirlUsHHT+8DzH/hfcTDX1I5BB
D1ADk+ydXjMm3OZrQcXjn29OUfM5C+g+oqeMnYQImN0DDQIOcUyr7AJc4xhvuXQ1
P2pJ5NOd3tbd0kexETa1LVhR6EgBC25LyRBRae76qosCAwEAAaNQME4wHQYDVR0O
BBYEFMDmW9aFy1sKTfCpcRkYnP6zUd1cMB8GA1UdIwQYMBaAFMDmW9aFy1sKTfCp
cRkYnP6zUd1cMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAskbFizHr
b6d3iIyN+wffxz/V9epbKIZVEGJd/6LrTdLiUfJPec7FaxVCWNyKBlCpINBM7cEV
Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby
If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAKRvzcy7OH0UMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
BAMMCENPTVAtNzcyMCAXDTEyMDgxMDE1NDI1MVoYDzIxMTIwNzE3MTU0MjUxWjAT
MREwDwYDVQQDDAhDT01QLTc3MjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
o7aipd6MbnuGDeR1UJUjuMLQUariAyQ2l2ZDS6TfOwjHiPw/mhzkielgk73kqN7A
sUREx41eTcYCXzTq3WP3xCLE4LxLg1eIhd4nwNHj8H18xR9aP0AGjo4UFl5BOMa1
mwoyBt3VtfGtUmb8whpeJgHhqrPPxLoON+i6fIbXDaUCAwEAAaNQME4wHQYDVR0O
BBYEFEfjy3OopT2lOksKmKBNHTJE2hFlMB8GA1UdIwQYMBaAFEfjy3OopT2lOksK
mKBNHTJE2hFlMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAaNRx6YN2
M/p3R8/xS6zvH1EqJ3FFD7XeAQ52WuQnKSREzuw0dsw12ClxjcHiQEFioyTiTtjs
5pW18Ry5Ie7iFK4cQMerZwWPxBodEbAteYlRsI6kePV7Gf735Y1RpuN8qZ2sYL6e
x2IMeSwJ82BpdEI5niXxB+iT0HxhmR+XaMI=
-----END CERTIFICATE-----
\ No newline at end of file
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://freefr.dl.sourceforge.net/project/moodle/Moodle/stable22/moodle-2.2.tgz
md5sum = abf0cb8c0c4c482e9881173d1e501bb3
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs = ${instance-recipe:egg}
\ No newline at end of file
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
file_token = install.log
delete = setup
\ No newline at end of file
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
downloadcache-workaround
extends =
../../stack/lamp.cfg
../../stack/shacache-client.cfg
[application]
recipe = hexagonit.recipe.download
url = http://downloads.sourceforge.net/project/moregroupware/moregroupware/0.7.4/moregroupware-core-0.7.4.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fmoregroupware%2F&ts=1319116756&use_mirror=sunet
md5sum = b30523ab7dd2bf5003cb897be07201b7
#If provided tarball does not contain top directory, option shall be changed to false
strip-top-level-dir = true
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
[versions]
# Use SlapOS patched zc.buildout
zc.buildout = 1.5.3-dev-SlapOS-010
[downloadcache-workaround]
# workaround irritating problem of hexagonit.recipe.cmmi which automatically
# creates download cache, which in turn switches builout to "semi-offline" mode
recipe = plone.recipe.command
# in hexagonit.recipe.cmmi if there is no ${buildout:download-cache} set it resolves
# to ${buildout:directory}/downloads but this variable is available late, that's
# why it is hardcoded only for required case
download-cache = ${buildout:directory}/downloads
command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
update-command = ${:command}
stop-on-error = True
\ No newline at end of file
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
delete = install
table_name = user
constraint = `id`>0
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://freefr.dl.sourceforge.net/project/mybloggie/mybloggie/myBloggie%202.1.4/mybloggie214.zip
md5sum = 0159c00829d2b20f32ce661d996870bb
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
...@@ -108,6 +108,7 @@ zope.interface = 3.8.0 ...@@ -108,6 +108,7 @@ zope.interface = 3.8.0
[networkcache] [networkcache]
# Cedric de Saint Martin signature certificate # Cedric de Saint Martin signature certificate
# Test agent
signature-certificate-list = signature-certificate-list =
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
...@@ -122,3 +123,16 @@ signature-certificate-list = ...@@ -122,3 +123,16 @@ signature-certificate-list =
Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby
If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY= If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY=
-----END CERTIFICATE----- -----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAKRvzcy7OH0UMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
BAMMCENPTVAtNzcyMCAXDTEyMDgxMDE1NDI1MVoYDzIxMTIwNzE3MTU0MjUxWjAT
MREwDwYDVQQDDAhDT01QLTc3MjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
o7aipd6MbnuGDeR1UJUjuMLQUariAyQ2l2ZDS6TfOwjHiPw/mhzkielgk73kqN7A
sUREx41eTcYCXzTq3WP3xCLE4LxLg1eIhd4nwNHj8H18xR9aP0AGjo4UFl5BOMa1
mwoyBt3VtfGtUmb8whpeJgHhqrPPxLoON+i6fIbXDaUCAwEAAaNQME4wHQYDVR0O
BBYEFEfjy3OopT2lOksKmKBNHTJE2hFlMB8GA1UdIwQYMBaAFEfjy3OopT2lOksK
mKBNHTJE2hFlMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAaNRx6YN2
M/p3R8/xS6zvH1EqJ3FFD7XeAQ52WuQnKSREzuw0dsw12ClxjcHiQEFioyTiTtjs
5pW18Ry5Ie7iFK4cQMerZwWPxBodEbAteYlRsI6kePV7Gf735Y1RpuN8qZ2sYL6e
x2IMeSwJ82BpdEI5niXxB+iT0HxhmR+XaMI=
-----END CERTIFICATE-----
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
delete = setup.php
table_name = lists
constraint = `id`>0
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://mytinytodo.googlecode.com/files/mytinytodo-v1.4.2.zip
md5sum = 562bcd9f04079f8ca16f767e029d22bd
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
delete = install.php
table_name = user
constraint = `userid`>0
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://www.phpevolution.net/download/ne/ne-3-0-2.tar.gz
md5sum = 5f1477669eb94df4094badbf3f0e4aa1
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
\ No newline at end of file
# -*- coding: utf-8 -*-
import sys
import os
def setup(args):
mysql_port, mysql_host, mysql_user, mysql_password, mysql_database, base_url, htdocs = args
config_php = os.path.join(htdocs, "config.php")
install_php = os.path.join(htdocs, "install.php")
install_sql = os.path.join(htdocs, "install.sql")
os.chmod(config_php, 0444)
os.remove(install_php)
os.remove(install_sql)
if __name__ == '__main__':
setup(sys.argv[1:])
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
#delete = install.sql, install.php
#chmod = config.php
#mode = 0444
table_name = member
constraint = `mnumber`=1
script = ${configure-script:location}/${configure-script:filename}
\ No newline at end of file
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
downloadcache-workaround
configure-script
extends =
../../stack/lamp.cfg
../../stack/shacache-client.cfg
[application]
recipe = hexagonit.recipe.download
url = http://downloads.sourceforge.net/project/nucleuscms/1.%20Nucleus%20Core/Nucleus%20v3.64/nucleus3.64.zip?r=&ts=1319307841&use_mirror=freefr
md5sum = f38d23cba814e6aa05e5d82ea43cb3fd
#If provided tarball does not contain top directory, option shall be changed to false
strip-top-level-dir = true
[configure-script]
recipe = hexagonit.recipe.download
location = ${buildout:parts-directory}/${:_buildout_section_name_}
url = ${:_profile_base_location_}/configure-nucleus.py
md5sum = c052f761180a6ee55af1e531e4c38b4b
filename = configure-nucleus.py
download-only = True
mode = 0744
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
[versions]
# Use SlapOS patched zc.buildout
zc.buildout = 1.5.3-dev-SlapOS-010
[downloadcache-workaround]
# workaround irritating problem of hexagonit.recipe.cmmi which automatically
# creates download cache, which in turn switches builout to "semi-offline" mode
recipe = plone.recipe.command
# in hexagonit.recipe.cmmi if there is no ${buildout:download-cache} set it resolves
# to ${buildout:directory}/downloads but this variable is available late, that's
# why it is hardcoded only for required case
download-cache = ${buildout:directory}/downloads
command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
update-command = ${:command}
stop-on-error = True
\ No newline at end of file
# -*- coding: utf-8 -*-
import sys
import os
def setup(args):
'''
Freeglobes doesn't put the good url of the application
this script ensure the url is the good one
'''
mysql_port, mysql_host, mysql_user, mysql_password, mysql_database, base_url, htdocs = args
htpasswd_file = os.path.join(htdocs, "sites/default/.htpasswd")
document_htaccess = os.path.join(htdocs, "sites/default/documents/.htaccess")
edi_htaccess = os.path.join(htdocs, "sites/default/edi/.htaccess")
era_htaccess = os.path.join(htdocs, "sites/default/era/.htaccess")
f1 = open(htpasswd_file, 'w+')
f1.write("admin:OA9zt069mtqn6") #admin/admin
f1.close()
os.chmod(htpasswd_file, 0644)
htaccess_content = "AuthUserFile %ssites/default/.htpasswd\nAuthName “OpenEMR Protected Page”\nAuthType Basic\nRequire valid-user" % htdocs
for f in [document_htaccess, edi_htaccess, era_htaccess]:
file = open(f, 'w+')
file.write(htaccess_content)
file.close()
os.chmod(f, 0644)
if __name__ == '__main__':
setup(sys.argv[1:])
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
downloadcache-workaround
configure-script
extends =
../../stack/lamp.cfg
../../stack/shacache-client.cfg
[application]
recipe = hexagonit.recipe.download
url = http://downloads.sourceforge.net/project/openemr/OpenEMR%20Current/4.1.0/openemr-4.1.0.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fopenemr%2F&ts=1319625464&use_mirror=freefr
md5sum = 4311688c25e991825584ad529b553396
#If provided tarball does not contain top directory, option shall be changed to false
strip-top-level-dir = true
[configure-script]
recipe = hexagonit.recipe.download
location = ${buildout:parts-directory}/${:_buildout_section_name_}
url = ${:_profile_base_location_}/configure-openemr.py
md5sum = cfb305e0fd2b996f8bfe4302dd6b6288
filename = configure-openemr.py
download-only = True
mode = 0744
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
[versions]
# Use SlapOS patched zc.buildout
zc.buildout = 1.5.3-dev-SlapOS-010
[downloadcache-workaround]
# workaround irritating problem of hexagonit.recipe.cmmi which automatically
# creates download cache, which in turn switches builout to "semi-offline" mode
recipe = plone.recipe.command
# in hexagonit.recipe.cmmi if there is no ${buildout:download-cache} set it resolves
# to ${buildout:directory}/downloads but this variable is available late, that's
# why it is hardcoded only for required case
download-cache = ${buildout:directory}/downloads
command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
update-command = ${:command}
stop-on-error = True
\ No newline at end of file
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
delete = install
table_name = utilisateur
constraint = `id`>0
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://www.ouapi.org/downloads/current_version.zip
md5sum = adc5d29910450fbd75427cd720e3291c
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
\ No newline at end of file
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://c702355.r55.cf3.rackcdn.com/releases/owncloud-3.0.0.tar.bz2
md5sum = 0a48bf2b1ac10c11c4b7f6fd1de9a5d9
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${instance-recipe:egg}
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
delete = install
table_name = admin
constraint = (`admin_login`='admin' AND `admin_passwd`<>'21232f297a57a5a743894a0e4a801fc3') OR (`admin_id`>1)
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://www.phenix.gapi.fr/download/phenix_501.zip
md5sum = 0538d2146f2cb01b24ae692928d8e92e
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
template = ${application-template:location}/${application-template:filename}
configuration = ${application-configuration:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
delete = install, modules/api/install, modules/bms/install, modules/mailchimp/install, modules/recurringinvoices/install, module/sample/install
table_name = modules
constraint = `id`>=5
diff -crB phpbms/install/createtables.sql phpbms_timestamp/install/createtables.sql
*** phpbms/install/createtables.sql 2009-12-31 20:36:45.000000000 +0000
--- phpbms_timestamp/install/createtables.sql 2011-11-03 12:47:29.000000000 +0000
***************
*** 36,42 ****
createdby int(11) NOT NULL default '0',
modifiedby int(11) default '0',
creationdate datetime NOT NULL default '0000-00-00 00:00:00',
! modifieddate timestamp(14) NOT NULL,
`roleid` VARCHAR(64),
PRIMARY KEY (id),
UNIQUE KEY (`uuid`)
--- 36,42 ----
createdby int(11) NOT NULL default '0',
modifiedby int(11) default '0',
creationdate datetime NOT NULL default '0000-00-00 00:00:00',
! modifieddate timestamp NOT NULL,
`roleid` VARCHAR(64),
PRIMARY KEY (id),
UNIQUE KEY (`uuid`)
***************
*** 116,122 ****
createdby int(11) NOT NULL default '0',
creationdate datetime NOT NULL default '0000-00-00 00:00:00',
modifiedby int(11) default '0',
! modifieddate timestamp(14) NOT NULL,
inherint tinyint(1) NOT NULL default '0',
PRIMARY KEY (id),
UNIQUE KEY (`uuid`),
--- 116,122 ----
createdby int(11) NOT NULL default '0',
creationdate datetime NOT NULL default '0000-00-00 00:00:00',
modifiedby int(11) default '0',
! modifieddate timestamp NOT NULL,
inherint tinyint(1) NOT NULL default '0',
PRIMARY KEY (id),
UNIQUE KEY (`uuid`),
***************
*** 267,273 ****
createdby int(11) NOT NULL default '0',
modifiedby int(11) default '0',
lastlogin datetime default NULL,
! modifieddate timestamp(14) NOT NULL,
email varchar(128) default '',
phone varchar(32) default '',
department varchar(128) default '',
--- 267,273 ----
createdby int(11) NOT NULL default '0',
modifiedby int(11) default '0',
lastlogin datetime default NULL,
! modifieddate timestamp NOT NULL,
email varchar(128) default '',
phone varchar(32) default '',
department varchar(128) default '',
***************
*** 318,324 ****
`createdby` int(11) default '0',
`creationdate` datetime default '0000-00-00 00:00:00',
`modifiedby` int(11) default '0',
! `modifieddate` timestamp(14) NOT NULL,
`roleid` VARCHAR(64),
`custom1` DOUBLE,
`custom2` DOUBLE,
--- 318,324 ----
`createdby` int(11) default '0',
`creationdate` datetime default '0000-00-00 00:00:00',
`modifiedby` int(11) default '0',
! `modifieddate` timestamp NOT NULL,
`roleid` VARCHAR(64),
`custom1` DOUBLE,
`custom2` DOUBLE,
***************
*** 340,346 ****
`createdby` int(11) default '0',
`creationdate` datetime default '0000-00-00 00:00:00',
`modifiedby` int(11) default '0',
! `modifieddate` timestamp(14) NOT NULL,
PRIMARY KEY (`id`),
KEY `therecord` (`recordid`),
KEY `thetable` (`tabledefid`),
--- 340,346 ----
`createdby` int(11) default '0',
`creationdate` datetime default '0000-00-00 00:00:00',
`modifiedby` int(11) default '0',
! `modifieddate` timestamp NOT NULL,
PRIMARY KEY (`id`),
KEY `therecord` (`recordid`),
KEY `thetable` (`tabledefid`),
diff -crB phpbms/modules/bms/install/createtables.sql phpbms_timestamp/modules/bms/install/createtables.sql
*** phpbms/modules/bms/install/createtables.sql 2010-01-06 00:06:44.000000000 +0000
--- phpbms_timestamp/modules/bms/install/createtables.sql 2011-11-03 17:26:20.000000000 +0000
***************
*** 66,72 ****
description text,
createdby int(11) default NULL,
modifiedby int(11) default NULL,
! modifieddate timestamp(14) NOT NULL,
creationdate datetime default NULL,
`custom1` DOUBLE,
`custom2` DOUBLE,
--- 66,72 ----
description text,
createdby int(11) default NULL,
modifiedby int(11) default NULL,
! modifieddate timestamp NOT NULL,
creationdate datetime default NULL,
`custom1` DOUBLE,
`custom2` DOUBLE,
***************
*** 171,177 ****
createdby int(11) NOT NULL default '0',
creationdate datetime NOT NULL default '0000-00-00 00:00:00',
modifiedby int(11) default NULL,
! modifieddate timestamp(14) NOT NULL,
`custom1` DOUBLE,
`custom2` DOUBLE,
`custom3` DATETIME,
--- 171,177 ----
createdby int(11) NOT NULL default '0',
creationdate datetime NOT NULL default '0000-00-00 00:00:00',
modifiedby int(11) default NULL,
! modifieddate timestamp NOT NULL,
`custom1` DOUBLE,
`custom2` DOUBLE,
`custom3` DATETIME,
***************
*** 216,222 ****
`createdby` int(11) NOT NULL default 0,
`creationdate` datetime NOT NULL default '0000-00-00 00:00:00',
`modifiedby` int(11) default NULL,
! `modifieddate` timestamp(14) NOT NULL,
`custom1` DOUBLE,
`custom2` DOUBLE,
`custom3` DATETIME,
--- 216,222 ----
`createdby` int(11) NOT NULL default 0,
`creationdate` datetime NOT NULL default '0000-00-00 00:00:00',
`modifiedby` int(11) default NULL,
! `modifieddate` timestamp NOT NULL,
`custom1` DOUBLE,
`custom2` DOUBLE,
`custom3` DATETIME,
***************
*** 240,246 ****
isprepackaged tinyint(4) NOT NULL default '0',
packagesperitem double default NULL,
modifiedby int(11) default NULL,
! modifieddate timestamp(14) NOT NULL,
partname varchar(128) default NULL,
partnumber varchar(32) NOT NULL default '',
status varchar(32) NOT NULL default 'In Stock',
--- 240,246 ----
isprepackaged tinyint(4) NOT NULL default '0',
packagesperitem double default NULL,
modifiedby int(11) default NULL,
! modifieddate timestamp NOT NULL,
partname varchar(128) default NULL,
partnumber varchar(32) NOT NULL default '',
status varchar(32) NOT NULL default 'In Stock',
***************
*** 283,289 ****
createdby int(11) NOT NULL default '0',
creationdate datetime NOT NULL default '0000-00-00 00:00:00',
modifiedby int(11) default NULL,
! modifieddate timestamp(14) NOT NULL,
`custom1` DOUBLE,
`custom2` DOUBLE,
`custom3` DATETIME,
--- 283,289 ----
createdby int(11) NOT NULL default '0',
creationdate datetime NOT NULL default '0000-00-00 00:00:00',
modifiedby int(11) default NULL,
! modifieddate timestamp NOT NULL,
`custom1` DOUBLE,
`custom2` DOUBLE,
`custom3` DATETIME,
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
phpbms-patch
patch
extends =
../../stack/lamp.cfg
[phpbms-patch]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/phpbms_for_mysql5.patch
md5sum = ddf323ac00e9e486cea8b8cc4277e065
location = ${buildout:parts-directory}/${:_buildout_section_name_}
filename = phpbms_for_mysql5.patch
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://www.phpbms.org/files/phpbms/phpbms-0.98.tar.gz
md5sum = 3907c5115cf9acaab7cb5d22ce0534b7
[patch]
recipe = iw.recipe.cmd
on_install = true
on_update = true
cmds= patch -d ${application:location} -p1 < ${phpbms-patch:location}/${phpbms-patch:filename}
[application-template]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/template/settings.php.in
filename = template.in
mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[application-configuration]
location = settings.php
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
\ No newline at end of file
<?php [
mysql_server = "%(mysql_host)s"
mysql_database = "%(mysql_database)s"
mysql_user = "%(mysql_user)s"
mysql_userpass = "%(mysql_password)s"
mysql_pconnect = "true"
end] ?>
# -*- coding: utf-8 -*-
import sys
import os
import MySQLdb
def setup(args):
renamed, mysql_host, mysql_user, mysql_password, mysql_database, base_url, htdocs = args
#base_url, htdocs, renamed, mysql_user, mysql_password, mysql_database, mysql_host = args
sql_file = os.path.join(htdocs, "scripts/phpfin.sql")
try:
conn = MySQLdb.connect (host = mysql_host,
user = mysql_user,
passwd = mysql_password,
db = mysql_database)
cursor = conn.cursor ()
with open(sql_file, 'r') as f:
sql_script = f.read()
cursor.execute(sql_script)
conn.close()
except:
return
if __name__ == '__main__':
setup(sys.argv[1:])
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
template = ${application-template:location}/${application-template:filename}
configuration = ${application-configuration:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
table_name = **
constraint = 1
script = ${configure-script:location}/${configure-script:filename}
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
configure-script
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://garr.dl.sourceforge.net/project/phpfin/phpfin/phpfinV1.00%20Free/phpfinfree1_0.zip
md5sum = 06f5ef5205c492e38ecbb6159f5417e4
[configure-script]
recipe = hexagonit.recipe.download
location = ${buildout:parts-directory}/${:_buildout_section_name_}
url = ${:_profile_base_location_}/configure-phpfin.py
filename = configure-phpfin.py
download-only = True
[application-template]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/template/connection.inc.in
#md5sum = Student may put here md5sum of this file, this is good idea
download-only = True
filename = template.in
mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[application-configuration]
location = connection.inc
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
\ No newline at end of file
<?php
$databaseinfo = mysql_connect("%(mysql_host)s", "%(mysql_user)s", "%(mysql_password)s") or die ("Could not connect to server");
mysql_select_db("%(mysql_database)s");
//Make sure that superglobals are loaded for PHP5 compatibility
include('superglobals.inc.php');
?>
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
template = ${application-template:location}/${application-template:filename}
configuration = ${application-configuration:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
delete = install.php
table_name = users
constraint = `uid`>0
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://flomoto.free.fr/phpip/phpip_11-05-11.tar.gz
md5sum = 94fe615f61fbb5ef0fcbf60a44ac5093
[application-template]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/template/database.php.in
#md5sum = Student may put here md5sum of this file, this is good idea
download-only = True
filename = template.in
mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[application-configuration]
location = includes/database.php
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
<?php
/*
+-------------------------------------------------------------------------+
| Copyright (C) 2006 Michael Earls |
| |
| 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 2 |
| 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. |
+-------------------------------------------------------------------------+
| - phpIP - http://www.phpip.net/ |
+-------------------------------------------------------------------------+
*/
// Create database connection and select database
mysql_select_db('%(mysql_database)s', mysql_pconnect('%(mysql_host)s','%(mysql_user)s','%(mysql_password)s')) or die (mysql_error());
?>
...@@ -22,7 +22,7 @@ mode = 0644 ...@@ -22,7 +22,7 @@ mode = 0644
[application] [application]
recipe = slapos.recipe.build:download-unpacked recipe = slapos.recipe.build:download-unpacked
url = http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.3.10/phpMyAdmin-3.3.10-all-languages.tar.bz2?r=http%3A%2F%2Fwww.phpmyadmin.net%2Fhome_page%2Fdownloads.php&ts=1300959842&use_mirror=sunet url = http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.3.10/phpMyAdmin-3.3.10-all-languages.tar.bz2
md5sum = cb7a632fb4f10a180ead15f7f90087f1 md5sum = cb7a632fb4f10a180ead15f7f90087f1
[application-template] [application-template]
......
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
\ No newline at end of file
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
downloadcache-workaround
extends =
../../stack/lamp.cfg
../../stack/shacache-client.cfg
[application]
recipe = slapos.recipe.build
url = http://downloads.sourceforge.net/project/phpmybackup/phpMyBackupPro/phpMyBackupPro%202.2/phpMyBackupPro-2.2.zip?r=&ts=1319486570&use_mirror=freefr
md5sum = 577d9189195f358017e5910f3699b88e
script =
if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[guessPlatform()].split(' ')
extract_dir = self.extract(self.download(self.options['url'], self.options.get('md5sum')))
workdir = guessworkdir(extract_dir)
self.copyTree(workdir + "/phpMyBackupPro", "${buildout:parts-directory}/${:_buildout_section_name_}")
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs = ${instance-recipe:egg}
[versions]
# Use SlapOS patched zc.buildout
zc.buildout = 1.5.3-dev-SlapOS-010
[downloadcache-workaround]
# workaround irritating problem of hexagonit.recipe.cmmi which automatically
# creates download cache, which in turn switches builout to "semi-offline" mode
recipe = plone.recipe.command
# in hexagonit.recipe.cmmi if there is no ${buildout:download-cache} set it resolves
# to ${buildout:directory}/downloads but this variable is available late, that's
# why it is hardcoded only for required case
download-cache = ${buildout:directory}/downloads
command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
update-command = ${:command}
stop-on-error = True
\ No newline at end of file
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
delete = install/update.php
table_name = faquserlogin
constraint = `login`='anonymous'
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://www.phpmyfaq.de/download/phpmyfaq-2.7.0.zip
md5sum = 2a19da49afe32c92f207339ff66d673a
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
...@@ -16,7 +16,7 @@ extends = ...@@ -16,7 +16,7 @@ extends =
[application] [application]
recipe = slapos.recipe.build:download-unpacked recipe = slapos.recipe.build:download-unpacked
url = http://phpnuke.org/modules/Release/files/phpnuke-release-8.2.4.tar.gz url = http://phpnuke.org/modules/Release/files/phpnuke-release-8.2.4.tar.gz
md5sum = 0f31895b141f50a5f2e6f083b0222fe2 md5sum = d448586c651c811a137280b435c4e05c
extract-directory = html extract-directory = html
[application-template] [application-template]
......
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
downloadcache-workaround
extends =
../../stack/lamp.cfg
../../stack/shacache-client.cfg
[application]
recipe = slapos.recipe.build
url = http://downloads.sourceforge.net/project/phprojekt/PHProjekt%206.0/6.0.6/phprojekt-6.0.6.zip?r=http%3A%2F%2Fwww.google.fr%2Furl%3Fsa%3Dt%26rct%3Dj%26q%3Ddownload%2520phprojekt%26source%3Dweb%26cd%3D4%26ved%3D0CD4QFjAD%26url%3Dhttp%253A%252F%252Fsourceforge.net%252Fprojects%252Fphprojekt%252Ffiles%252Flatest%252Fdownload%26ei%3DeWuyToW3HMWEOqubkYQC%26usg%3DAFQjCNG0ZO1Bp-VS5t4X2pI9QKAmlovXpg&ts=1320315780&use_mirror=freefr
md5sum = d139b3d9b791a39460e9a780dece7779
script =
if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[guessPlatform()].split(' ')
extract_dir = self.extract(self.download(self.options['url'], self.options.get('md5sum')))
workdir = guessworkdir(extract_dir)
self.copyTree(workdir, "${buildout:parts-directory}/${:_buildout_section_name_}")
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs = ${instance-recipe:egg}
[versions]
# Use SlapOS patched zc.buildout
zc.buildout = 1.5.3-dev-SlapOS-010
[downloadcache-workaround]
# workaround irritating problem of hexagonit.recipe.cmmi which automatically
# creates download cache, which in turn switches builout to "semi-offline" mode
recipe = plone.recipe.command
# in hexagonit.recipe.cmmi if there is no ${buildout:download-cache} set it resolves
# to ${buildout:directory}/downloads but this variable is available late, that's
# why it is hardcoded only for required case
download-cache = ${buildout:directory}/downloads
command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
update-command = ${:command}
stop-on-error = True
\ No newline at end of file
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
*** pixelpost1.7.3/includes/create_tables.php 2012-04-07 11:57:49.000000000 +0000
--- pixelpost_for_mysql5/includes/create_tables.php 2012-04-07 12:01:30.000000000 +0000
***************
*** 123,129 ****
// Make future upgrade scripts easier by adding a version table
mysql_query("CREATE TABLE IF NOT EXISTS `{$prefix}version` (
`id` INT(10) unsigned NOT NULL auto_increment,
! `upgrade_date` TIMESTAMP(14) NOT NULL,
`version` FLOAT NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `version` (`version`))")or die("MySQL Error: ". mysql_error());
--- 123,129 ----
// Make future upgrade scripts easier by adding a version table
mysql_query("CREATE TABLE IF NOT EXISTS `{$prefix}version` (
`id` INT(10) unsigned NOT NULL auto_increment,
! `upgrade_date` TIMESTAMP NOT NULL,
`version` FLOAT NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `version` (`version`))")or die("MySQL Error: ". mysql_error());
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
pixelpost-patch
patch
extends =
../../stack/lamp.cfg
[pixelpost-patch]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/pixelpost_for_mysql5.patch
md5sum = 100883ebbe4973883a710996b91f5d23
location = ${buildout:parts-directory}/${:_buildout_section_name_}
filename = pixelpost_for_mysql5.patch
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://www.pixelpost.org/releases/pixelpost_v1.7.3.zip
md5sum = 457f50312ca6dc682065ce3dbfda1a4f
[patch]
recipe = iw.recipe.cmd
on_install = true
on_update = true
cmds= patch -d ${application:location} -p1 < ${pixelpost-patch:location}/${pixelpost-patch:filename}
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs = ${instance-recipe:egg}
[buildout]
parts =
symlinks
publish
postgres-instance
postgres-promise
# Define egg directories to be the one from Software Release
# (/opt/slapgrid/...)
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[directories]
recipe = slapos.cookbook:mkdirectory
bin = $${buildout:directory}/bin
etc = $${buildout:directory}/etc
services = $${directories:etc}/service
promises = $${directories:etc}/promise
var = $${buildout:directory}/var
#----------------
#--
#-- Creates a Postgres cluster, configuration files, and a database.
[postgres-instance]
recipe = slapos.cookbook:postgres
# Options
ipv6 = $${instance-parameters:ipv6}
ipv4 = $${instance-parameters:ipv4}
ipv6_random = $${instance-parameters:ipv6_random}
superuser = postgres
port = 5432
dbname = db
# pgdata_directory is created by initdb, and should not exist beforehand.
pgdata-directory = $${directories:var}/data
bin = $${directories:bin}
services = $${directories:services}
#----------------
#--
#-- Creates symlinks from the instance to the software release.
[symlinks]
recipe = cns.recipe.symlink
symlink_target = $${directories:bin}
symlink_base = ${postgresql:location}/bin
#----------------
#--
#-- Deploy promise scripts.
[postgres-promise]
recipe = slapos.cookbook:check_port_listening
path = $${directories:promises}/postgres
hostname = $${instance-parameters:ipv6_random}
port = $${postgres-instance:port}
#----------------
#--
#-- Publish instance parameters.
[publish]
recipe = slapos.cookbook:publish
url = $${postgres-instance:url}
#----------------
#--
#-- Fetches parameters defined in SlapOS Master for this instance
[instance-parameters]
recipe = slapos.cookbook:slapconfiguration
computer = $${slap-connection:computer-id}
partition = $${slap-connection:partition-id}
url = $${slap-connection:server-url}
key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file}
[buildout]
extends =
../../stack/slapos.cfg
../../component/postgresql/buildout.cfg
parts =
eggs
slapos-cookbook
instance
postgresql92
#----------------
#-- Instance-level buildout profiles.
[instance]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg.in
output = ${buildout:directory}/instance.cfg
md5sum = f2f335b7b0d915d38fa76eaacff56158
mode = 0644
[eggs]
recipe = zc.recipe.egg
eggs =
cns.recipe.symlink
[versions]
Jinja2 = 2.6
Werkzeug = 0.8.3
buildout-versions = 1.7
cns.recipe.symlink = 0.2.3
hexagonit.recipe.cmmi = 1.6
inotifyx = 0.2.0
lxml = 3.1beta1
meld3 = 0.6.10
netaddr = 0.7.10
pytz = 2012j
slapos.recipe.template = 2.4.2
xml-marshaller = 0.9.7
# Required by:
# slapos.core==0.33.1
Flask = 0.9
# Required by:
# hexagonit.recipe.cmmi==1.6
hexagonit.recipe.download = 1.6
# Required by:
# slapos.core==0.33.1
netifaces = 0.8
# Required by:
# cns.recipe.symlink==0.2.3
# supervisor==3.0b1
# zc.buildout==1.6.0-dev-SlapOS-010
# zope.interface==4.0.3
setuptools = 0.6c12dev-r88846
# Required by:
# slapos.core==0.33.1
supervisor = 3.0b1
# Required by:
# slapos.core==0.33.1
zope.interface = 4.0.3
...@@ -16,7 +16,7 @@ extends = ...@@ -16,7 +16,7 @@ extends =
[application] [application]
recipe = slapos.recipe.build:download-unpacked recipe = slapos.recipe.build:download-unpacked
url = http://www.prestashop.com/download/prestashop_1.4.5.1.zip url = http://www.prestashop.com/download/prestashop_1.4.5.1.zip
md5sum = 3d19305d728f7e8a19f81f9f326b9383 md5sum = 6c0dcd301abe992a19dea1737d0adbe9
[instance-recipe] [instance-recipe]
egg = slapos.cookbook egg = slapos.cookbook
......
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
delete = install
table_name = pmsusers
constraint = `user_id`>0
\ No newline at end of file
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://www.projelead.com/downloads/Package%20installation/ProjeLead2_0.zip
md5sum = ec06dfa8f016ecc60a59e4c4a36efd94
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
\ No newline at end of file
...@@ -16,7 +16,7 @@ extends = ...@@ -16,7 +16,7 @@ extends =
[application] [application]
recipe = slapos.recipe.build:download-unpacked recipe = slapos.recipe.build:download-unpacked
url = http://punbb.informer.com/download/punbb-1.3.6.tar.gz url = http://punbb.informer.com/download/punbb-1.3.6.tar.gz
md5sum = 9454ef78101028fd5acf2731f77545c2 md5sum = 7bb3f570cb6a61f8c3e3e25e750fd29d
[application-template] [application-template]
recipe = slapos.recipe.download recipe = slapos.recipe.download
......
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
downloadcache-workaround
extends =
../../stack/lamp.cfg
../../stack/shacache-client.cfg
[application]
recipe = hexagonit.recipe.download
url = http://opensolution.org/download,en,18.html?sFile=Quick.Cart/Quick.Cart_v5.1.zip
md5sum = c710d772b9b253c9cbba78dc4d619865
#If provided tarball does not contain top directory, option shall be changed to false
strip-top-level-dir = false
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs = ${instance-recipe:egg}
[versions]
# Use SlapOS patched zc.buildout
zc.buildout = 1.5.3-dev-SlapOS-010
[downloadcache-workaround]
# workaround irritating problem of hexagonit.recipe.cmmi which automatically
# creates download cache, which in turn switches builout to "semi-offline" mode
recipe = plone.recipe.command
# in hexagonit.recipe.cmmi if there is no ${buildout:download-cache} set it resolves
# to ${buildout:directory}/downloads but this variable is available late, that's
# why it is hardcoded only for required case
download-cache = ${buildout:directory}/downloads
command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
update-command = ${:command}
stop-on-error = True
\ No newline at end of file
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
downloadcache-workaround
extends =
../../stack/lamp.cfg
../../stack/shacache-client.cfg
[application]
recipe = hexagonit.recipe.download
url = http://opensolution.org/download,en,18.html?sFile=Quick.Cms/Quick.Cms_v4.1.zip
md5sum = b21ad5aaf0a367a0e7edf19f714e893a
#If provided tarball does not contain top directory, option shall be changed to false
strip-top-level-dir = false
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs = ${instance-recipe:egg}
[versions]
# Use SlapOS patched zc.buildout
zc.buildout = 1.5.3-dev-SlapOS-010
[downloadcache-workaround]
# workaround irritating problem of hexagonit.recipe.cmmi which automatically
# creates download cache, which in turn switches builout to "semi-offline" mode
recipe = plone.recipe.command
# in hexagonit.recipe.cmmi if there is no ${buildout:download-cache} set it resolves
# to ${buildout:directory}/downloads but this variable is available late, that's
# why it is hardcoded only for required case
download-cache = ${buildout:directory}/downloads
command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
update-command = ${:command}
stop-on-error = True
\ No newline at end of file
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
delete = install.php
table_name = Member
constraint = `ID`>0
...@@ -11,12 +11,11 @@ parts = ...@@ -11,12 +11,11 @@ parts =
extends = extends =
../../stack/lamp.cfg ../../stack/lamp.cfg
../../stack/shacache-client.cfg
[application] [application]
recipe = slapos.recipe.build:download-unpacked recipe = slapos.recipe.build:download-unpacked
url = http://www.silverstripe.org/assets/downloads/SilverStripe-v2.4.5.tar.gz url = http://www.silverstripe.org/assets/downloads/SilverStripe-v2.4.6.tar.gz
md5sum = de6ab0146c27bbc72287670e0697e2ba md5sum = 6490d9fe5b72911ba5bda314cfc2d9dc
[instance-recipe] [instance-recipe]
egg = slapos.cookbook egg = slapos.cookbook
...@@ -32,89 +31,16 @@ mode = 0644 ...@@ -32,89 +31,16 @@ mode = 0644
[instance-recipe-egg] [instance-recipe-egg]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = ${instance-recipe:egg} python = python2.7
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
[versions] [versions]
# Use SlapOS patched zc.buildout # Use SlapOS patched zc.buildout
zc.buildout = 1.5.3-dev-SlapOS-010 zc.buildout = 1.5.3-dev-SlapOS-010
slapos.cookbook = 0.32
Jinja2 = 2.6
MySQL-python = 1.2.3
Werkzeug = 0.8.1
apache-libcloud = 0.5.2
buildout-versions = 1.7
hexagonit.recipe.cmmi = 1.5.0
meld3 = 0.6.7
plone.recipe.command = 1.1
slapos.cookbook = 0.34
slapos.recipe.build = 0.7
slapos.recipe.download = 1.0.dev-r4053
slapos.recipe.template = 2.2
slapos.toolbox = 0.10
# Required by:
# slapos.core==0.18
# slapos.toolbox==0.10
Flask = 0.8
# Required by:
# slapos.cookbook==0.34
PyXML = 0.8.4
# Required by:
# hexagonit.recipe.cmmi==1.5.0
hexagonit.recipe.download = 1.5.1
# Required by:
# slapos.cookbook==0.34
# slapos.core==0.18
# slapos.toolbox==0.10
# xml-marshaller==0.9.7
lxml = 2.3.1
# Required by:
# slapos.cookbook==0.34
netaddr = 0.7.6
# Required by:
# slapos.core==0.18
netifaces = 0.5
# Required by:
# slapos.toolbox==0.10
paramiko = 1.7.7.1
# Required by:
# slapos.toolbox==0.10
psutil = 0.3.0
# Required by:
# slapos.cookbook==0.34
# slapos.core==0.18
# slapos.toolbox==0.10
setuptools = 0.6c12dev-r88846
# Required by:
# slapos.cookbook==0.34
# slapos.toolbox==0.10
slapos.core = 0.18
# Required by:
# slapos.core==0.18
supervisor = 3.0a10
# Required by:
# slapos.cookbook==0.34
# slapos.toolbox==0.10
xml-marshaller = 0.9.7
# Required by:
# slapos.cookbook==0.34
zc.recipe.egg = 1.3.2
# Required by:
# slapos.core==0.18
zope.interface = 3.8.0
[downloadcache-workaround] [downloadcache-workaround]
# workaround irritating problem of hexagonit.recipe.cmmi which automatically # workaround irritating problem of hexagonit.recipe.cmmi which automatically
...@@ -127,4 +53,3 @@ download-cache = ${buildout:directory}/downloads ...@@ -127,4 +53,3 @@ download-cache = ${buildout:directory}/downloads
command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0 command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
update-command = ${:command} update-command = ${:command}
stop-on-error = True stop-on-error = True
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
\ No newline at end of file
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
downloadcache-workaround
extends =
../../stack/lamp.cfg
[application]
recipe = hexagonit.recipe.download
url = http://bigprof.com/appgini/sites/default/files/invoicing.zip
md5sum = b3fbc5c818e22363582f954bc04aa046
#If provided tarball does not contain top directory, option shall be changed to false
strip-top-level-dir = true
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs = ${instance-recipe:egg}
[versions]
# Use SlapOS patched zc.buildout
zc.buildout = 1.5.3-dev-SlapOS-010
[downloadcache-workaround]
# workaround irritating problem of hexagonit.recipe.cmmi which automatically
# creates download cache, which in turn switches builout to "semi-offline" mode
recipe = plone.recipe.command
# in hexagonit.recipe.cmmi if there is no ${buildout:download-cache} set it resolves
# to ${buildout:directory}/downloads but this variable is available late, that's
# why it is hardcoded only for required case
download-cache = ${buildout:directory}/downloads
command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
update-command = ${:command}
stop-on-error = True
\ No newline at end of file
[buildout] [buildout]
parts = parts =
slapos-test-runner slapos-test-runner
sh-environment
eggs-directory = ${buildout:eggs-directory} eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory} develop-eggs-directory = ${buildout:develop-eggs-directory}
...@@ -47,5 +48,18 @@ environment = environment ...@@ -47,5 +48,18 @@ environment = environment
[environment] [environment]
CPPFLAGS = -I${python2.7:location}/include/python2.7 -I${libxml2:location}/include -I${libxslt:location}/include CPPFLAGS = -I${python2.7:location}/include/python2.7 -I${libxml2:location}/include -I${libxslt:location}/include
LDFLAGS = -L${python2.7:location}/lib -L${libxml2:location}/lib -L${libxslt:location}/lib -L${zlib:location}/lib LDFLAGS = -L${python2.7:location}/lib -L${libxml2:location}/lib -L${libxslt:location}/lib -L${libxslt:location}/lib -L${zlib:location}/lib -Wl,-rpath=${zlib:location}/lib -Wl,-rpath=${python2.7:location}/lib -Wl,-rpath=${libxml2:location}/lib -Wl,-rpath=${libxslt:location}/lib -Wl,-rpath=${zlib:location}/lib
PYTHONPATH = ${python-setuptools:location} PYTHONPATH = ${python-setuptools:location}
[sh-environment]
# Section exposes testing default environment as sh file. It is thus easy
# to directly develop and test the egg inside of this instance.
recipe = collective.recipe.template
input = inline:
export PATH="$${slapos-test-runner:prepend-path}:$PATH"
export CPPFLAGS="$${environment:CPPFLAGS}"
export LDFLAGS="$${environment:LDFLAGS}"
export PYTHONPATH="$${environment:PYTHONPATH}"
export PS1="[slapos-testing env Active] $PS1"
output = $${create-directory:bin}/environment.sh
mode = 755
...@@ -24,24 +24,18 @@ eggs = ...@@ -24,24 +24,18 @@ eggs =
${lxml-python:egg} ${lxml-python:egg}
erp5.util erp5.util
slapos.cookbook slapos.cookbook
collective.recipe.template
entry-points = entry-points =
runTestSuite=erp5.util.testsuite:runTestSuite runTestSuite=erp5.util.testsuite:runTestSuite
scripts = scripts =
runTestSuite runTestSuite
[erp5.util-repository]
recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git
forbid-download-cache = true
repository = http://git.erp5.org/repos/erp5.git
branch = master
[slapos.cookbook-repository] [slapos.cookbook-repository]
recipe = slapos.recipe.build:gitclone recipe = slapos.recipe.build:gitclone
git-executable = ${git:location}/bin/git git-executable = ${git:location}/bin/git
forbid-download-cache = true forbid-download-cache = true
repository = http://git.erp5.org/repos/slapos.git repository = http://git.erp5.org/repos/slapos.git
branch = slapos-testing branch = master
[slapos.core-repository] [slapos.core-repository]
recipe = slapos.recipe.build:gitclone recipe = slapos.recipe.build:gitclone
...@@ -67,7 +61,7 @@ branch = master ...@@ -67,7 +61,7 @@ branch = master
[template] [template]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg url = ${:_profile_base_location_}/instance.cfg
md5sum = d7dbd5da07c1170d0b80199d99f932eb md5sum = 47f5a8cf4d134a35b7f36a7442e5798a
output = ${buildout:directory}/template.cfg output = ${buildout:directory}/template.cfg
mode = 640 mode = 640
...@@ -77,7 +71,7 @@ Werkzeug = 0.8.3 ...@@ -77,7 +71,7 @@ Werkzeug = 0.8.3
buildout-versions = 1.7 buildout-versions = 1.7
erp5.util = 0.4.7 erp5.util = 0.4.7
hexagonit.recipe.cmmi = 1.6 hexagonit.recipe.cmmi = 1.6
lxml = 3.0alpha2 lxml = 2.3.6
meld3 = 0.6.8 meld3 = 0.6.8
plone.recipe.command = 1.1 plone.recipe.command = 1.1
slapos.cookbook = 0.65 slapos.cookbook = 0.65
......
[buildout]
extends =
../../component/cloud9/buildout.cfg
../../component/dash/buildout.cfg
../../component/dropbear/buildout.cfg
../../component/git/buildout.cfg
../../component/lxml-python/buildout.cfg
../../stack/flask.cfg
../../stack/shacache-client.cfg
../../stack/slapos.cfg
parts =
template
slapos-cookbook
eggs
[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
output = ${buildout:directory}/template.cfg
mode = 0644
md5sum = 5307e4200f044ae57b504ad68444491c
[template-runner]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-runner.cfg
output = ${buildout:directory}/template-runner.cfg
md5sum = 91d6550c43b7a43a999724af4650ae40
mode = 0644
[eggs]
recipe = z3c.recipe.scripts
eggs =
${lxml-python:egg}
slapos.libnetworkcache
slapos.toolbox[flask_auth]
slapos.core
cns.recipe.symlink
# Development profile of slaprunner.
# Exactly the same as software.cfg, but fetch the slapos.cookbook and
# slapos.toolbox from git repository instead of fetching stable version,
# allowing to play with bleeding edge environment.
# You'll need to run buildout twice for this profile.
[buildout]
extends = common.cfg
parts +=
slapos.cookbook-repository
slapos.core-repository
slapos.toolbox-repository
check-recipe
develop =
${:parts-directory}/slapos.cookbook-repository
${:parts-directory}/slapos.core-repository
${:parts-directory}/slapos.toolbox-repository
[slapos.toolbox-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.toolbox.git
branch = slaprunner
git-executable = ${git:location}/bin/git
[slapos.cookbook-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.git
branch = slaprunner
git-executable = ${git:location}/bin/git
[slapos.core-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.core.git
branch = master
git-executable = ${git:location}/bin/git
[check-recipe]
recipe = plone.recipe.command
stop-on-error = true
update-command = ${:command}
command =
grep parts ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link &&
grep parts ${buildout:develop-eggs-directory}/slapos.core.egg-link &&
grep parts ${buildout:develop-eggs-directory}/slapos.toolbox.egg-link
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
parts = parts =
cloud9 cloud9
slaprunner slaprunner
test-runner
sshkeys-dropbear sshkeys-dropbear
dropbear-server-add-authorized-key dropbear-server-add-authorized-key
sshkeys-authority sshkeys-authority
...@@ -10,46 +11,48 @@ parts = ...@@ -10,46 +11,48 @@ parts =
slaprunner-frontend-promise slaprunner-frontend-promise
cloud9-promise cloud9-promise
dropbear-promise dropbear-promise
symlinks
eggs-directory = ${buildout:eggs-directory} eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory} develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true offline = true
# Create all needed directories # Create all needed directories
[rootdirectory] [directory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/ etc = $${buildout:directory}/etc/
var = $${buildout:directory}/var/ var = $${buildout:directory}/var/
srv = $${buildout:directory}/srv/ srv = $${buildout:directory}/srv/
bin = $${buildout:directory}/bin/ bin = $${buildout:directory}/bin/
[directory] sshkeys = $${:srv}/sshkeys
recipe = slapos.cookbook:mkdirectory services = $${:etc}/service/
sshkeys = $${rootdirectory:srv}/sshkeys scripts = $${:etc}/run/
services = $${rootdirectory:etc}/run/ ssh = $${:etc}/ssh/
ssh = $${rootdirectory:etc}/ssh/ log = $${:var}/log/
run = $${:var}/run/
[basedirectory] backup = $${:srv}/backup/
recipe = slapos.cookbook:mkdirectory promises = $${:etc}/promise/
log = $${rootdirectory:var}/log/ test = $${:etc}/test/
services = $${rootdirectory:etc}/run/
run = $${rootdirectory:var}/run/
backup = $${rootdirectory:srv}/backup/
promises = $${rootdirectory:etc}/promise/
[runnerdirectory] [runnerdirectory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
home = $${rootdirectory:srv}/runner/ home = $${directory:srv}/runner/
test = $${directory:srv}/test/
project = $${:home}/project project = $${:home}/project
software-root = $${:home}/software software-root = $${:home}/software
instance-root = $${:home}/instance instance-root = $${:home}/instance
project-test = $${:test}/project
software-test = $${:test}/software
instance-test = $${:test}/instance
sessions = $${buildout:directory}/.sessions
#Create password recovery code for slaprunner #Create password recovery code for slaprunner
[recovery-code] [recovery-code]
recipe = slapos.cookbook:generate.password recipe = slapos.cookbook:generate.password
storage-path = $${rootdirectory:etc}/.rcode storage-path = $${directory:etc}/.rcode
bytes = 4 bytes = 4
# Deploy cloud9 and slaprunner # Deploy cloud9 and slaprunner
...@@ -57,7 +60,7 @@ bytes = 4 ...@@ -57,7 +60,7 @@ bytes = 4
recipe = slapos.cookbook:cloud9 recipe = slapos.cookbook:cloud9
ip = $${slap-network-information:global-ipv6} ip = $${slap-network-information:global-ipv6}
port = 30000 port = 30000
wrapper = $${basedirectory:services}/cloud9 wrapper = $${directory:services}/cloud9
working-directory = $${runnerdirectory:home} working-directory = $${runnerdirectory:home}
git-binary = ${git:location}/bin/git git-binary = ${git:location}/bin/git
node-binary = ${nodejs:location}/bin/node node-binary = ${nodejs:location}/bin/node
...@@ -71,13 +74,14 @@ slapgrid_cp = ${buildout:directory}/bin/slapgrid-cp ...@@ -71,13 +74,14 @@ slapgrid_cp = ${buildout:directory}/bin/slapgrid-cp
slapproxy = ${buildout:directory}/bin/slapproxy slapproxy = ${buildout:directory}/bin/slapproxy
supervisor = ${buildout:directory}/bin/slapgrid-supervisorctl supervisor = ${buildout:directory}/bin/slapgrid-supervisorctl
git-binary = ${git:location}/bin/git git-binary = ${git:location}/bin/git
slapos.cfg = $${rootdirectory:etc}/slapos.cfg slapos.cfg = $${directory:etc}/slapos.cfg
working-directory = $${runnerdirectory:home} working-directory = $${runnerdirectory:home}
project-directory = $${runnerdirectory:project} project-directory = $${runnerdirectory:project}
software-directory = $${runnerdirectory:software-root} software-directory = $${runnerdirectory:software-root}
instance-directory = $${runnerdirectory:instance-root} instance-directory = $${runnerdirectory:instance-root}
etc_dir = $${rootdirectory:etc} etc_dir = $${directory:etc}
log_dir = $${basedirectory:log} log_dir = $${directory:log}
run_dir = $${directory:run}
ssh_client = $${sshkeys-dropbear:wrapper} ssh_client = $${sshkeys-dropbear:wrapper}
public_key = $${sshkeys-dropbear:public-key} public_key = $${sshkeys-dropbear:public-key}
private_key = $${sshkeys-dropbear:private-key} private_key = $${sshkeys-dropbear:private-key}
...@@ -85,11 +89,26 @@ ipv4 = $${slap-network-information:local-ipv4} ...@@ -85,11 +89,26 @@ ipv4 = $${slap-network-information:local-ipv4}
ipv6 = $${slap-network-information:global-ipv6} ipv6 = $${slap-network-information:global-ipv6}
proxy_port = 50000 proxy_port = 50000
runner_port = 50000 runner_port = 50000
partition-amount = 7 partition-amount = $${slap-parameter:instance-amount}
cloud9-url = $${cloud9:access-url} cloud9-url = $${cloud9:access-url}
wrapper = $${basedirectory:services}/slaprunner wrapper = $${directory:services}/slaprunner
debug = $${slap-parameter:debug}
# Deploy dropbear (minimalist ssh server)
[test-runner]
<= slaprunner
recipe = slapos.cookbook:slaprunner.test
slaprunnertest = ${buildout:directory}/bin/slaprunnertest
slapos.cfg = $${directory:etc}/slapos-test.cfg
working-directory = $${runnerdirectory:test}
project-directory = $${runnerdirectory:project-test}
software-directory = $${runnerdirectory:software-test}
instance-directory = $${runnerdirectory:instance-test}
proxy_port = 8602
wrapper = $${directory:bin}/runTestSuite
etc_dir = $${directory:test}
# Deploy dropbear (minimalist SSH server)
[sshkeys-directory] [sshkeys-directory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
requests = $${directory:sshkeys}/requests/ requests = $${directory:sshkeys}/requests/
...@@ -99,7 +118,7 @@ keys = $${directory:sshkeys}/keys/ ...@@ -99,7 +118,7 @@ keys = $${directory:sshkeys}/keys/
recipe = slapos.cookbook:sshkeys_authority recipe = slapos.cookbook:sshkeys_authority
request-directory = $${sshkeys-directory:requests} request-directory = $${sshkeys-directory:requests}
keys-directory = $${sshkeys-directory:keys} keys-directory = $${sshkeys-directory:keys}
wrapper = $${basedirectory:services}/sshkeys_authority wrapper = $${directory:services}/sshkeys_authority
keygen-binary = ${dropbear:location}/bin/dropbearkey keygen-binary = ${dropbear:location}/bin/dropbearkey
[dropbear-server] [dropbear-server]
...@@ -107,7 +126,7 @@ recipe = slapos.cookbook:dropbear ...@@ -107,7 +126,7 @@ recipe = slapos.cookbook:dropbear
host = $${slap-network-information:global-ipv6} host = $${slap-network-information:global-ipv6}
port = 2222 port = 2222
home = $${directory:ssh} home = $${directory:ssh}
wrapper = $${rootdirectory:bin}/raw_sshd wrapper = $${directory:bin}/raw_sshd
shell = /bin/bash shell = /bin/bash
rsa-keyfile = $${directory:ssh}/server_key.rsa rsa-keyfile = $${directory:ssh}/server_key.rsa
dropbear-binary = ${dropbear:location}/sbin/dropbear dropbear-binary = ${dropbear:location}/sbin/dropbear
...@@ -120,7 +139,7 @@ type = rsa ...@@ -120,7 +139,7 @@ type = rsa
executable = $${dropbear-server:wrapper} executable = $${dropbear-server:wrapper}
public-key = $${dropbear-server:rsa-keyfile}.pub public-key = $${dropbear-server:rsa-keyfile}.pub
private-key = $${dropbear-server:rsa-keyfile} private-key = $${dropbear-server:rsa-keyfile}
wrapper = $${basedirectory:services}/sshd wrapper = $${directory:services}/sshd
[dropbear-server-add-authorized-key] [dropbear-server-add-authorized-key]
<= dropbear-server <= dropbear-server
...@@ -154,31 +173,38 @@ password_recovery_code = $${recovery-code:passwd} ...@@ -154,31 +173,38 @@ password_recovery_code = $${recovery-code:passwd}
# Deploy promises scripts # Deploy promises scripts
[slaprunner-promise] [slaprunner-promise]
recipe = slapos.cookbook:check_port_listening recipe = slapos.cookbook:check_port_listening
path = $${basedirectory:promises}/slaprunner path = $${directory:promises}/slaprunner
hostname = $${slaprunner:ipv6} hostname = $${slaprunner:ipv6}
port = $${slaprunner:runner_port} port = $${slaprunner:runner_port}
[slaprunner-frontend-promise] [slaprunner-frontend-promise]
recipe = slapos.cookbook:check_url_available recipe = slapos.cookbook:check_url_available
path = $${basedirectory:promises}/slaprunner_frontend path = $${directory:promises}/slaprunner_frontend
url = $${request-frontend:connection-site_url} url = $${request-frontend:connection-site_url}
dash_path = ${dash:location}/bin/dash dash_path = ${dash:location}/bin/dash
curl_path = ${curl:location}/bin/curl curl_path = ${curl:location}/bin/curl
[cloud9-promise] [cloud9-promise]
recipe = slapos.cookbook:check_url_available recipe = slapos.cookbook:check_url_available
path = $${basedirectory:promises}/cloud9 path = $${directory:promises}/cloud9
url = http://$${cloud9:ip}:$${cloud9:port} url = http://$${cloud9:ip}:$${cloud9:port}
dash_path = ${dash:location}/bin/dash dash_path = ${dash:location}/bin/dash
curl_path = ${curl:location}/bin/curl curl_path = ${curl:location}/bin/curl
[dropbear-promise] [dropbear-promise]
recipe = slapos.cookbook:check_port_listening recipe = slapos.cookbook:check_port_listening
path = $${basedirectory:promises}/dropbear path = $${directory:promises}/dropbear
hostname = $${dropbear-server:host} hostname = $${dropbear-server:host}
port = $${dropbear-server:port} port = $${dropbear-server:port}
[symlinks]
recipe = cns.recipe.symlink
symlink_target = $${directory:bin}
symlink_base = ${buildout:directory}/bin
[slap-parameter] [slap-parameter]
# Default value if no ssh key is specified # Default value if no ssh key is specified
authorized-key = authorized-key =
# Default value of instances number in slaprunner
instance-amount = 10
debug = false
[buildout] # Production profile of slaprunner.
# Exactly the same as common.cfg, but:
extends = # 1/ Use a defined set of Python eggs instead of using the latest available
../../stack/slapos.cfg # ones from Pypi, to ensure stability;
../../stack/flask.cfg # 2/ Define list of trusted certificates for the cache.
../../stack/shacache-client.cfg
../../component/dropbear/buildout.cfg
../../component/git/buildout.cfg
../../component/cloud9/buildout.cfg
../../component/dash/buildout.cfg
parts =
template
slapos-cookbook
eggs
[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
output = ${buildout:directory}/template.cfg
mode = 0644
md5sum = 5307e4200f044ae57b504ad68444491c
[template-runner] [buildout]
recipe = slapos.recipe.template extends = common.cfg
url = ${:_profile_base_location_}/instance-runner.cfg
output = ${buildout:directory}/template-runner.cfg
md5sum = b57ebff565595fa92cd7d5adc6a22c7e
mode = 0644
[eggs]
recipe = z3c.recipe.scripts
eggs =
slapos.libnetworkcache
slapos.toolbox[flask_auth]
slapos.core
[networkcache] [networkcache]
# signature certificates of the following uploaders. # signature certificates of the following uploaders.
# Cedric de Saint Martin # Cedric de Saint Martin
# Test Agent
signature-certificate-list = signature-certificate-list =
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
...@@ -52,106 +25,95 @@ signature-certificate-list = ...@@ -52,106 +25,95 @@ signature-certificate-list =
Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby
If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY= If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY=
-----END CERTIFICATE----- -----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAKRvzcy7OH0UMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
BAMMCENPTVAtNzcyMCAXDTEyMDgxMDE1NDI1MVoYDzIxMTIwNzE3MTU0MjUxWjAT
MREwDwYDVQQDDAhDT01QLTc3MjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
o7aipd6MbnuGDeR1UJUjuMLQUariAyQ2l2ZDS6TfOwjHiPw/mhzkielgk73kqN7A
sUREx41eTcYCXzTq3WP3xCLE4LxLg1eIhd4nwNHj8H18xR9aP0AGjo4UFl5BOMa1
mwoyBt3VtfGtUmb8whpeJgHhqrPPxLoON+i6fIbXDaUCAwEAAaNQME4wHQYDVR0O
BBYEFEfjy3OopT2lOksKmKBNHTJE2hFlMB8GA1UdIwQYMBaAFEfjy3OopT2lOksK
mKBNHTJE2hFlMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAaNRx6YN2
M/p3R8/xS6zvH1EqJ3FFD7XeAQ52WuQnKSREzuw0dsw12ClxjcHiQEFioyTiTtjs
5pW18Ry5Ie7iFK4cQMerZwWPxBodEbAteYlRsI6kePV7Gf735Y1RpuN8qZ2sYL6e
x2IMeSwJ82BpdEI5niXxB+iT0HxhmR+XaMI=
-----END CERTIFICATE-----
[versions] [versions]
Flask-Auth = 0.8 Flask-Auth = 0.85
Jinja2 = 2.6 Jinja2 = 2.6
Werkzeug = 0.8.3 Werkzeug = 0.8.3
apache-libcloud = 0.11.1 apache-libcloud = 0.11.4
async = 0.6.1 async = 0.6.1
buildout-versions = 1.7 buildout-versions = 1.7
cns.recipe.symlink = 0.2.3
gitdb = 0.5.4 gitdb = 0.5.4
hexagonit.recipe.cmmi = 1.6 hexagonit.recipe.cmmi = 1.6
meld3 = 0.6.8 inotifyx = 0.2.0
lxml = 3.0.1
meld3 = 0.6.10
netaddr = 0.7.10
plone.recipe.command = 1.1 plone.recipe.command = 1.1
pycrypto = 2.6 pycrypto = 2.6
slapos.cookbook = 0.64.2 pytz = 2012h
slapos.libnetworkcache = 0.13.2 slapos.cookbook = 0.70
slapos.recipe.build = 0.11 slapos.core = 0.33.1
slapos.libnetworkcache = 0.13.3
slapos.recipe.build = 0.11.5
slapos.recipe.template = 2.4.2 slapos.recipe.template = 2.4.2
slapos.toolbox = 0.30 slapos.toolbox = 0.32
smmap = 0.8.2 smmap = 0.8.2
xml-marshaller = 0.9.7
z3c.recipe.scripts = 1.0.1 z3c.recipe.scripts = 1.0.1
# Required by: # Required by:
# slapos.core==0.30 # slapos.core==0.33.1
# slapos.toolbox==0.30 # slapos.toolbox==0.32
Flask = 0.9 Flask = 0.9
# Required by: # Required by:
# slapos.toolbox==0.30 # slapos.toolbox==0.32
GitPython = 0.3.2.RC1 GitPython = 0.3.2.RC1
# Required by: # Required by:
# slapos.cookbook==0.64.2 # slapos.toolbox==0.32
PyXML = 0.8.4
# Required by:
# slapos.toolbox==0.30
atomize = 0.1.1 atomize = 0.1.1
# Required by: # Required by:
# slapos.toolbox==0.30 # slapos.toolbox==0.32
feedparser = 5.1.2 feedparser = 5.1.3
# Required by: # Required by:
# hexagonit.recipe.cmmi==1.6 # hexagonit.recipe.cmmi==1.6
hexagonit.recipe.download = 1.5.1 hexagonit.recipe.download = 1.6
# Required by:
# slapos.cookbook==0.64.2
inotifyx = 0.2.0
# Required by:
# slapos.core==0.30
# slapos.toolbox==0.30
# xml-marshaller==0.9.7
lxml = 3.0alpha2
# Required by: # Required by:
# slapos.cookbook==0.64.2 # slapos.core==0.33.1
netaddr = 0.7.9
# Required by:
# slapos.core==0.30
netifaces = 0.8 netifaces = 0.8
# Required by: # Required by:
# slapos.toolbox==0.30 # slapos.toolbox==0.32
paramiko = 1.7.7.2 paramiko = 1.9.0
# Required by: # Required by:
# slapos.toolbox==0.30 # slapos.toolbox==0.32
psutil = 0.6.1 psutil = 0.6.1
# Required by: # Required by:
# slapos.cookbook==0.64.2 # cns.recipe.symlink==0.2.3
# slapos.core==0.30 # slapos.cookbook==0.70
# slapos.libnetworkcache==0.13.2 # slapos.core==0.33.1
# slapos.toolbox==0.30 # slapos.libnetworkcache==0.13.3
# supervisor==3.0a12 # slapos.toolbox==0.32
# zc.buildout==1.6.0-dev-SlapOS-007 # supervisor==3.0b1
# zc.recipe.egg==1.3.2 # zc.buildout==1.6.0-dev-SlapOS-010
# zope.interface==4.0.1 # zope.interface==4.0.2
setuptools = 0.6c12dev-r88846 setuptools = 0.6c12dev-r88846
# Required by: # Required by:
# slapos.cookbook==0.64.2 # slapos.core==0.33.1
slapos.core = 0.30 supervisor = 3.0b1
# Required by:
# slapos.core==0.30
supervisor = 3.0a12
# Required by:
# slapos.cookbook==0.64.2
xml-marshaller = 0.9.7
# Required by:
# slapos.cookbook==0.64.2
zc.recipe.egg = 1.3.2
# Required by: # Required by:
# slapos.core==0.30 # slapos.core==0.33.1
zope.interface = 4.0.1 zope.interface = 4.0.2
pe.egg = 1.3.2
...@@ -16,7 +16,7 @@ extends = ...@@ -16,7 +16,7 @@ extends =
[application] [application]
recipe = slapos.recipe.build:download-unpacked recipe = slapos.recipe.build:download-unpacked
url = http://www.sugarforge.org/frs/download.php/8558/SugarCE-6.3.0RC3.zip url = http://www.sugarforge.org/frs/download.php/8558/SugarCE-6.3.0RC3.zip
md5sum = ff4cf7c6f673f9f3f6e082c62736f628 md5sum = 40bcc6ff38ef31194d46864a9f3548f3
[instance-recipe] [instance-recipe]
egg = slapos.cookbook egg = slapos.cookbook
......
# A simple software release to test if tesseract building works
[buildout]
extends =
../../stack/slapos.cfg
../../component/tesseract/buildout.cfg
\ No newline at end of file
[buildout]
parts =
testnode
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
[testnode]
recipe = slapos.cookbook:testnode
buildbot_binary = ${buildout:bin-directory}/buildbot
git_binary = ${git:location}/bin/git
slapgrid_partition_binary = ${buildout:bin-directory}/slapgrid-cp
slapgrid_software_binary = ${buildout:bin-directory}/slapgrid-sr
slapproxy_binary = ${buildout:bin-directory}/slapproxy
svn_binary = ${subversion:location}/bin/svn
svnversion_binary = ${subversion:location}/bin/svnversion
zip_binary = ${zip:location}/bin/zip
[buildout]
recipe_location = ${:parts-directory}/slapos.cookbook
develop = ${:recipe_location}
versions = versions
extensions = slapos.rebootstrap
rebootstrap-section = python2.6
extends =
../../component/python-2.6/buildout.cfg
../../component/subversion/buildout.cfg
../../component/lxml-python/buildout.cfg
../../component/git/buildout.cfg
../../component/zip/buildout.cfg
parts =
template
bootstrap
eggs
subversion
git
zip
checkrecipe
find-links +=
http://www.nexedi.org/static/packages/source/slapos.buildout/
http://www.nexedi.org/static/packages/source/
[checkrecipe]
recipe = plone.recipe.command
stop-on-error = true
update-command = ${:command}
command = grep parts ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link
[slapos.cookbook]
recipe = plone.recipe.command
stop-on-error = true
location = ${buildout:parts-directory}/${:_buildout_section_name_}
command = "${git:location}/bin/git" clone -b testnode --quiet http://git.erp5.org/repos/slapos.git "${:location}"
update-command = cd "${:location}" && "${git:location}/bin/git" fetch --quiet && "${git:location}/bin/git" reset --hard @{upstream}
[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
md5sum = 03451596826e487dc97d81e27a1e7a73
output = ${buildout:directory}/template.cfg
mode = 0644
[bootstrap]
recipe = zc.recipe.egg
eggs = zc.buildout
suffix =
scripts =
buildout=bootstrap2.6
arguments = sys.argv[1:] + ["bootstrap"]
[rebootstrap]
section = python2.6
version = 1
[eggs]
dummy = ${slapos.cookbook:location}
recipe = zc.recipe.egg
eggs =
${lxml-python:egg}
Zope2
collective.recipe.template
netaddr
slapos.slap
xml_marshaller
PyXML
slapos.core
slapos.cookbook
buildbot
Twisted
entry-points = buildbot=buildbot.scripts.runner:run
[versions]
zc.buildout = 1.5.3-dev-SlapOS-001
# only those buildout with Twisted are known to work
buildbot = 0.7.12
Twisted = 8.2.0
# locally fixed PyXML which supports python 2.6
PyXML = 0.8.4nxd001
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
table_name = lang
constraint = `defaut`=1 AND `url`<>''
delete = install
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
downloadcache-workaround
extends =
../../stack/lamp.cfg
../../stack/shacache-client.cfg
[application]
recipe = hexagonit.recipe.download
url = http://thelia.net/fichiers/thelia_1.5.1.zip
md5sum = 7be32154c75e450b39bdb4478658848b
#If provided tarball does not contain top directory, option shall be changed to false
strip-top-level-dir = true
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
#eggs = ${instance-recipe:egg}
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
[versions]
# Use SlapOS patched zc.buildout
zc.buildout = 1.5.3-dev-SlapOS-010
[downloadcache-workaround]
# workaround irritating problem of hexagonit.recipe.cmmi which automatically
# creates download cache, which in turn switches builout to "semi-offline" mode
recipe = plone.recipe.command
# in hexagonit.recipe.cmmi if there is no ${buildout:download-cache} set it resolves
# to ${buildout:directory}/downloads but this variable is available late, that's
# why it is hardcoded only for required case
download-cache = ${buildout:directory}/downloads
command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
update-command = ${:command}
stop-on-error = True
\ No newline at end of file
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
downloadcache-workaround
extends =
../../stack/lamp.cfg
../../stack/shacache-client.cfg
[application]
recipe = hexagonit.recipe.download
url = http://downloads.sourceforge.net/project/textmb/UPB/UPB%202.2.7/upb2.2.7.zip?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Ftextmb%2Ffiles%2FUPB%2FUPB%25202.2.7%2F&ts=1320403647&use_mirror=freefr
md5sum = b50e2c8d222789beb399d07d3eba2206
strip-top-level-dir = true
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
[versions]
# Use SlapOS patched zc.buildout
zc.buildout = 1.5.3-dev-SlapOS-010
[downloadcache-workaround]
# workaround irritating problem of hexagonit.recipe.cmmi which automatically
# creates download cache, which in turn switches builout to "semi-offline" mode
recipe = plone.recipe.command
# in hexagonit.recipe.cmmi if there is no ${buildout:download-cache} set it resolves
# to ${buildout:directory}/downloads but this variable is available late, that's
# why it is hardcoded only for required case
download-cache = ${buildout:directory}/downloads
command = [ -d ${:download-cache} ] && rm -fr ${:download-cache}/* || exit 0
update-command = ${:command}
stop-on-error = True
\ No newline at end of file
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://freefr.dl.sourceforge.net/project/web2project/web2Project/v2.3%20Release/web2project-2.3.1.tar.gz
md5sum = 570e079775817ddda3c99eb302511e5a
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${instance-recipe:egg}
\ No newline at end of file
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://garr.dl.sourceforge.net/project/wikyblog/WikyBlog/1.7.3RC2/WikyBlog-1.7.3rc2.tar.gz
md5sum = 1d2adbb8e19f4168205f5a5b3e5c6a84
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${instance-recipe:egg}
[buildout]
extends =
../../stack/lamp/buildout.cfg
[application]
url = http://wordpress.org/wordpress-3.5.tar.gz
md5sum = 105b5baff67344528bb5d8b71c050b0d
[application-template]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/wp-config.php.in
md5sum = 0d62b28125ca3c780db0b547199953f2
download-only = True
filename = template.in
mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[application-configuration]
location = wp-config.php
# Exactly the same as software.cfg, but fetch the slapos.cookbook and
# slapos.toolbox from git repository instead of fetching stable version,
# allowing to play with bleeding edge environment.
# You'll need to run buildout twice for this profile.
[buildout]
extends =
../../component/git/buildout.cfg
common.cfg
parts +=
# Development parts
slapos.cookbook-repository
slapos.core-repository
slapos.toolbox-repository
check-recipe
develop =
${:parts-directory}/slapos.cookbook-repository
${:parts-directory}/slapos.core-repository
${:parts-directory}/slapos.toolbox-repository
[slapos.toolbox-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.toolbox.git
branch = master
git-executable = ${git:location}/bin/git
[slapos.cookbook-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.git
branch = lapp-resilient3
git-executable = ${git:location}/bin/git
[slapos.core-repository]
recipe = slapos.recipe.build:gitclone
repository = http://git.erp5.org/repos/slapos.core.git
branch = master
git-executable = ${git:location}/bin/git
[check-recipe]
recipe = plone.recipe.command
stop-on-error = true
update-command = ${:command}
command =
grep parts ${buildout:develop-eggs-directory}/slapos.cookbook.egg-link &&
grep parts ${buildout:develop-eggs-directory}/slapos.core.egg-link &&
grep parts ${buildout:develop-eggs-directory}/slapos.toolbox.egg-link
[buildout] [buildout]
extends = extends = common.cfg
../../stack/lamp/buildout.cfg
[application]
url = http://wordpress.org/wordpress-3.4.2.tar.gz
md5sum = dfc56cee27eec8fb79070f033ecd4b25
[application-template]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/wp-config.php.in
md5sum = 0d62b28125ca3c780db0b547199953f2
download-only = True
filename = template.in
mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[application-configuration]
location = wp-config.php
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
template = ${application-template:location}/${application-template:filename}
configuration = ${application-configuration:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
table_name = *_rolemembers
constraint = `xar_uid`=6
delete = xaraya-1.2.3/html/install.php
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://freefr.dl.sourceforge.net/project/xaraya/Core%20plus%20Modules/Xaraya%201.2.3%20Core%20Plus/xaraya-1.2.3-full.tar.gz
md5sum = c2fd2daa5335d262b4288e456c233434
script =
if not self.options.get('url'): self.options['url'], self.options['md5sum'] = self.options[guessPlatform()].split(' ')
extract_dir = self.extract(self.download(self.options['url'], self.options.get('md5sum')))
workdir = guessworkdir(extract_dir)
self.copyTree(workdir + "/html", "${buildout:parts-directory}/${:_buildout_section_name_}")
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
template = ${application-template:location}/${application-template:filename}
configuration = ${application-configuration:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
delete = install.php
table_name = sheets
constraint = `sheet_id`>=0
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = hexagonit.recipe.download:download-unpacked
url = http://sunet.dl.sourceforge.net/project/xellplan/xellplan/xellplan-1.3/xellplan-1.3.tar.bz2
md5sum = 37880217917367eb2d4a0a33c4a7fb65
[application-template]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/template/sfx.php.in
filename = template.in
mode = 0644
location = ${buildout:parts-directory}/${:_buildout_section_name_}
[application-configuration]
location = inc/sfx.php
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
<?php
#----------------------------------------------------------------------
# config begin
$SITE_TITLE = "XellPlan";
# default language, ("de","en" are valid choices for now)
$LANGUAGE = "en";
$DB_NAME = "%(mysql_database)s";
$DB_HOST = "%(mysql_host)s";
$DB_USER = "%(mysql_user)s";
$DB_PASS = "%(mysql_password)s";
$DB_PREFIX = "xp_";
$CREATE_PASSWORD = "genesis"; # you need this one to create new plans
$MASTER_PASSWORD = "god"; # universal user and admin password
# config end - don't modify anything below this line
#----------------------------------------------------------------------
include("lang/".$LANGUAGE.".php");
function db_connect() {
global $DB_LINK, $DB_HOST, $DB_USER, $DB_PASS, $DB_NAME, $CLUBS, $PLAN;
$DB_LINK = mysql_pconnect( $DB_HOST, $DB_USER, $DB_PASS );
mysql_select_db( $DB_NAME );
}
function SfxRedirectPage($url,$Message,$time=2) {
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="std.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="author" content="Christoph Luehr">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="content-language" content="de">
<meta http-equiv="refresh" content="<?php echo $time; ?>;URL=<?php echo $url; ?>">
<title>XCell-Plan: <?php echo $Message; ?></title>
</head>
<body>
<br/>
<h1><?php echo $Message; ?></h1>
<br></br>
</body>
</html>
<?php
exit; // finish after a redirect
}
function SfxDateSel($varname, $default="today") {
if ( $default == "today" ) $default= date('Y-m-d');
echo '<input type="text" name="'.$varname.
'" id="'.$varname.'" value="'.$default.
'" size="10" maxlength="10" readonly="true" />';
echo '<input type="button" '.
'onClick="showCalendar(this,document.getElementById(\''.
$varname.'\'),\'yyyy-mm-dd\',\''.$GLOBALS['LANGUAGE'].'\',1)" value="..." />&nbsp;';
}
function SfxTimeSel($varname,$default="12:00:00") {
echo '<select name="'.$varname.'">';
for ($h=0; $h<24;$h++) {
if (strlen($h)<2 ) $h="0".$h; # evil
foreach( array('00','30') as $m ) {
$sel="";
if ( $default == $h.":".$m.":00") $sel=" selected";
echo '<option value="'.$h.':'.$m.':00"'.$sel.'>'.$h.':'.$m.'</option>';
}
}
echo '</select>'."\n";
}
function SfxBegin() {
db_connect();
}
function filterVar($value) {
// recursive treatment for arrays
if (is_array($value)) {
$ret = array();
foreach ($value as $k => $v) {
$ret[filterVar($k)] = filterVar($v);
}
return $ret;
}
// filter ascii control chars
$value = preg_replace('/[\x00-\x1f]+/', '', $value);
$value = str_replace('\\', '\\\\', $value);
$value = str_replace('\'', '\\\'', $value);
return $value;
}
function getInputVar($name) {
if (isset($GLOBALS[$name])) {
return $GLOBALS[$name];
}
if (isset($_GET[$name])) {
return filterVar($_GET[$name]);
}
if (isset($_POST[$name])) {
return filterVar($_POST[$name]);
}
return '';
}
SfxBegin(); // start DB connection
// get often used vars
$ID = getInputVar('ID');
[buildout] [buildout]
extends = extends =
../../stack/tomcat.cfg ../../stack/tomcat.cfg
../../stack/slapos.cfg
[instance-recipe] [instance-recipe]
egg = slapos.cookbook egg = slapos.cookbook
...@@ -23,6 +24,40 @@ recipe = hexagonit.recipe.download ...@@ -23,6 +24,40 @@ recipe = hexagonit.recipe.download
url = http://download.forge.objectweb.org/xwiki/xwiki-enterprise-web-2.7.war url = http://download.forge.objectweb.org/xwiki/xwiki-enterprise-web-2.7.war
md5sum = c56e2cde96d28c5899a16a8270b6ff88 md5sum = c56e2cde96d28c5899a16a8270b6ff88
[networkcache]
# signature certificates of the following uploaders.
# Cedric de Saint Martin
# Test Agent
signature-certificate-list =
-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
BAMMCENPTVAtMjMyMCAXDTEyMDIxNjExMTAyM1oYDzIxMTIwMTIzMTExMDIzWjAT
MREwDwYDVQQDDAhDT01QLTIzMjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
wi/3Z8W9pUiegUXIk/AiFDQ0UJ4JFAwjqr+HSRUirlUsHHT+8DzH/hfcTDX1I5BB
D1ADk+ydXjMm3OZrQcXjn29OUfM5C+g+oqeMnYQImN0DDQIOcUyr7AJc4xhvuXQ1
P2pJ5NOd3tbd0kexETa1LVhR6EgBC25LyRBRae76qosCAwEAAaNQME4wHQYDVR0O
BBYEFMDmW9aFy1sKTfCpcRkYnP6zUd1cMB8GA1UdIwQYMBaAFMDmW9aFy1sKTfCp
cRkYnP6zUd1cMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAskbFizHr
b6d3iIyN+wffxz/V9epbKIZVEGJd/6LrTdLiUfJPec7FaxVCWNyKBlCpINBM7cEV
Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby
If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY=
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAKRvzcy7OH0UMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
BAMMCENPTVAtNzcyMCAXDTEyMDgxMDE1NDI1MVoYDzIxMTIwNzE3MTU0MjUxWjAT
MREwDwYDVQQDDAhDT01QLTc3MjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
o7aipd6MbnuGDeR1UJUjuMLQUariAyQ2l2ZDS6TfOwjHiPw/mhzkielgk73kqN7A
sUREx41eTcYCXzTq3WP3xCLE4LxLg1eIhd4nwNHj8H18xR9aP0AGjo4UFl5BOMa1
mwoyBt3VtfGtUmb8whpeJgHhqrPPxLoON+i6fIbXDaUCAwEAAaNQME4wHQYDVR0O
BBYEFEfjy3OopT2lOksKmKBNHTJE2hFlMB8GA1UdIwQYMBaAFEfjy3OopT2lOksK
mKBNHTJE2hFlMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAaNRx6YN2
M/p3R8/xS6zvH1EqJ3FFD7XeAQ52WuQnKSREzuw0dsw12ClxjcHiQEFioyTiTtjs
5pW18Ry5Ie7iFK4cQMerZwWPxBodEbAteYlRsI6kePV7Gf735Y1RpuN8qZ2sYL6e
x2IMeSwJ82BpdEI5niXxB+iT0HxhmR+XaMI=
-----END CERTIFICATE-----
[versions] [versions]
slapos.cookbook = 0.18 slapos.cookbook = 0.18
......
...@@ -21,6 +21,7 @@ mode = 0644 ...@@ -21,6 +21,7 @@ mode = 0644
[networkcache] [networkcache]
# signature certificates of the following uploaders. # signature certificates of the following uploaders.
# Cedric de Saint Martin # Cedric de Saint Martin
# Test Agent
signature-certificate-list = signature-certificate-list =
-----BEGIN CERTIFICATE----- -----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV MIIB9jCCAV+gAwIBAgIJAO4V/jiMoICoMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
...@@ -35,6 +36,19 @@ signature-certificate-list = ...@@ -35,6 +36,19 @@ signature-certificate-list =
Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby Gn9t8mdVQflNqOlAMkOlUv1ZugCt9rXYQOV7rrEYJBWirn43BOMn9Flp2nibblby
If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY= If1a2ZoqHRxoNo2yTmm7TSYRORWVS+vvfjY=
-----END CERTIFICATE----- -----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIB9jCCAV+gAwIBAgIJAKRvzcy7OH0UMA0GCSqGSIb3DQEBBQUAMBMxETAPBgNV
BAMMCENPTVAtNzcyMCAXDTEyMDgxMDE1NDI1MVoYDzIxMTIwNzE3MTU0MjUxWjAT
MREwDwYDVQQDDAhDT01QLTc3MjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA
o7aipd6MbnuGDeR1UJUjuMLQUariAyQ2l2ZDS6TfOwjHiPw/mhzkielgk73kqN7A
sUREx41eTcYCXzTq3WP3xCLE4LxLg1eIhd4nwNHj8H18xR9aP0AGjo4UFl5BOMa1
mwoyBt3VtfGtUmb8whpeJgHhqrPPxLoON+i6fIbXDaUCAwEAAaNQME4wHQYDVR0O
BBYEFEfjy3OopT2lOksKmKBNHTJE2hFlMB8GA1UdIwQYMBaAFEfjy3OopT2lOksK
mKBNHTJE2hFlMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAaNRx6YN2
M/p3R8/xS6zvH1EqJ3FFD7XeAQ52WuQnKSREzuw0dsw12ClxjcHiQEFioyTiTtjs
5pW18Ry5Ie7iFK4cQMerZwWPxBodEbAteYlRsI6kePV7Gf735Y1RpuN8qZ2sYL6e
x2IMeSwJ82BpdEI5niXxB+iT0HxhmR+XaMI=
-----END CERTIFICATE-----
[versions] [versions]
Jinja2 = 2.6 Jinja2 = 2.6
......
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
httpd_binary = ${apache:location}/bin/httpd
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
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://zenphoto.googlecode.com/files/zenphoto-1.4.2.2.tar.gz
md5sum = 1f4fff7294ffdd017d5ffc5207ec7011
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs = ${instance-recipe:egg}
# -*- coding: utf-8 -*-
import sys
import os
import shutil
def setup(args):
mysql_port, mysql_host, mysql_user, mysql_password, mysql_database, base_url, htdocs = args
config_php = os.path.join(htdocs, "config/config.php")
install_php = os.path.join(htdocs, "install.php")
install_folder = os.path.join(htdocs, "install")
upgrade_php = os.path.join(htdocs, "upgrade.php")
os.chmod(config_php, 0444)
os.remove(install_php)
os.remove(upgrade_php)
shutil.rmtree(install_folder)
if __name__ == '__main__':
setup(sys.argv[1:])
[buildout]
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
parts = instance
[instance]
recipe = ${instance-recipe:egg}:${instance-recipe:module}
source = ${application:location}
lampconfigure_directory = ${buildout:bin-directory}/lampconfigure
httpd_binary = ${apache:location}/bin/httpd
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
table_name = themes
constraint = `pn_id`>0
script = ${configure-script:location}/${configure-script:filename}
[buildout]
versions = versions
parts =
template
apache-php
mariadb
eggs
instance-recipe-egg
configure-script
extends =
../../stack/lamp.cfg
[application]
recipe = slapos.recipe.build:download-unpacked
url = http://ci.zikula.org/job/Zikula-1.2.8/17/artifact/build/archive/Zikula-1.2.8.build17.zip
md5sum = bc453d665605f954f1497586ccd6d267
[configure-script]
recipe = slapos.recipe.download
location = ${buildout:parts-directory}/${:_buildout_section_name_}
url = ${:_profile_base_location_}/configure-zikula.py
md5sum = c4d5f87d8f02cad3f20e679160195f48
filename = configure-zikula.py
mode = 0744
[instance-recipe]
egg = slapos.cookbook
module = lamp.simple
[template]
# Default template for the instance.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
#md5sum = Student shall put md5 of instance.cfg here
output = ${buildout:directory}/template.cfg
mode = 0644
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs =
${mysql-python:egg}
${instance-recipe:egg}
slapos.toolbox[lampconfigure]
...@@ -490,6 +490,7 @@ eggs = ...@@ -490,6 +490,7 @@ eggs =
Products.MimetypesRegistry Products.MimetypesRegistry
Products.ExternalEditor Products.ExternalEditor
Products.TIDStorage Products.TIDStorage
Products.LongRequestLogger
# Currently forked in our repository # Currently forked in our repository
# Products.PortalTransforms # Products.PortalTransforms
......
...@@ -16,32 +16,92 @@ eggs-directory = ${buildout:eggs-directory} ...@@ -16,32 +16,92 @@ eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory} develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true offline = true
[urls]
recipe = slapos.cookbook:publish
url = http://[$${apache-proxy:ip}]:$${apache-proxy:port}/
ssh-public-key = $${sshkeys-dropbear:public-key-value}
ssh-url = ssh://nobody@[$${dropbear-server:host}]:$${dropbear-server:port}/$${rdiff-backup-server:path}
[apache-proxy] #----------------
recipe = slapos.cookbook:apacheproxy #--
url = $${slap-parameter:proxy-url} #-- Creation of all needed directories.
pid-file = $${basedirectory:run}/apache.pid
lock-file = $${basedirectory:run}/apache.lock
ip = $${slap-network-information:global-ipv6}
port = 8080
error-log = $${directory:httpd-log}/error.log
access-log = $${directory:httpd-log}/access.log
httpd-conf = $${rootdirectory:etc}/apache.conf
wrapper = $${basedirectory:services}/apache
promise = $${basedirectory:promises}/apache [rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc
var = $${buildout:directory}/var
srv = $${buildout:directory}/srv
bin = $${buildout:directory}/bin
tmp = $${buildout:directory}/tmp
httpd-binary = ${apache:location}/bin/httpd [basedirectory]
recipe = slapos.cookbook:mkdirectory
log = $${rootdirectory:var}/log
services = $${rootdirectory:etc}/run
run = $${rootdirectory:var}/run
backup = $${rootdirectory:srv}/backup
promises = $${rootdirectory:etc}/promise
[directory]
recipe = slapos.cookbook:mkdirectory
htdocs = $${rootdirectory:srv}/www
logrotate-entries = $${rootdirectory:etc}/logrotate.d
logrotate-backup = $${basedirectory:backup}/logrotate
cronstamps = $${rootdirectory:etc}/cronstamps
cron-entries = $${rootdirectory:etc}/cron.d
crontabs = $${rootdirectory:etc}/crontabs
ssh = $${rootdirectory:etc}/ssh
sshkeys = $${rootdirectory:srv}/sshkeys
httpd-log = $${basedirectory:log}/apache
#----------------
#--
#-- Deploy cron.
[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:wrapper}
binary = $${basedirectory:services}/crond
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = $${rootdirectory:bin}/cron_simplelogger
log = $${basedirectory:log}/crond.log
#----------------
#--
#-- Deploy logrotate.
[cron-entry-logrotate]
<= cron
recipe = slapos.cookbook:cron.d
name = logrotate
frequency = 0 0 * * *
command = $${logrotate:wrapper}
[logrotate]
recipe = slapos.cookbook:logrotate
# Binaries
logrotate-binary = ${logrotate:location}/usr/sbin/logrotate
gzip-binary = ${gzip:location}/bin/gzip
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
#----------------
#--
#-- sshkeys
[sshkeys-directory] [sshkeys-directory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
requests = $${directory:sshkeys}/requests/ requests = $${directory:sshkeys}/requests
keys = $${directory:sshkeys}/keys/ keys = $${directory:sshkeys}/keys
[sshkeys-authority] [sshkeys-authority]
recipe = slapos.cookbook:sshkeys_authority recipe = slapos.cookbook:sshkeys_authority
...@@ -60,6 +120,11 @@ public-key = $${dropbear-server:rsa-keyfile}.pub ...@@ -60,6 +120,11 @@ public-key = $${dropbear-server:rsa-keyfile}.pub
private-key = $${dropbear-server:rsa-keyfile} private-key = $${dropbear-server:rsa-keyfile}
wrapper = $${basedirectory:services}/sshd wrapper = $${basedirectory:services}/sshd
#----------------
#--
#-- Dropbear.
[dropbear-server] [dropbear-server]
recipe = slapos.cookbook:dropbear recipe = slapos.cookbook:dropbear
host = $${slap-network-information:global-ipv6} host = $${slap-network-information:global-ipv6}
...@@ -75,6 +140,11 @@ dropbear-binary = ${dropbear:location}/sbin/dropbear ...@@ -75,6 +140,11 @@ dropbear-binary = ${dropbear:location}/sbin/dropbear
recipe = slapos.cookbook:dropbear.add_authorized_key recipe = slapos.cookbook:dropbear.add_authorized_key
key = $${slap-parameter:authorized-key} key = $${slap-parameter:authorized-key}
#----------------
#--
#-- rdiff
[rdiff-backup-server] [rdiff-backup-server]
recipe = slapos.cookbook:pbs recipe = slapos.cookbook:pbs
client = false client = false
...@@ -82,18 +152,26 @@ path = $${directory:htdocs} ...@@ -82,18 +152,26 @@ path = $${directory:htdocs}
wrapper = $${rootdirectory:bin}/rdiffbackup-server wrapper = $${rootdirectory:bin}/rdiffbackup-server
rdiffbackup-binary = ${buildout:bin-directory}/rdiff-backup rdiffbackup-binary = ${buildout:bin-directory}/rdiff-backup
[logrotate]
recipe = slapos.cookbook:logrotate #----------------
# Binaries #--
logrotate-binary = ${logrotate:location}/usr/sbin/logrotate #-- Apache Proxy.
gzip-binary = ${gzip:location}/bin/gzip
gunzip-binary = ${gzip:location}/bin/gunzip [apache-proxy]
# Directories recipe = slapos.cookbook:apacheproxy
wrapper = $${rootdirectory:bin}/logrotate url = $${slap-parameter:proxy-url}
conf = $${rootdirectory:etc}/logrotate.conf pid-file = $${basedirectory:run}/apache.pid
logrotate-entries = $${directory:logrotate-entries} lock-file = $${basedirectory:run}/apache.lock
backup = $${directory:logrotate-backup} ip = $${slap-network-information:global-ipv6}
state-file = $${rootdirectory:srv}/logrotate.status port = 8080
error-log = $${directory:httpd-log}/error.log
access-log = $${directory:httpd-log}/access.log
httpd-conf = $${rootdirectory:etc}/apache.conf
wrapper = $${basedirectory:services}/apache
promise = $${basedirectory:promises}/apache
httpd-binary = ${apache:location}/bin/httpd
[logrotate-entry-apache] [logrotate-entry-apache]
<= logrotate <= logrotate
...@@ -106,51 +184,14 @@ sharedscripts = true ...@@ -106,51 +184,14 @@ sharedscripts = true
notifempty = true notifempty = true
create = 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:wrapper}
binary = $${basedirectory:services}/crond
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = $${rootdirectory:bin}/cron_simplelogger
log = $${basedirectory:log}/crond.log
[cron-entry-logrotate]
<= cron
recipe = slapos.cookbook:cron.d
name = logrotate
frequency = 0 0 * * *
command = $${logrotate:wrapper}
[rootdirectory] #----------------
recipe = slapos.cookbook:mkdirectory #--
etc = $${buildout:directory}/etc/ #-- Publish instance parameters.
var = $${buildout:directory}/var/
srv = $${buildout:directory}/srv/
bin = $${buildout:directory}/bin/
tmp = $${buildout:directory}/tmp/
[basedirectory] [urls]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:publish
log = $${rootdirectory:var}/log/ url = http://[$${apache-proxy:ip}]:$${apache-proxy:port}/
services = $${rootdirectory:etc}/run/ ssh-public-key = $${sshkeys-dropbear:public-key-value}
run = $${rootdirectory:var}/run/ ssh-url = ssh://nobody@[$${dropbear-server:host}]:$${dropbear-server:port}/$${rdiff-backup-server:path}
backup = $${rootdirectory:srv}/backup/
promises = $${rootdirectory:etc}/promise/
[directory]
recipe = slapos.cookbook:mkdirectory
htdocs = $${rootdirectory:srv}/www/
logrotate-entries = $${rootdirectory:etc}/logrotate.d/
logrotate-backup = $${basedirectory:backup}/logrotate/
cronstamps = $${rootdirectory:etc}/cronstamps/
cron-entries = $${rootdirectory:etc}/cron.d/
crontabs = $${rootdirectory:etc}/crontabs/
ssh = $${rootdirectory:etc}/ssh/
sshkeys = $${rootdirectory:srv}/sshkeys
httpd-log = $${basedirectory:log}/apache/
[buildout]
extends = ${instance-apache-php:output}
${pbsready-export:output}
parts =
apache-proxy
logrotate
logrotate-entry-apache
cron
cron-entry-logrotate
sshkeys-authority
sshkeys-dropbear
dropbear-server
dropbear-server-pbs-authorized-key
[apache-proxy]
recipe = slapos.cookbook:apacheproxy
url = $${slap-parameter:proxy-url}
pid-file = $${basedirectory:run}/apache.pid
lock-file = $${basedirectory:run}/apache.lock
ip = $${slap-network-information:global-ipv6}
port = 8080
error-log = $${directory:httpd-log}/error.log
access-log = $${directory:httpd-log}/access.log
httpd-conf = $${rootdirectory:etc}/apache.conf
wrapper = $${basedirectory:services}/apache
promise = $${basedirectory:promises}/apache
httpd-binary = ${apache:location}/bin/httpd
#----------------
#--
#-- Creation of all needed directories.
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc
var = $${buildout:directory}/var
srv = $${buildout:directory}/srv
bin = $${buildout:directory}/bin
tmp = $${buildout:directory}/tmp
[basedirectory]
recipe = slapos.cookbook:mkdirectory
log = $${rootdirectory:var}/log
services = $${rootdirectory:etc}/run
run = $${rootdirectory:var}/run
backup = $${rootdirectory:srv}/backup
promises = $${rootdirectory:etc}/promise
[directory]
recipe = slapos.cookbook:mkdirectory
htdocs = $${rootdirectory:srv}/www
logrotate-entries = $${rootdirectory:etc}/logrotate.d
logrotate-backup = $${basedirectory:backup}/logrotate
cronstamps = $${rootdirectory:etc}/cronstamps
cron-entries = $${rootdirectory:etc}/cron.d
crontabs = $${rootdirectory:etc}/crontabs
ssh = $${rootdirectory:etc}/ssh
sshkeys = $${rootdirectory:srv}/sshkeys
httpd-log = $${basedirectory:log}/apache
#----------------
#--
#-- Deploy cron.
[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:wrapper}
binary = $${basedirectory:services}/crond
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = $${rootdirectory:bin}/cron_simplelogger
log = $${basedirectory:log}/crond.log
#----------------
#--
#-- Deploy logrotate.
[cron-entry-logrotate]
<= cron
recipe = slapos.cookbook:cron.d
name = logrotate
frequency = 0 0 * * *
command = $${logrotate:wrapper}
[logrotate]
recipe = slapos.cookbook:logrotate
# Binaries
logrotate-binary = ${logrotate:location}/usr/sbin/logrotate
gzip-binary = ${gzip:location}/bin/gzip
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-apache]
<= logrotate
recipe = slapos.cookbook:logrotate.d
name = apache
log = $${apache-proxy:error-log} $${apache-proxy:access-log}
frequency = daily
rotate-num = 30
sharedscripts = true
notifempty = true
create = true
#----------------
#--
#-- sshkeys
[sshkeys-directory]
recipe = slapos.cookbook:mkdirectory
requests = $${directory:sshkeys}/requests
keys = $${directory:sshkeys}/keys
[sshkeys-authority]
recipe = slapos.cookbook:sshkeys_authority
request-directory = $${sshkeys-directory:requests}
keys-directory = $${sshkeys-directory:keys}
wrapper = $${basedirectory:services}/sshkeys_authority
keygen-binary = ${dropbear:location}/bin/dropbearkey
[sshkeys-dropbear]
<= sshkeys-authority
recipe = slapos.cookbook:sshkeys_authority.request
name = dropbear
type = rsa
executable = $${dropbear-server:wrapper}
public-key = $${dropbear-server:rsa-keyfile}.pub
private-key = $${dropbear-server:rsa-keyfile}
wrapper = $${basedirectory:services}/sshd
#----------------
#--
#-- Dropbear.
[dropbear-server]
recipe = slapos.cookbook:dropbear
host = $${slap-network-information:global-ipv6}
port = 2222
home = $${directory:ssh}
wrapper = $${rootdirectory:bin}/raw_sshd
shell = $${rdiff-backup-server:wrapper}
rsa-keyfile = $${directory:ssh}/server_key.rsa
dropbear-binary = ${dropbear:location}/sbin/dropbear
[dropbear-server-pbs-authorized-key]
<= dropbear-server
recipe = slapos.cookbook:dropbear.add_authorized_key
key = $${slap-parameter:authorized-key}
#----------------
#--
#-- rdiff
[rdiff-backup-server]
recipe = slapos.cookbook:pbs
client = false
path = $${directory:htdocs}
wrapper = $${rootdirectory:bin}/rdiffbackup-server
rdiffbackup-binary = ${buildout:bin-directory}/rdiff-backup
...@@ -10,7 +10,8 @@ parts = ...@@ -10,7 +10,8 @@ parts =
cron-entry-logrotate cron-entry-logrotate
promise promise
slapmonitor slapmonitor
slapreport slapmonitor-xml
frontend-promise frontend-promise
content-promise content-promise
publish-connection-informations publish-connection-informations
...@@ -20,46 +21,98 @@ develop-eggs-directory = ${buildout:develop-eggs-directory} ...@@ -20,46 +21,98 @@ develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true offline = true
# Creation of all needed directories #----------------
#--
#-- Creation of all needed directories.
[rootdirectory] [rootdirectory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc/ etc = $${buildout:directory}/etc
var = $${buildout:directory}/var/ var = $${buildout:directory}/var
srv = $${buildout:directory}/srv/ srv = $${buildout:directory}/srv
bin = $${buildout:directory}/bin/ bin = $${buildout:directory}/bin
tmp = $${buildout:directory}/tmp/ tmp = $${buildout:directory}/tmp
[basedirectory] [basedirectory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
log = $${rootdirectory:var}/log/ log = $${rootdirectory:var}/log
services = $${rootdirectory:etc}/run/ services = $${rootdirectory:etc}/service
run = $${rootdirectory:var}/run/ run = $${rootdirectory:var}/run
backup = $${rootdirectory:srv}/backup/ backup = $${rootdirectory:srv}/backup
promises = $${rootdirectory:etc}/promise/ promises = $${rootdirectory:etc}/promise
[directory] [directory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
ca-dir = $${rootdirectory:srv}/ssl/ cron-entries = $${rootdirectory:etc}/cron.d
httpd-log = $${basedirectory:log}/apache/ crontabs = $${rootdirectory:etc}/crontabs
php-ini-dir = $${rootdirectory:etc}/php/ cronstamps = $${rootdirectory:etc}/cronstamps
tmp-php = $${rootdirectory:tmp}/php/ ca-dir = $${rootdirectory:srv}/ssl
logrotate-entries = $${rootdirectory:etc}/logrotate.d/ httpd-log = $${basedirectory:log}/apache
logrotate-backup = $${basedirectory:backup}/logrotate/ php-ini-dir = $${rootdirectory:etc}/php
stunnel-conf = $${rootdirectory:etc}/stunnel/ tmp-php = $${rootdirectory:tmp}/php
cronstamps = $${rootdirectory:etc}/cronstamps/ logrotate-entries = $${rootdirectory:etc}/logrotate.d
cron-entries = $${rootdirectory:etc}/cron.d/ logrotate-backup = $${basedirectory:backup}/logrotate
crontabs = $${rootdirectory:etc}/crontabs/ report = $${rootdirectory:etc}/report
stunnel-conf = $${rootdirectory:etc}/stunnel
xml-report = $${rootdirectory:var}/xml_report
[cadirectory] [cadirectory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
requests = $${directory:ca-dir}/requests/ requests = $${directory:ca-dir}/requests
private = $${directory:ca-dir}/private/ private = $${directory:ca-dir}/private
certs = $${directory:ca-dir}/certs/ certs = $${directory:ca-dir}/certs
newcerts = $${directory:ca-dir}/newcerts/ newcerts = $${directory:ca-dir}/newcerts
crl = $${directory:ca-dir}/crl/ crl = $${directory:ca-dir}/crl
#----------------
#--
#-- Deploy cron.
[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:wrapper}
binary = $${basedirectory:services}/crond
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = $${rootdirectory:bin}/cron_simplelogger
log = $${basedirectory:log}/crond.log
#----------------
#--
#-- Deploy logrotate.
[cron-entry-logrotate]
<= cron
recipe = slapos.cookbook:cron.d
name = logrotate
frequency = 0 0 * * *
command = $${logrotate:wrapper}
[logrotate]
recipe = slapos.cookbook:logrotate
# Binaries
logrotate-binary = ${logrotate:location}/usr/sbin/logrotate
gzip-binary = ${gzip:location}/bin/gzip
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
#----------------
#--
#-- Deploy stunnel.
# Deploy stunnel
[stunnel] [stunnel]
recipe = slapos.cookbook:stunnel recipe = slapos.cookbook:stunnel
client = true client = true
...@@ -76,8 +129,22 @@ pid-file = $${basedirectory:run}/stunnel.pid ...@@ -76,8 +129,22 @@ pid-file = $${basedirectory:run}/stunnel.pid
wrapper = $${rootdirectory:bin}/raw_stunnel wrapper = $${rootdirectory:bin}/raw_stunnel
post-rotate-script = $${rootdirectory:bin}/stunnel_post_rotate post-rotate-script = $${rootdirectory:bin}/stunnel_post_rotate
[logrotate-entry-stunnel]
<= logrotate
recipe = slapos.cookbook:logrotate.d
name = stunnel
log = $${stunnel:log-file}
frequency = daily
rotate-num = 30
notifempty = true
create = true
post = $${stunnel:post-rotate-script}
#----------------
#--
#-- Certificate stuff.
# Certificate stuffs
[certificate-authority] [certificate-authority]
recipe = slapos.cookbook:certificate_authority recipe = slapos.cookbook:certificate_authority
openssl-binary = ${openssl:location}/bin/openssl openssl-binary = ${openssl:location}/bin/openssl
...@@ -98,7 +165,10 @@ key-file = $${stunnel:key-file} ...@@ -98,7 +165,10 @@ key-file = $${stunnel:key-file}
cert-file = $${stunnel:cert-file} cert-file = $${stunnel:cert-file}
# Request MariaDB instance and parse its URL #----------------
#--
#-- Request MariaDB instance and parse its URL.
[request-mariadb] [request-mariadb]
<= slap-connection <= slap-connection
recipe = slapos.cookbook:request recipe = slapos.cookbook:request
...@@ -114,7 +184,10 @@ recipe = slapos.cookbook:urlparse ...@@ -114,7 +184,10 @@ recipe = slapos.cookbook:urlparse
url = $${request-mariadb:connection-url} url = $${request-mariadb:connection-url}
# Deploy Apache + PHP application #----------------
#--
#-- Deploy Apache + PHP application.
[apache-php] [apache-php]
recipe = slapos.cookbook:apachephp recipe = slapos.cookbook:apachephp
source = ${application:location} source = ${application:location}
...@@ -142,21 +215,6 @@ mysql-database = $${mariadb-urlparse:path} ...@@ -142,21 +215,6 @@ mysql-database = $${mariadb-urlparse:path}
mysql-host = $${stunnel:local-host} mysql-host = $${stunnel:local-host}
mysql-port = $${stunnel:local-port} mysql-port = $${stunnel:local-port}
# Deploy logrotate, cron, configure it
[logrotate]
recipe = slapos.cookbook:logrotate
# Binaries
logrotate-binary = ${logrotate:location}/usr/sbin/logrotate
gzip-binary = ${gzip:location}/bin/gzip
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-apache] [logrotate-entry-apache]
<= logrotate <= logrotate
recipe = slapos.cookbook:logrotate.d recipe = slapos.cookbook:logrotate.d
...@@ -168,40 +226,11 @@ sharedscripts = true ...@@ -168,40 +226,11 @@ sharedscripts = true
notifempty = true notifempty = true
create = true create = true
[logrotate-entry-stunnel]
<= logrotate
recipe = slapos.cookbook:logrotate.d
name = stunnel
log = $${stunnel:log-file}
frequency = daily
rotate-num = 30
notifempty = true
create = true
post = $${stunnel:post-rotate-script}
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = $${rootdirectory:bin}/cron_simplelogger
log = $${basedirectory:log}/crond.log
[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:wrapper}
binary = $${basedirectory:services}/crond
[cron-entry-logrotate] #----------------
<= cron #--
recipe = slapos.cookbook:cron.d #-- Request frontend.
name = logrotate
frequency = 0 0 * * *
command = $${logrotate:wrapper}
# Request frontend
[request-frontend] [request-frontend]
<= slap-connection <= slap-connection
recipe = slapos.cookbook:requestoptional recipe = slapos.cookbook:requestoptional
...@@ -215,37 +244,38 @@ return = site_url ...@@ -215,37 +244,38 @@ return = site_url
config-custom_domain = $${slap-parameter:domain} config-custom_domain = $${slap-parameter:domain}
# Deploy slapmonitor #----------------
#--
#-- Deploy slapmonitor.
[slapmonitor] [slapmonitor]
recipe = slapos.cookbook:slapmonitor recipe = slapos.cookbook:slapmonitor
pid-file = $${basedirectory:run}/apache.pid pid-file = $${basedirectory:run}/apache.pid
database-path = $${basedirectory:log}/slapmonitor.db database-path = $${basedirectory:log}/slapmonitor.db
shell-path = ${dash:location}/bin/dash
slapmonitor-path = ${buildout:bin-directory}/slapmonitor slapmonitor-path = ${buildout:bin-directory}/slapmonitor
path = $${basedirectory:services}/slapmonitor path = $${basedirectory:services}/slapmonitor
[slapreport] [slapmonitor-xml]
recipe = slapos.cookbook:slapreport recipe = slapos.cookbook:slapmonitor-xml
pid-file = $${basedirectory:run}/apache.pid
database-path = $${basedirectory:log}/slapmonitor.db database-path = $${basedirectory:log}/slapmonitor.db
consumption-log-path = $${basedirectory:log}/instance_consumption.log slapmonitor-xml-path = ${buildout:bin-directory}/slapmonitor-xml
logbox-ip = 87.98.152.12 path = $${directory:report}/slapmonitor-xml
logbox-port = 5122
logbox-user = admin
logbox-passwd = passer
shell-path = ${dash:location}/bin/dash
slapreport-path = ${buildout:bin-directory}/slapreport
path = $${basedirectory:services}/slapreport
# Publish all instance parameters (url of instance) #----------------
#--
#-- Publish instance parameters.
[publish-connection-informations] [publish-connection-informations]
recipe = slapos.cookbook:publish recipe = slapos.cookbook:publish
backend_url = $${apache-php:url} backend_url = $${apache-php:url}
url = $${request-frontend:connection-site_url} url = $${request-frontend:connection-site_url}
# Deploy promises scripts #----------------
#--
#-- Deploy promises scripts.
[promise] [promise]
recipe = slapos.cookbook:check_port_listening recipe = slapos.cookbook:check_port_listening
path = $${basedirectory:promises}/apache path = $${basedirectory:promises}/apache
...@@ -266,6 +296,9 @@ url = $${request-frontend:connection-site_url} ...@@ -266,6 +296,9 @@ url = $${request-frontend:connection-site_url}
dash_path = ${dash:location}/bin/dash dash_path = ${dash:location}/bin/dash
curl_path = ${curl:location}/bin/curl curl_path = ${curl:location}/bin/curl
[slap-parameter] [slap-parameter]
# Default value if no domain is specified # Default value if no domain is specified
domain = domain =
...@@ -274,3 +307,4 @@ logbox-ip = ...@@ -274,3 +307,4 @@ logbox-ip =
logbox-port = logbox-port =
logbox-user = logbox-user =
logbox-passwd = logbox-passwd =
[buildout] [buildout]
ignore-existing = true
parts = parts =
slapos-cookbook
apache-php apache-php
mariadb mariadb
mydumper mydumper
...@@ -7,15 +11,20 @@ parts = ...@@ -7,15 +11,20 @@ parts =
rdiff-backup rdiff-backup
dropbear dropbear
eggs eggs
instance-recipe-egg instance
template
template-apache-php instance-apache-php
template-mariadb instance-mariadb
template-mariadb-pbsready
template-mariadb-pbsready-import #Contains the importer and exporter recipes for mariadb
template-mariadb-pbsready-export instance-mariadb-import
instance-mariadb-export
instance-default-root
extends = extends =
../resilient/buildout.cfg
../../component/mariadb/buildout.cfg ../../component/mariadb/buildout.cfg
../../component/apache/buildout.cfg ../../component/apache/buildout.cfg
../../component/apache-php/buildout.cfg ../../component/apache-php/buildout.cfg
...@@ -42,83 +51,85 @@ extends = ...@@ -42,83 +51,85 @@ extends =
# Compile dir is for plugins, there's no plugin in LAMP # Compile dir is for plugins, there's no plugin in LAMP
keep-compile-dir = false keep-compile-dir = false
[instance-recipe]
egg = slapos.cookbook
module = lamp.request
[instance-recipe-egg]
recipe = zc.recipe.egg
eggs = ${instance-recipe:egg}
[application] [application]
recipe = hexagonit.recipe.download recipe = hexagonit.recipe.download
#If provided tarball does not containt top directory this option shall be changed to false # If the provided tarball does not contain top directory, this option should be changed to false
strip-top-level-dir = true strip-top-level-dir = true
[template]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg
output = ${buildout:directory}/template.cfg
md5sum = 8117f10e814a13c5376af4c01e6546d4
mode = 0644
[template-apache-php] #----------------
#-- Instance-level buildout profiles.
[instance]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-apache-php.cfg url = ${:_profile_base_location_}/instance.cfg.in
output = ${buildout:directory}/template-apache-php.cfg output = ${buildout:directory}/instance.cfg
md5sum = a5dd222b3faa4e1ef2df9b3b9bb47966 md5sum = 38bdcf0a8263d4a19bd6a35c0cd00340
mode = 0644 mode = 0644
[template-apache-backup] [instance-apache-php]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-apache-backup.cfg url = ${:_profile_base_location_}/apache/instance-apache-php.cfg.in
output = ${buildout:directory}/template-apache-backup.cfg output = ${buildout:directory}/instance-apache-php.cfg
md5sum = cfb77ac8785e0d125a785f69a5339014 md5sum = bf3219cd7d318e02e39c462fbb530715
mode = 0644 mode = 0644
[template-backuped] [instance-apache-backup]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-backuped.cfg url = ${:_profile_base_location_}/apache/instance-apache-backup.cfg.in
output = ${buildout:directory}/template-backuped.cfg output = ${buildout:directory}/instance-apache-backup.cfg
md5sum = f43d1c6412ea8dc83b75573dc00daf9e md5sum = 48f969d82319a9d145570f5f0fd27672
mode = 0644 mode = 0644
[template-mariadb] [template-resilient-lamp]
recipe = slapos.recipe.template recipe = slapos.recipe.template:jinja2
url = ${:_profile_base_location_}/instance-mariadb.cfg template = ${:_profile_base_location_}/template-resilient.cfg.in
output = ${buildout:directory}/template-mariadb.cfg rendered = ${buildout:directory}/instance-resilient.cfg
md5sum = 767452bc503ff6c1b7af0ebfac590c9f
context = key templateapache instance-apache-php:output
key dropbear dropbear:location
key buildout buildout:bin-directory
import-list = file parts template-parts:destination
file replicated template-replicated:destination
md5sum = 5605ad8896c2718854bf26148c4ae940
mode = 0644 mode = 0644
[template-mariadb-pbsready] [instance-mariadb]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-mariadb-pbsready.cfg url = ${:_profile_base_location_}/mariadb/instance-mariadb.cfg.in
output = ${buildout:directory}/template-mariadb-pbsready.cfg output = ${buildout:directory}/instance-mariadb.cfg
md5sum = d2a580dcd7efdd528be45c5ffadfe760 md5sum = fafb873323c0084c522360f94ebe1df7
mode = 0644 mode = 0644
[template-mariadb-pbsready-import] [instance-mariadb-import]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-mariadb-pbsready-import.cfg url = ${:_profile_base_location_}/mariadb/instance-mariadb-import.cfg.in
output = ${buildout:directory}/template-mariadb-pbsready-import.cfg output = ${buildout:directory}/instance-mariadb-import.cfg
md5sum = 4a96ff02da3898fef7077fa8baec81ac md5sum = 8009627bb669d1fee0df030daa8d3bdc
mode = 0644 mode = 0644
[template-mariadb-pbsready-export] [instance-mariadb-export]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-mariadb-pbsready-export.cfg url = ${:_profile_base_location_}/mariadb/instance-mariadb-export.cfg.in
output = ${buildout:directory}/template-mariadb-pbsready-export.cfg output = ${buildout:directory}/instance-mariadb-export.cfg
md5sum = 11a9e45e8bc590bc11bfdd304b07a4a5 md5sum = 0513bf25fbb20cccd57f285c40d96498
mode = 0644 mode = 0644
[template-pull-backup]
[instance-default-root]
recipe = slapos.recipe.template recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-pull-backup.cfg url = ${:_profile_base_location_}/instance-default-root.cfg.in
output = ${buildout:directory}/template-pull-backup.cfg output = ${buildout:directory}/instance-default-root.cfg
md5sum = 9aab30ba5aa23a37d4b507e7c414be00 md5sum = 53c9020f7a0b5203f976e069e455787b
mode = 0644 mode = 0644
# Dummy parts in case no application configuration file is needed
#----------------
#-- Dummy parts in case no application configuration file is needed
[application-template] [application-template]
filename = filename =
location = location =
...@@ -126,6 +137,8 @@ location = ...@@ -126,6 +137,8 @@ location =
[application-configuration] [application-configuration]
location = location =
#----------------
[eggs] [eggs]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = eggs =
...@@ -142,7 +155,7 @@ eggs = ...@@ -142,7 +155,7 @@ eggs =
# Cedric de Saint Martin # Cedric de Saint Martin
# Yingjie Xu # Yingjie Xu
# Gabriel Monnerat # Gabriel Monnerat
# Łukasz Nowak # Łukasz Nowak
# Test Agent Signature # Test Agent Signature
# Alain Takoudjou # Alain Takoudjou
signature-certificate-list = signature-certificate-list =
...@@ -264,103 +277,82 @@ signature-certificate-list = ...@@ -264,103 +277,82 @@ signature-certificate-list =
n9MuhWaT21VOYhIGzJFPw5XW47/RrwhR n9MuhWaT21VOYhIGzJFPw5XW47/RrwhR
-----END CERTIFICATE----- -----END CERTIFICATE-----
[versions] [versions]
Jinja2 = 2.6 Jinja2 = 2.6
Werkzeug = 0.8.3 Werkzeug = 0.8.3
apache-libcloud = 0.11.1 apache-libcloud = 0.11.4
async = 0.6.1 async = 0.6.1
buildout-versions = 1.7 buildout-versions = 1.7
gitdb = 0.5.4 gitdb = 0.5.4
hexagonit.recipe.cmmi = 1.6 hexagonit.recipe.cmmi = 1.6
meld3 = 0.6.8 inotifyx = 0.2.0
lxml = 3.0.2
meld3 = 0.6.10
netaddr = 0.7.10
pycrypto = 2.6 pycrypto = 2.6
pytz = 2012h
rdiff-backup = 1.0.5 rdiff-backup = 1.0.5
slapos.cookbook = 0.66 slapos.recipe.build = 0.11.5
slapos.libnetworkcache = 0.13.2
slapos.recipe.build = 0.11.2
slapos.recipe.download = 1.0.dev-r4053 slapos.recipe.download = 1.0.dev-r4053
slapos.recipe.template = 2.4.2 slapos.recipe.template = 2.4.2
slapos.toolbox = 0.30
smmap = 0.8.2 smmap = 0.8.2
# Required by: # Required by:
# slapos.core==0.28.5 # slapos.core==0.33.2-dev
# slapos.toolbox==0.30 # slapos.toolbox==0.32.1-dev
Flask = 0.9 Flask = 0.9
# Required by: # Required by:
# slapos.toolbox==0.30 # slapos.toolbox==0.32.1-dev
GitPython = 0.3.2.RC1 GitPython = 0.3.2.RC1
# Required by: # Required by:
# slapos.cookbook==0.66 # slapos.toolbox==0.32.1-dev
PyXML = 0.8.4
# Required by:
# slapos.toolbox==0.30
atomize = 0.1.1 atomize = 0.1.1
# Required by: # Required by:
# slapos.toolbox==0.30 # slapos.toolbox==0.32.1-dev
feedparser = 5.1.2 feedparser = 5.1.3
# Required by: # Required by:
# hexagonit.recipe.cmmi==1.6 # hexagonit.recipe.cmmi==1.6
hexagonit.recipe.download = 1.5.1 hexagonit.recipe.download = 1.6
# Required by:
# slapos.cookbook==0.66
inotifyx = 0.2.0
# Required by: # Required by:
# slapos.cookbook==0.66 # slapos.core==0.33.2-dev
# slapos.core==0.28.5
# xml-marshaller==0.9.7
lxml = 3.0alpha2
# Required by:
# slapos.cookbook==0.66
netaddr = 0.7.10
# Required by:
# slapos.core==0.28.5
netifaces = 0.8 netifaces = 0.8
# Required by: # Required by:
# slapos.toolbox==0.30 # slapos.toolbox==0.32.1-dev
paramiko = 1.7.7.2 paramiko = 1.9.0
# Required by: # Required by:
# slapos.toolbox==0.30 # slapos.toolbox==0.32.1-dev
psutil = 0.6.1 psutil = 0.6.1
# Required by: # Required by:
# slapos.cookbook==0.66 # slapos.core==0.33.2-dev
# slapos.core==0.28.5 pyflakes = 0.5.0
# slapos.toolbox==0.30
# zc.buildout==1.6.0-dev-SlapOS-006
# zc.recipe.egg==1.3.2
setuptools = 0.6c12dev-r88846
# Required by: # Required by:
# slapos.cookbook==0.66 # slapos.cookbook==0.70.1-dev
# slapos.toolbox==0.30 # slapos.core==0.33.2-dev
slapos.core = 0.28.5 # slapos.toolbox==0.32.1-dev
# supervisor==3.0b1
# zc.buildout==1.6.0-dev-SlapOS-010
# zope.interface==4.0.2
setuptools = 0.6c12dev-r88846
# Required by: # Required by:
# slapos.core==0.28.5 # slapos.core==0.33.2-dev
supervisor = 3.0a12 supervisor = 3.0b1
# Required by: # Required by:
# slapos.cookbook==0.66 # slapos.toolbox==0.32.1-dev
# slapos.toolbox==0.30
xml-marshaller = 0.9.7 xml-marshaller = 0.9.7
# Required by: # Required by:
# slapos.cookbook==0.66 # slapos.core==0.33.2-dev
zc.recipe.egg = 1.3.2 zope.interface = 4.0.2
# Required by:
# slapos.core==0.28.5
zope.interface = 4.0.1
[buildout]
extends =
${template-apache-php:output}
parts =
request-mariadb
request-mariadb-pseudo-replicating
request-apache-backup
request-pull-backup-server
request-pull-backup-server-mariadb
request-pull-backup-server-mariadb-backup
request-pull-backup-server-apache
request-pull-backup-server-apache-backup
url
apache-php
stunnel
certificate-authority
ca-stunnel
logrotate
logrotate-entry-apache
logrotate-entry-stunnel
cron
cron-entry-logrotate
dropbear-server
sshkeys-authority
dropbear-server-pbs-authorized-key
[sshkeys-directory]
recipe = slapos.cookbook:mkdirectory
requests = $${directory:sshkeys}/requests/
keys = $${directory:sshkeys}/keys/
[sshkeys-authority]
recipe = slapos.cookbook:sshkeys_authority
request-directory = $${sshkeys-directory:requests}
keys-directory = $${sshkeys-directory:keys}
wrapper = $${basedirectory:services}/sshkeys_authority
keygen-binary = ${dropbear:location}/bin/dropbearkey
[sshkeys-dropbear]
<= sshkeys-authority
recipe = slapos.cookbook:sshkeys_authority.request
name = dropbear
type = rsa
executable = $${dropbear-server:wrapper}
public-key = $${dropbear-server:rsa-keyfile}.pub
private-key = $${dropbear-server:rsa-keyfile}
wrapper = $${basedirectory:services}/sshd
[dropbear-server]
recipe = slapos.cookbook:dropbear
host = $${slap-network-information:global-ipv6}
port = 2222
home = $${directory:ssh}
wrapper = $${rootdirectory:bin}/raw_sshd
shell = $${rdiff-backup-server:wrapper}
rsa-keyfile = $${directory:ssh}/server_key.rsa
dropbear-binary = ${dropbear:location}/sbin/dropbear
[dropbear-server-pbs-authorized-key]
<= dropbear-server
recipe = slapos.cookbook:dropbear.add_authorized_key
key = $${request-pull-backup-server:connection-ssh-key}
[rdiff-backup-server]
recipe = slapos.cookbook:pbs
client = false
path = $${directory:htdocs}
wrapper = $${rootdirectory:bin}/rdiffbackup-server
rdiffbackup-binary = ${buildout:bin-directory}/rdiff-backup
[request-pull-backup-server]
<= slap-connection
recipe = slapos.cookbook:request
name = PBS (Pull Backup Server)
software-url = $${slap-connection:software-release-url}
software-type = pull-backup
return = ssh-key notification-url feeds-url
slave = false
[request-mariadb]
software-type = mariadb-pbsready-export
config = authorized-key notify
config-authorized-key = $${request-pull-backup-server:connection-ssh-key}
config-notify = $${request-pull-backup-server:connection-notification-url}
return = url ssh-public-key ssh-url notification-id
[request-mariadb-pseudo-replicating]
<= slap-connection
recipe = slapos.cookbook:request
name = MariaDB Backup
software-url = $${slap-connection:software-release-url}
software-type = mariadb-pbsready-import
return = url ssh-public-key ssh-url notification-url
config = authorized-key on-notification
config-authorized-key = $${request-pull-backup-server:connection-ssh-key}
pbs-notification-id = $${slap-connection:computer-id}-$${slap-connection:partition-id}-mariadb-push
config-on-notification = $${request-pull-backup-server:connection-feeds-url}$${:pbs-notification-id}
[request-apache-backup]
<= slap-connection
recipe = slapos.cookbook:request
name = Apache Backup
software-url = $${slap-connection:software-release-url}
software-type = apache-backup
return = url ssh-url ssh-public-key
config = authorized-key proxy-url
config-authorized-key = $${request-pull-backup-server:connection-ssh-key}
config-proxy-url = $${url:url}
[request-pull-backup-server-apache]
<= request-pull-backup-server
slap-connection
recipe = slapos.cookbook:request
name = PBS pulling from Apache
software-url = $${slap-connection:software-release-url}
config = url name type server-key notify notification-id frequency
config-url = ssh://nobody@[$${dropbear-server:host}]:$${dropbear-server:port}/$${rdiff-backup-server:path}
config-name = $${slap-connection:computer-id}-$${slap-connection:partition-id}-apache
config-type = pull
config-server-key = $${sshkeys-dropbear:public-key-value}
config-notify = $${request-pull-backup-server:connection-notification-url}
config-notification-id = $${slap-connection:computer-id}-$${slap-connection:partition-id}-apache-pull
config-frequency = 30 * * * *
slave = true
[request-pull-backup-server-apache-backup]
<= request-pull-backup-server
slap-connection
recipe = slapos.cookbook:request
name = PBS pushing to $${request-apache-backup:name}
software-url = $${slap-connection:software-release-url}
config = url name type server-key on-notification
config-url = $${request-apache-backup:connection-ssh-url}
config-name = $${request-pull-backup-server-apache:config-name}
config-type = push
config-server-key = $${request-apache-backup:connection-ssh-public-key}
config-on-notification = $${request-pull-backup-server:connection-feeds-url}$${request-pull-backup-server-apache:config-notification-id}
slave = true
[request-pull-backup-server-mariadb]
<= request-pull-backup-server
slap-connection
name = PBS pulling from $${request-mariadb:name}
config = url name type server-key on-notification notify notification-id title
config-url = $${request-mariadb:connection-ssh-url}
config-name = $${slap-connection:computer-id}-$${slap-connection:partition-id}-mariadb
config-type = pull
config-server-key = $${request-mariadb:connection-ssh-public-key}
config-on-notification = $${request-mariadb:connection-notification-id}
config-notify = $${request-pull-backup-server:connection-notification-url}
config-notification-id = $${slap-connection:computer-id}-$${slap-connection:partition-id}-mariadb-pull
config-title = Pulling from MariaDB
slave = true
[request-pull-backup-server-mariadb-backup]
<= request-pull-backup-server
slap-connection
name = PBS pushing on $${request-mariadb-pseudo-replicating:name}
config = url name type server-key on-notification notify notification-id title
config-url = $${request-mariadb-pseudo-replicating:connection-ssh-url}
config-name = $${request-pull-backup-server-mariadb:config-name}
config-type = push
config-server-key = $${request-mariadb-pseudo-replicating:connection-ssh-public-key}
config-on-notification = $${request-pull-backup-server:connection-feeds-url}$${request-pull-backup-server-mariadb:config-notification-id}
config-notify = $${request-mariadb-pseudo-replicating:connection-notification-url}
config-notification-id = $${request-mariadb-pseudo-replicating:pbs-notification-id}
config-title = Pushing to MariaDB backup
slave = true
[directory]
ssh = $${rootdirectory:etc}/ssh/
sshkeys = $${rootdirectory:srv}/sshkeys
[buildout]
parts = request-apache
[request-apache]
<= slap-connection
recipe = slapos.cookbook:request
software-url = $${slap-connection:software-release-url}
software-type = apache
name = Apache
[buildout]
extends = ${template-mariadb-pbsready:output}
parts += cron-entry-mariadb-backup
[urls]
notification-id = http://[$${notifier:host}]:$${notifier:port}/get/$${notifier-mydumper:name}
[mydumper]
recipe = slapos.cookbook:mydumper
wrapper = $${rootdirectory:bin}/raw_mydumper
backup-directory = $${directory:mariadb-backup}
socket = $${mariadb:socket}
user = root
mydumper-binary = ${mydumper:location}/bin/mydumper
database = $${mariadb:database}
import = false
[notifier-mydumper]
<= notifier
recipe = slapos.cookbook:notifier.notify
name = mydumper
title = Dumping MariaDB Database
executable = $${mydumper:wrapper}
wrapper = $${rootdirectory:bin}/mydumper
notify = $${slap-parameter:notify}
[cron-entry-mariadb-backup]
<= cron
recipe = slapos.cookbook:cron.d
name = backup
frequency = 0 * * * *
command = $${notifier-mydumper:wrapper}
[buildout]
parts =
switch_softwaretype
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
[switch_softwaretype]
recipe = slapos.cookbook:softwaretype
default = ${instance-apache-php:output}
resilient = ${template-resilient-lamp:rendered}
mariadb = ${instance-mariadb:output}
mariadb-import = ${instance-mariadb-import:output}
mariadb-export = ${instance-mariadb-export:output}
apache-backup = ${instance-apache-backup:output}
# To prepend an empty root instance:
#default = ${instance-default-root:output}
#apache = ${instance-apache-php:output}
#frozen creates a syntax error, meaning it can keep its data.
#It's dirty as hell, it needs to be replaced.
frozen = ${instance-frozen:output}
pull-backup = ${template-pull-backup:output}
[buildout]
extends = ${instance-mariadb:output}
${pbsready-export:output}
parts +=
mariadb
# have to repeat the next one, as it's not inherited from pbsready-export
cron-entry-backup
[exporter]
recipe = slapos.cookbook:mydumper
wrapper = $${rootdirectory:bin}/$${slap-parameter:namebase}-exporter
backup-directory = $${directory:backup}
socket = $${mariadb:socket}
user = root
mydumper-binary = ${mydumper:location}/bin/mydumper
database = $${mariadb:database}
import = false
[buildout] [buildout]
extends = ${instance-mariadb:output}
${pbsready-import:output}
extends = ${template-mariadb-pbsready:output}
parts += mariadb-import-on-notification parts +=
mariadb
[urls] # have to repeat the next one, as it's not inherited from pbsready-import
notification-url = http://[$${notifier:host}]:$${notifier:port}/notify import-on-notification
[mydumper-import] [importer]
recipe = slapos.cookbook:mydumper recipe = slapos.cookbook:mydumper
wrapper = $${rootdirectory:bin}/myloader wrapper = $${rootdirectory:bin}/myloader
backup-directory = $${directory:mariadb-backup} backup-directory = $${directory:backup}
socket = $${mariadb:socket} socket = $${mariadb:socket}
user = root user = root
myloader-binary = ${mydumper:location}/bin/myloader myloader-binary = ${mydumper:location}/bin/myloader
database = $${mariadb:database} database = $${mariadb:database}
import = true import = true
[mariadb-import-on-notification]
<= notifier
recipe = slapos.cookbook:notifier.callback
on-notification-id = $${slap-parameter:on-notification}
callback = $${mydumper-import:wrapper}
...@@ -12,109 +12,80 @@ parts = ...@@ -12,109 +12,80 @@ parts =
cron cron
cron-entry-logrotate cron-entry-logrotate
slapmonitor slapmonitor
slapreport slapmonitor-xml
gzip-binary = ${gzip:location}/bin/gzip gzip-binary = ${gzip:location}/bin/gzip
# Define egg directories to be the one from Software Release
# (/opt/slapgrid/...)
eggs-directory = ${buildout:eggs-directory} eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory} develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true offline = true
[urls]
recipe = slapos.cookbook:publish
url = mysqls://$${mariadb:user}:$${mariadb:password}@[$${stunnel:remote-host}]:$${stunnel:remote-port}/$${mariadb:database}
[mariadb] #----------------
recipe = slapos.cookbook:mysql #--
#-- Creation of all needed directories.
# Options
recovering = false
user = user
port = 3306
ip = $${slap-network-information:local-ipv4}
database = db
# Paths [rootdirectory]
wrapper = $${basedirectory:services}/mariadb recipe = slapos.cookbook:mkdirectory
update-wrapper = $${basedirectory:services}/mariadb_update etc = $${buildout:directory}/etc
logrotate-post = $${rootdirectory:bin}/mariadb_post_logrotate var = $${buildout:directory}/var
data-directory = $${directory:mariadb-data} srv = $${buildout:directory}/srv
pid-file = $${basedirectory:run}/mariadb.pid bin = $${buildout:directory}/bin
socket = $${basedirectory:run}/mariadb.sock
error-log = $${basedirectory:log}/mariadb_error.log
conf-file = $${rootdirectory:etc}/mariadb.cnf
promise = $${basedirectory:promises}/mysql
# Binary information [basedirectory]
mysql-base-directory = ${mariadb:location} recipe = slapos.cookbook:mkdirectory
mysql-binary = ${mariadb:location}/bin/mysql log = $${rootdirectory:var}/log
mysql-install-binary = ${mariadb:location}/scripts/mysql_install_db services = $${rootdirectory:etc}/service
mysql-upgrade-binary = ${mariadb:location}/bin/mysql_upgrade run = $${rootdirectory:var}/run
mysqld-binary = ${mariadb:location}/bin/mysqld script = $${rootdirectory:etc}/script
backup = $${rootdirectory:srv}/backup
promises = $${rootdirectory:etc}/promise
[slapmonitor] [directory]
recipe = slapos.cookbook:slapmonitor recipe = slapos.cookbook:mkdirectory
pid-file = $${basedirectory:run}/mariadb.pid cron-entries = $${rootdirectory:etc}/cron.d
database-path = $${basedirectory:log}/slapmonitor.db crontabs = $${rootdirectory:etc}/crontabs
shell-path = ${dash:location}/bin/dash cronstamps = $${rootdirectory:etc}/cronstamps
slapmonitor-path = ${buildout:bin-directory}/slapmonitor ca-dir = $${rootdirectory:srv}/ssl
path = $${basedirectory:services}/slapmonitor mariadb-data = $${rootdirectory:srv}/mariadb
logrotate-entries = $${rootdirectory:etc}/logrotate.d
logrotate-backup = $${basedirectory:backup}/logrotate
report = $${rootdirectory:etc}/report
stunnel-conf = $${rootdirectory:etc}/stunnel
xml-report = $${rootdirectory:var}/xml_report
#----------------
#--
#-- Deploy cron.
[slapreport] [cron]
recipe = slapos.cookbook:slapreport recipe = slapos.cookbook:cron
pid-file = $${basedirectory:run}/mariadb.pid dcrond-binary = ${dcron:location}/sbin/crond
consumption-log-path = $${basedirectory:log}/instance_consumption.log cron-entries = $${directory:cron-entries}
database-path = $${basedirectory:log}/slapmonitor.db crontabs = $${directory:crontabs}
logbox-ip = 87.98.152.12 cronstamps = $${directory:cronstamps}
logbox-port = 5122 catcher = $${cron-simplelogger:wrapper}
logbox-user = admin binary = $${basedirectory:services}/crond
logbox-passwd = passer
shell-path = ${dash:location}/bin/dash
slapreport-path = ${buildout:bin-directory}/slapreport
path = $${basedirectory:services}/slapreport
[certificate-authority] [cron-simplelogger]
recipe = slapos.cookbook:certificate_authority recipe = slapos.cookbook:simplelogger
openssl-binary = ${openssl:location}/bin/openssl wrapper = $${rootdirectory:bin}/cron_simplelogger
ca-dir = $${directory:ca-dir} log = $${basedirectory:log}/crond.log
requests-directory = $${cadirectory:requests}
wrapper = $${basedirectory:services}/ca
ca-private = $${cadirectory:private}
ca-certs = $${cadirectory:certs}
ca-newcerts = $${cadirectory:newcerts}
ca-crl = $${cadirectory:crl}
[cadirectory]
recipe = slapos.cookbook:mkdirectory
requests = $${directory:ca-dir}/requests/
private = $${directory:ca-dir}/private/
certs = $${directory:ca-dir}/certs/
newcerts = $${directory:ca-dir}/newcerts/
crl = $${directory:ca-dir}/crl/
[ca-stunnel] #----------------
<= certificate-authority #--
recipe = slapos.cookbook:certificate_authority.request #-- Deploy logrotate.
executable = $${stunnel:wrapper}
wrapper = $${basedirectory:services}/stunnel
key-file = $${stunnel:key-file}
cert-file = $${stunnel:cert-file}
[stunnel] [cron-entry-logrotate]
recipe = slapos.cookbook:stunnel <= cron
stunnel-binary = ${stunnel:location}/bin/stunnel recipe = slapos.cookbook:cron.d
wrapper = $${rootdirectory:bin}/stunnel name = logrotate
log-file = $${basedirectory:log}/stunnel.log frequency = 0 0 * * *
config-file = $${directory:stunnel-conf}/stunnel.conf command = $${logrotate:wrapper}
key-file = $${directory:stunnel-conf}/stunnel.key
cert-file = $${directory:stunnel-conf}/stunnel.crt
pid-file = $${basedirectory:run}/stunnel.pid
local-host = $${mariadb:ip}
local-port = $${mariadb:port}
remote-host = $${slap-network-information:global-ipv6}
remote-port = 6446
client = false
post-rotate-script = $${rootdirectory:bin}/stunnel_post_rotate
[logrotate] [logrotate]
recipe = slapos.cookbook:logrotate recipe = slapos.cookbook:logrotate
...@@ -162,52 +133,119 @@ rotate-num = 30 ...@@ -162,52 +133,119 @@ rotate-num = 30
notifempty = true notifempty = true
create = true create = true
[cron] #----------------
recipe = slapos.cookbook:cron #--
dcrond-binary = ${dcron:location}/sbin/crond #-- Deploy stunnel.
cron-entries = $${directory:cron-entries}
crontabs = $${directory:crontabs}
cronstamps = $${directory:cronstamps}
catcher = $${cron-simplelogger:wrapper}
binary = $${basedirectory:services}/crond
[cron-simplelogger] [stunnel]
recipe = slapos.cookbook:simplelogger recipe = slapos.cookbook:stunnel
wrapper = $${rootdirectory:bin}/cron_simplelogger stunnel-binary = ${stunnel:location}/bin/stunnel
log = $${basedirectory:log}/crond.log wrapper = $${rootdirectory:bin}/stunnel
log-file = $${basedirectory:log}/stunnel.log
config-file = $${directory:stunnel-conf}/stunnel.conf
key-file = $${directory:stunnel-conf}/stunnel.key
cert-file = $${directory:stunnel-conf}/stunnel.crt
pid-file = $${basedirectory:run}/stunnel.pid
local-host = $${mariadb:ip}
local-port = $${mariadb:port}
remote-host = $${slap-network-information:global-ipv6}
remote-port = 6446
client = false
post-rotate-script = $${rootdirectory:bin}/stunnel_post_rotate
[cron-entry-logrotate]
<= cron
recipe = slapos.cookbook:cron.d
name = logrotate
frequency = 0 0 * * *
command = $${logrotate:wrapper}
[rootdirectory] #----------------
recipe = slapos.cookbook:mkdirectory #--
etc = $${buildout:directory}/etc/ #-- Certificate stuff.
var = $${buildout:directory}/var/
srv = $${buildout:directory}/srv/
bin = $${buildout:directory}/bin/
[basedirectory] [certificate-authority]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:certificate_authority
log = $${rootdirectory:var}/log/ openssl-binary = ${openssl:location}/bin/openssl
services = $${rootdirectory:etc}/run/ ca-dir = $${directory:ca-dir}
run = $${rootdirectory:var}/run/ requests-directory = $${cadirectory:requests}
backup = $${rootdirectory:srv}/backup/ wrapper = $${basedirectory:services}/ca
promises = $${rootdirectory:etc}/promise/ ca-private = $${cadirectory:private}
ca-certs = $${cadirectory:certs}
ca-newcerts = $${cadirectory:newcerts}
ca-crl = $${cadirectory:crl}
[directory] [cadirectory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
cron-entries = $${rootdirectory:etc}/cron.d/ requests = $${directory:ca-dir}/requests/
crontabs = $${rootdirectory:etc}/crontabs/ private = $${directory:ca-dir}/private/
cronstamps = $${rootdirectory:etc}/cronstamps/ certs = $${directory:ca-dir}/certs/
ca-dir = $${rootdirectory:srv}/ssl/ newcerts = $${directory:ca-dir}/newcerts/
mariadb-data = $${rootdirectory:srv}/mariadb/ crl = $${directory:ca-dir}/crl/
logrotate-backup = $${basedirectory:backup}/logrotate/
stunnel-conf = $${rootdirectory:etc}/stunnel/ [ca-stunnel]
logrotate-entries = $${rootdirectory:etc}/logrotate.d/ <= certificate-authority
recipe = slapos.cookbook:certificate_authority.request
executable = $${stunnel:wrapper}
wrapper = $${basedirectory:services}/stunnel
key-file = $${stunnel:key-file}
cert-file = $${stunnel:cert-file}
#----------------
#--
#-- Creates a MariaDB configuration file, and a 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
logrotate-post = $${rootdirectory:bin}/mariadb_post_logrotate
data-directory = $${directory:mariadb-data}
pid-file = $${basedirectory:run}/mariadb.pid
socket = $${basedirectory:run}/mariadb.sock
error-log = $${basedirectory:log}/mariadb_error.log
conf-file = $${rootdirectory:etc}/mariadb.cnf
promise = $${basedirectory:promises}/mysql
# Binary information
mysql-base-directory = ${mariadb:location}
mysql-binary = ${mariadb:location}/bin/mysql
mysql-install-binary = ${mariadb:location}/scripts/mysql_install_db
mysql-upgrade-binary = ${mariadb:location}/bin/mysql_upgrade
mysqld-binary = ${mariadb:location}/bin/mysqld
#----------------
#--
#-- Deploy slapmonitor.
[slapmonitor]
recipe = slapos.cookbook:slapmonitor
pid-file = $${basedirectory:run}/mariadb.pid
database-path = $${basedirectory:log}/slapmonitor.db
slapmonitor-path = ${buildout:bin-directory}/slapmonitor
path = $${basedirectory:services}/slapmonitor
[slapmonitor-xml]
recipe = slapos.cookbook:slapmonitor-xml
database-path = $${basedirectory:log}/slapmonitor.db
slapmonitor-xml-path = ${buildout:bin-directory}/slapmonitor-xml
path = $${directory:report}/slapmonitor-xml
#----------------
#--
#-- Publish instance parameters.
[urls]
recipe = slapos.cookbook:publish
url = mysqls://$${mariadb:user}:$${mariadb:password}@[$${stunnel:remote-host}]:$${stunnel:remote-port}/$${mariadb:database}
ip = $${slap-network-information:global-ipv6}
[slap-parameter] [slap-parameter]
#Default value if no ssh parameters specified #Default value if no ssh parameters specified
......
{% import 'parts' as parts %}
{% import 'replicated' as replicated %}
[buildout]
extends =
{{templateapache}}
# += because we need to take up parts (like instance-custom, slapmonitor etc) from the profile we extended
parts +=
{{ parts.replicate("mariadb","3") }}
request-apache-backup-1
request-apache-backup-2
request-pull-backup-server-apache-1
request-pull-backup-server-apache-backup-1
request-pull-backup-server-apache-2
request-pull-backup-server-apache-backup-2
publish-connection-informations
apache-php
stunnel
certificate-authority
ca-stunnel
logrotate
logrotate-entry-apache
logrotate-entry-stunnel
cron
cron-entry-logrotate
dropbear-server
sshkeys-authority
dropbear-server-pbs-authorized-key
request-pull-backup-server
{{ replicated.replicate("mariadb", "3", "mariadb-export", "mariadb-import") }}
[request-pull-backup-server]
<= request-pbs-common
name = PBS (Pull Backup Server)
return = ssh-key notification-url feeds-url
slave = false
[sshkeys-directory]
recipe = slapos.cookbook:mkdirectory
requests = ${directory:sshkeys}/requests
keys = ${directory:sshkeys}/keys
[sshkeys-authority]
recipe = slapos.cookbook:sshkeys_authority
request-directory = ${sshkeys-directory:requests}
keys-directory = ${sshkeys-directory:keys}
wrapper = ${basedirectory:services}/sshkeys_authority
keygen-binary = {{dropbear}}/bin/dropbearkey
[sshkeys-dropbear]
<= sshkeys-authority
recipe = slapos.cookbook:sshkeys_authority.request
name = dropbear
type = rsa
executable = ${dropbear-server:wrapper}
public-key = ${dropbear-server:rsa-keyfile}.pub
private-key = ${dropbear-server:rsa-keyfile}
wrapper = ${basedirectory:services}/sshd
[dropbear-server]
recipe = slapos.cookbook:dropbear
host = ${slap-network-information:global-ipv6}
port = 2222
home = ${directory:ssh}
wrapper = ${rootdirectory:bin}/raw_sshd
shell = ${rdiff-backup-server:wrapper}
rsa-keyfile = ${directory:ssh}/server_key.rsa
dropbear-binary = {{dropbear}}/sbin/dropbear
[dropbear-server-pbs-authorized-key]
<= dropbear-server
recipe = slapos.cookbook:dropbear.add_authorized_key
key = ${request-pull-backup-server:connection-ssh-key}
[rdiff-backup-server]
<= apache-php
recipe = slapos.cookbook:pbs
client = false
path = ${apache-php:htdocs}
wrapper = ${rootdirectory:bin}/rdiffbackup-server
rdiffbackup-binary = {{buildout}}/rdiff-backup
[request-apache-backup-1]
<= slap-connection
recipe = slapos.cookbook:request
name = Apache Backup 1
software-url = ${slap-connection:software-release-url}
software-type = apache-backup
return = url ssh-url ssh-public-key
config = authorized-key proxy-url
config-authorized-key = ${request-pull-backup-server:connection-ssh-key}
config-proxy-url = ${publish-connection-informations:url}
[request-apache-backup-2]
<= slap-connection
recipe = slapos.cookbook:request
name = Apache Backup 2
software-url = ${slap-connection:software-release-url}
software-type = apache-backup
return = url ssh-url ssh-public-key
config = authorized-key proxy-url
config-authorized-key = ${request-pull-backup-server:connection-ssh-key}
config-proxy-url = ${publish-connection-informations:url}
[request-pull-backup-server-apache-1]
<= request-pbs-common
name = PBS pulling from Apache 1
config = url name type server-key notify notification-id frequency
config-url = ssh://nobody@[${dropbear-server:host}]:${dropbear-server:port}/${rdiff-backup-server:path}
config-name = ${slap-connection:computer-id}-${slap-connection:partition-id}-apache
config-type = pull
config-server-key = ${sshkeys-dropbear:public-key-value}
config-notify = ${request-pull-backup-server:connection-notification-url}
config-notification-id = ${slap-connection:computer-id}-${slap-connection:partition-id}-apache-pull
config-frequency = 30 * * * *
slave = true
sla = instance_guid
sla-instance_guid = ${request-pull-backup-server:instance_guid}
[request-pull-backup-server-apache-2]
<= request-pbs-common
name = PBS pulling from Apache 2
config = url name type server-key notify notification-id frequency
config-url = ssh://nobody@[${dropbear-server:host}]:${dropbear-server:port}/${rdiff-backup-server:path}
config-name = ${slap-connection:computer-id}-${slap-connection:partition-id}-apache
config-type = pull
config-server-key = ${sshkeys-dropbear:public-key-value}
config-notify = ${request-pull-backup-server:connection-notification-url}
config-notification-id = ${slap-connection:computer-id}-${slap-connection:partition-id}-apache-pull
config-frequency = 30 * * * *
slave = true
sla = instance_guid
sla-instance_guid = ${request-pull-backup-server:instance_guid}
[request-pull-backup-server-apache-backup-1]
<= request-pbs-common
name = PBS pushing to ${request-apache-backup-1:name}
config = url name type server-key on-notification
config-url = ${request-apache-backup-1:connection-ssh-url}
config-name = ${request-pull-backup-server-apache-1:config-name}
config-type = push
config-server-key = ${request-apache-backup-1:connection-ssh-public-key}
config-on-notification = ${request-pull-backup-server:connection-feeds-url}${request-pull-backup-server-apache-1:config-notification-id}
slave = true
sla = instance_guid
sla-instance_guid = ${request-pull-backup-server:instance_guid}
[request-pull-backup-server-apache-backup-2]
<= request-pbs-common
name = PBS pushing to ${request-apache-backup-2:name}
config = url name type server-key on-notification
config-url = ${request-apache-backup-2:connection-ssh-url}
config-name = ${request-pull-backup-server-apache-2:config-name}
config-type = push
config-server-key = ${request-apache-backup-2:connection-ssh-public-key}
config-on-notification = ${request-pull-backup-server:connection-feeds-url}${request-pull-backup-server-apache-2:config-notification-id}
slave = true
sla = instance_guid
sla-instance_guid = ${request-pull-backup-server:instance_guid}
[directory]
ssh = ${rootdirectory:etc}/ssh
sshkeys = ${rootdirectory:srv}/sshkeys
LAPP stack
==========
This fork of the LAMP stack provides:
- a Postgres instance, with an empty database and a 'postgres' superuser.
Log rotation is handled by Postgres itself.
- symlinks to all the postgres binaries, usable through unix socket
with no further authentication, or through ipv4/ipv6 with password
- a psycopg2 (postgres driver) egg to be used by further configuration recipes
- a hook (custom-application-deployment) for configuring the PHP application
[buildout]
parts =
urls
apache-proxy
logrotate
logrotate-entry-apache
cron
cron-entry-logrotate
sshkeys-authority
sshkeys-dropbear
dropbear-server
dropbear-server-pbs-authorized-key
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
#----------------
#--
#-- Creation of all needed directories.
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc
var = $${buildout:directory}/var
srv = $${buildout:directory}/srv
bin = $${buildout:directory}/bin
tmp = $${buildout:directory}/tmp
[basedirectory]
recipe = slapos.cookbook:mkdirectory
log = $${rootdirectory:var}/log
services = $${rootdirectory:etc}/service
run = $${rootdirectory:var}/run
backup = $${rootdirectory:srv}/backup
promises = $${rootdirectory:etc}/promise
[directory]
recipe = slapos.cookbook:mkdirectory
htdocs = $${rootdirectory:srv}/www
logrotate-entries = $${rootdirectory:etc}/logrotate.d
logrotate-backup = $${basedirectory:backup}/logrotate
cronstamps = $${rootdirectory:etc}/cronstamps
cron-entries = $${rootdirectory:etc}/cron.d
crontabs = $${rootdirectory:etc}/crontabs
ssh = $${rootdirectory:etc}/ssh
sshkeys = $${rootdirectory:srv}/sshkeys
httpd-log = $${basedirectory:log}/apache
#----------------
#--
#-- Deploy cron.
[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:wrapper}
binary = $${basedirectory:services}/crond
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = $${rootdirectory:bin}/cron_simplelogger
log = $${basedirectory:log}/crond.log
#----------------
#--
#-- Deploy logrotate.
[cron-entry-logrotate]
<= cron
recipe = slapos.cookbook:cron.d
name = logrotate
frequency = 0 0 * * *
command = $${logrotate:wrapper}
[logrotate]
recipe = slapos.cookbook:logrotate
# Binaries
logrotate-binary = ${logrotate:location}/usr/sbin/logrotate
gzip-binary = ${gzip:location}/bin/gzip
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
#----------------
#--
#-- sshkeys
[sshkeys-directory]
recipe = slapos.cookbook:mkdirectory
requests = $${directory:sshkeys}/requests
keys = $${directory:sshkeys}/keys
[sshkeys-authority]
recipe = slapos.cookbook:sshkeys_authority
request-directory = $${sshkeys-directory:requests}
keys-directory = $${sshkeys-directory:keys}
wrapper = $${basedirectory:services}/sshkeys_authority
keygen-binary = ${dropbear:location}/bin/dropbearkey
[sshkeys-dropbear]
<= sshkeys-authority
recipe = slapos.cookbook:sshkeys_authority.request
name = dropbear
type = rsa
executable = $${dropbear-server:wrapper}
public-key = $${dropbear-server:rsa-keyfile}.pub
private-key = $${dropbear-server:rsa-keyfile}
wrapper = $${basedirectory:services}/sshd
#----------------
#--
#-- Dropbear.
[dropbear-server]
recipe = slapos.cookbook:dropbear
host = $${slap-network-information:global-ipv6}
port = 2222
home = $${directory:ssh}
wrapper = $${rootdirectory:bin}/raw_sshd
shell = $${rdiff-backup-server:wrapper}
rsa-keyfile = $${directory:ssh}/server_key.rsa
dropbear-binary = ${dropbear:location}/sbin/dropbear
[dropbear-server-pbs-authorized-key]
<= dropbear-server
recipe = slapos.cookbook:dropbear.add_authorized_key
key = $${slap-parameter:authorized-key}
#----------------
#--
#-- rdiff
[rdiff-backup-server]
recipe = slapos.cookbook:pbs
client = false
path = $${directory:htdocs}
wrapper = $${rootdirectory:bin}/rdiffbackup-server
rdiffbackup-binary = ${buildout:bin-directory}/rdiff-backup
#----------------
#--
#-- Apache Proxy.
[apache-proxy]
recipe = slapos.cookbook:apacheproxy
url = $${slap-parameter:proxy-url}
pid-file = $${basedirectory:run}/apache.pid
lock-file = $${basedirectory:run}/apache.lock
ip = $${slap-network-information:global-ipv6}
port = 8080
error-log = $${directory:httpd-log}/error.log
access-log = $${directory:httpd-log}/access.log
httpd-conf = $${rootdirectory:etc}/apache.conf
wrapper = $${basedirectory:services}/apache
promise = $${basedirectory:promises}/apache
httpd-binary = ${apache:location}/bin/httpd
[logrotate-entry-apache]
<= logrotate
recipe = slapos.cookbook:logrotate.d
name = apache
log = $${apache-proxy:error-log} $${apache-proxy:access-log}
frequency = daily
rotate-num = 30
sharedscripts = true
notifempty = true
create = true
#----------------
#--
#-- Publish instance parameters.
[urls]
recipe = slapos.cookbook:publish
url = http://[$${apache-proxy:ip}]:$${apache-proxy:port}/
ssh-public-key = $${sshkeys-dropbear:public-key-value}
ssh-url = ssh://nobody@[$${dropbear-server:host}]:$${dropbear-server:port}/$${rdiff-backup-server:path}
[buildout]
extends = ${custom-application-deployment:path}
parts =
certificate-authority
ca-stunnel
logrotate
logrotate-entry-apache
logrotate-entry-stunnel
cron
cron-entry-logrotate
promise
slapmonitor
slapmonitor-xml
frontend-promise
content-promise
publish-connection-informations
${custom-application-deployment:part-list}
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
#----------------
#--
#-- Creation of all needed directories.
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc
var = $${buildout:directory}/var
srv = $${buildout:directory}/srv
bin = $${buildout:directory}/bin
tmp = $${buildout:directory}/tmp
[basedirectory]
recipe = slapos.cookbook:mkdirectory
log = $${rootdirectory:var}/log
services = $${rootdirectory:etc}/service
run = $${rootdirectory:var}/run
backup = $${rootdirectory:srv}/backup
promises = $${rootdirectory:etc}/promise
[directory]
recipe = slapos.cookbook:mkdirectory
cron-entries = $${rootdirectory:etc}/cron.d
crontabs = $${rootdirectory:etc}/crontabs
cronstamps = $${rootdirectory:etc}/cronstamps
ca-dir = $${rootdirectory:srv}/ssl
httpd-log = $${basedirectory:log}/apache
php-ini-dir = $${rootdirectory:etc}/php
tmp-php = $${rootdirectory:tmp}/php
logrotate-entries = $${rootdirectory:etc}/logrotate.d
logrotate-backup = $${basedirectory:backup}/logrotate
report = $${rootdirectory:etc}/report
stunnel-conf = $${rootdirectory:etc}/stunnel
xml-report = $${rootdirectory:var}/xml_report
[cadirectory]
recipe = slapos.cookbook:mkdirectory
requests = $${directory:ca-dir}/requests
private = $${directory:ca-dir}/private
certs = $${directory:ca-dir}/certs
newcerts = $${directory:ca-dir}/newcerts
crl = $${directory:ca-dir}/crl
#----------------
#--
#-- Deploy cron.
[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:wrapper}
binary = $${basedirectory:services}/crond
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = $${rootdirectory:bin}/cron_simplelogger
log = $${basedirectory:log}/crond.log
#----------------
#--
#-- Deploy logrotate.
[cron-entry-logrotate]
<= cron
recipe = slapos.cookbook:cron.d
name = logrotate
frequency = 0 0 * * *
command = $${logrotate:wrapper}
[logrotate]
recipe = slapos.cookbook:logrotate
# Binaries
logrotate-binary = ${logrotate:location}/usr/sbin/logrotate
gzip-binary = ${gzip:location}/bin/gzip
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
#----------------
#--
#-- Deploy stunnel.
[stunnel]
recipe = slapos.cookbook:stunnel
client = true
stunnel-binary = ${stunnel:location}/bin/stunnel
remote-host = $${postgres-urlparse:host}
remote-port = $${postgres-urlparse:port}
local-host = $${slap-network-information:local-ipv4}
local-port = 33060
log-file = $${basedirectory:log}/stunnel.log
config-file = $${directory:stunnel-conf}/stunnel.conf
key-file = $${directory:stunnel-conf}/stunnel.key
cert-file = $${directory:stunnel-conf}/stunnel.crt
pid-file = $${basedirectory:run}/stunnel.pid
wrapper = $${rootdirectory:bin}/raw_stunnel
post-rotate-script = $${rootdirectory:bin}/stunnel_post_rotate
[logrotate-entry-stunnel]
<= logrotate
recipe = slapos.cookbook:logrotate.d
name = stunnel
log = $${stunnel:log-file}
frequency = daily
rotate-num = 30
notifempty = true
create = true
post = $${stunnel:post-rotate-script}
#----------------
#--
#-- Certificate stuff.
[certificate-authority]
recipe = slapos.cookbook:certificate_authority
openssl-binary = ${openssl:location}/bin/openssl
ca-dir = $${directory:ca-dir}
requests-directory = $${cadirectory:requests}
wrapper = $${basedirectory:services}/ca
ca-private = $${cadirectory:private}
ca-certs = $${cadirectory:certs}
ca-newcerts = $${cadirectory:newcerts}
ca-crl = $${cadirectory:crl}
[ca-stunnel]
<= certificate-authority
recipe = slapos.cookbook:certificate_authority.request
executable = $${stunnel:wrapper}
wrapper = $${basedirectory:services}/stunnel
key-file = $${stunnel:key-file}
cert-file = $${stunnel:cert-file}
#----------------
#--
#-- Request Postgres instance and parse its URL.
[request-postgres]
<= slap-connection
recipe = slapos.cookbook:request
name = Postgres
software-url = $${slap-connection:software-release-url}
software-type = postgres
return = url
sla = computer_guid
sla-computer_guid = $${slap-connection:computer-id}
[postgres-urlparse]
recipe = slapos.cookbook:urlparse
url = $${request-postgres:connection-url}
#----------------
#--
#-- Deploy Apache + PHP application.
#-- Despite the names of mysql-* parameters, they are not really specific to mysql.
[apache-php]
recipe = slapos.cookbook:apachephp
source = ${application:location}
htdocs = $${rootdirectory:srv}/www/
pid-file = $${basedirectory:run}/apache.pid
lock-file = $${basedirectory:run}/apache.lock
ip = $${slap-network-information:global-ipv6}
port = 8080
url = http://[$${:ip}]:$${:port}/
error-log = $${directory:httpd-log}/error.log
access-log = $${directory:httpd-log}/access.log
php-ini-dir = $${directory:php-ini-dir}
tmp-dir = $${directory:tmp-php}
httpd-conf = $${rootdirectory:etc}/apache.conf
wrapper = $${basedirectory:services}/apache
httpd-binary = ${apache:location}/bin/httpd
[logrotate-entry-apache]
<= logrotate
recipe = slapos.cookbook:logrotate.d
name = apache
log = $${apache-php:error-log} $${apache-php:access-log}
frequency = daily
rotate-num = 30
sharedscripts = true
notifempty = true
create = true
#----------------
#--
#-- Request frontend.
[request-frontend]
<= slap-connection
recipe = slapos.cookbook:requestoptional
name = Frontend
# XXX We have hardcoded SR URL here.
software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
slave = true
config = url custom_domain
config-url = http://[$${apache-php:ip}]:$${apache-php:port}/
return = site_url
config-custom_domain = $${slap-parameter:domain}
#----------------
#--
#-- Deploy slapmonitor.
[slapmonitor]
recipe = slapos.cookbook:slapmonitor
pid-file = $${basedirectory:run}/apache.pid
database-path = $${basedirectory:log}/slapmonitor.db
slapmonitor-path = ${buildout:bin-directory}/slapmonitor
path = $${basedirectory:services}/slapmonitor
[slapmonitor-xml]
recipe = slapos.cookbook:slapmonitor-xml
database-path = $${basedirectory:log}/slapmonitor.db
slapmonitor-xml-path = ${buildout:bin-directory}/slapmonitor-xml
path = $${directory:report}/slapmonitor-xml
#----------------
#--
#-- Publish instance parameters.
[publish-connection-informations]
recipe = slapos.cookbook:publish
backend_url = $${apache-php:url}
url = $${request-frontend:connection-site_url}
#----------------
#--
#-- Deploy promises scripts.
[promise]
recipe = slapos.cookbook:check_port_listening
path = $${basedirectory:promises}/apache
hostname = $${apache-php:ip}
port = $${apache-php:port}
[frontend-promise]
recipe = slapos.cookbook:check_url_available
path = $${basedirectory:promises}/frontend
url = $${request-frontend:connection-site_url}
dash_path = ${dash:location}/bin/dash
curl_path = ${curl:location}/bin/curl
[content-promise]
recipe = slapos.cookbook:check_page_content
path = $${basedirectory:promises}/content
url = $${request-frontend:connection-site_url}
dash_path = ${dash:location}/bin/dash
curl_path = ${curl:location}/bin/curl
[slap-parameter]
# Default value if no domain is specified
domain =
# Default value if no ssh parameter is specified
logbox-ip =
logbox-port =
logbox-user =
logbox-passwd =
[buildout]
parts =
slapos-cookbook
apache-php-postgres
rdiff-backup
dropbear
eggs
instance
psycopg2
instance-apache-php
instance-postgres
#Contains the importer and exporter recipes for postgres
instance-postgres-import
instance-postgres-export
instance-default-root
extends =
../resilient/buildout.cfg
../../component/apache/buildout.cfg
../../component/apache-php/buildout.cfg
../../component/dash/buildout.cfg
../../component/dcron/buildout.cfg
../../component/gzip/buildout.cfg
../../component/logrotate/buildout.cfg
../../component/lxml-python/buildout.cfg
../../component/postgresql/buildout.cfg
../../component/rdiff-backup/buildout.cfg
../../component/stunnel/buildout.cfg
../../component/dropbear/buildout.cfg
../slapos.cfg
#----------------
#-- Application-specific part (maarch, etc.)
[application]
recipe = hexagonit.recipe.download
# If the provided tarball does not contain top directory, this option should be changed to false
strip-top-level-dir = true
#----------------
#-- Instance-level buildout profiles.
[instance]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance.cfg.in
output = ${buildout:directory}/instance.cfg
md5sum = 1aaf3ea7b14e09e66904bdb80e3cfe2f
mode = 0644
[instance-apache-php]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/apache/instance-apache-php.cfg.in
output = ${buildout:directory}/instance-apache-php.cfg
md5sum = 72b70452d1c077cfcd0f268181506b8e
mode = 0644
[instance-apache-backup]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/apache/instance-apache-backup.cfg.in
output = ${buildout:directory}/instance-apache-backup.cfg
md5sum = db879141c0b6a77ef8b3b7e699f5583a
mode = 0644
[template-resilient-lapp]
recipe = slapos.recipe.template:jinja2
template = ${:_profile_base_location_}/template-resilient.cfg.in
rendered = ${buildout:directory}/instance-resilient.cfg
context = key templateapache instance-apache-php:output
key dropbear dropbear:location
key buildout buildout:bin-directory
import-list = file parts template-parts:destination
file replicated template-replicated:destination
md5sum = 525f50e60d0a96557a552de6afa4ab88
mode = 0644
[instance-postgres]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/postgres/instance-postgres.cfg.in
output = ${buildout:directory}/instance-postgres.cfg
md5sum = 42b92fb4905e2903caca327feddb5141
mode = 0644
[instance-postgres-import]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/postgres/instance-postgres-import.cfg.in
output = ${buildout:directory}/instance-postgres-import.cfg
md5sum = 7edfa157ddccc27e99bf128fc1c2b9ee
mode = 0644
[instance-postgres-export]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/postgres/instance-postgres-export.cfg.in
output = ${buildout:directory}/instance-postgres-export.cfg
md5sum = 68080e5d861eb3474442211dd65c668b
mode = 0644
#----------------
#-- Postgres driver for Python recipes.
[psycopg2-env]
PATH = ${postgresql:location}/bin:%(PATH)s
[psycopg2]
recipe = zc.recipe.egg:custom
egg = psycopg2
define = PSYCOPG_EXTENSIONS,PSYCOPG_DISPLAY_SIZE,PSYCOPG_NEW_BOOLEAN,HAVE_PQFREEMEM,HAVE_PQPROTOCOL3
environment = psycopg2-env
include-dirs =
${postgresql:location}/include
library-dirs =
${postgresql:location}/lib
rpath =
${postgresql:location}/lib
[instance-default-root]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-default-root.cfg.in
output = ${buildout:directory}/instance-default-root.cfg
md5sum = 53c9020f7a0b5203f976e069e455787b
mode = 0644
#----------------
#--
#-- Optional part allowing applications using this stack to run a custom
#-- instance.cfg at the end of Apache/PHP instance deployment.
#-- To use it in your application, just override those two parameters, like:
[custom-application-deployment]
# path = /path/to/instance-custom.cfg
# part-list = part1 part2
# See software/maarch/software.cfg for an example.
path =
part-list =
#----------------
#-- Dummy parts in case no application configuration file is needed
[application-template]
filename =
location =
[application-configuration]
location =
#----------------
[eggs]
recipe = zc.recipe.egg
eggs =
${lxml-python:egg}
${psycopg2:egg}
slapos.toolbox
cns.recipe.symlink
[versions]
Jinja2 = 2.6
Werkzeug = 0.8.3
apache-libcloud = 0.11.4
async = 0.6.1
buildout-versions = 1.7
cns.recipe.symlink = 0.2.3
gitdb = 0.5.4
hexagonit.recipe.cmmi = 1.6
inotifyx = 0.2.0
lxml = 3.0.2
meld3 = 0.6.10
netaddr = 0.7.10
psycopg2 = 2.4.6
pycrypto = 2.6
pytz = 2012h
rdiff-backup = 1.0.5
slapos.recipe.download = 1.0.dev-r4053
slapos.recipe.template = 2.4.2
smmap = 0.8.2
# Required by:
# slapos.core==0.33.2-dev
# slapos.toolbox==0.32.1-dev
Flask = 0.9
# Required by:
# slapos.toolbox==0.32.1-dev
GitPython = 0.3.2.RC1
# Required by:
# slapos.toolbox==0.32.1-dev
atomize = 0.1.1
# Required by:
# slapos.toolbox==0.32.1-dev
feedparser = 5.1.3
# Required by:
# hexagonit.recipe.cmmi==1.6
hexagonit.recipe.download = 1.6
# Required by:
# slapos.core==0.33.2-dev
netifaces = 0.8
# Required by:
# slapos.toolbox==0.32.1-dev
paramiko = 1.9.0
# Required by:
# slapos.toolbox==0.32.1-dev
psutil = 0.6.1
# Required by:
# slapos.core==0.33.2-dev
pyflakes = 0.5.0
# Required by:
# cns.recipe.symlink==0.2.3
# slapos.cookbook==0.70.1-dev
# slapos.core==0.33.2-dev
# slapos.toolbox==0.32.1-dev
# supervisor==3.0b1
# zc.buildout==1.6.0-dev-SlapOS-010
# zope.interface==4.0.2
setuptools = 0.6c12dev-r88846
# Required by:
# slapos.core==0.33.2-dev
supervisor = 3.0b1
# Required by:
# slapos.toolbox==0.32.1-dev
xml-marshaller = 0.9.7
# Required by:
# slapos.core==0.33.2-dev
zope.interface = 4.0.2
[buildout]
parts = request-apache
[request-apache]
<= slap-connection
recipe = slapos.cookbook:request
software-url = $${slap-connection:software-release-url}
software-type = apache
name = Apache
[buildout] [buildout]
parts = parts =
switch_softwaretype switch_softwaretype
...@@ -8,10 +9,16 @@ offline = true ...@@ -8,10 +9,16 @@ offline = true
[switch_softwaretype] [switch_softwaretype]
recipe = slapos.cookbook:softwaretype recipe = slapos.cookbook:softwaretype
default = ${template-apache-php:output} default = ${instance-default-root:output}
backuped = ${template-backuped:output} apache = ${instance-apache-php:output}
mariadb = ${template-mariadb:output} resilient = ${template-resilient-lapp:rendered}
mariadb-pbsready-import = ${template-mariadb-pbsready-import:output} postgres = ${instance-postgres:output}
mariadb-pbsready-export = ${template-mariadb-pbsready-export:output} postgres-import = ${instance-postgres-import:output}
postgres-export = ${instance-postgres-export:output}
apache-backup = ${instance-apache-backup:output}
#frozen creates a syntax error, meaning it can keep its data.
#It's dirty as hell, it needs to be replaced.
frozen = ${instance-frozen:output}
pull-backup = ${template-pull-backup:output} pull-backup = ${template-pull-backup:output}
apache-backup = ${template-apache-backup:output}
[buildout]
extends = ${instance-postgres:output}
${pbsready-export:output}
parts +=
urls
postgres-instance
postgres-promise
# have to repeat the next one, as it's not inherited from pbsready-export
cron-entry-backup
[exporter]
recipe = slapos.cookbook:postgres.export
wrapper = $${rootdirectory:bin}/$${slap-parameter:namebase}-exporter
bin = $${postgres-instance:bin}
pgdata-directory = $${postgres-instance:pgdata-directory}
backup-directory = $${postgres-instance:backup-directory}
dbname = $${postgres-instance:dbname}
[buildout]
extends = ${instance-postgres:output}
${pbsready-import:output}
parts +=
postgres-instance
# have to repeat the next one, as it's not inherited from pbsready-import
import-on-notification
[importer]
recipe = slapos.cookbook:postgres.import
wrapper = $${rootdirectory:bin}/$${slap-parameter:namebase}-importer
bin = $${postgres-instance:bin}
pgdata-directory = $${postgres-instance:pgdata-directory}
backup-directory = $${postgres-instance:backup-directory}
dbname = $${postgres-instance:dbname}
[buildout]
parts =
urls
postgres-instance
postgres-promise
stunnel
certificate-authority
ca-stunnel
logrotate
logrotate-entry-stunnel
logrotate-entry-cron
cron
cron-entry-logrotate
slapmonitor
slapmonitor-xml
gzip-binary = ${gzip:location}/bin/gzip
# Define egg directories to be the one from Software Release
# (/opt/slapgrid/...)
eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true
#----------------
#--
#-- Creation of all needed directories.
[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}/service
run = $${rootdirectory:var}/run
script = $${rootdirectory:etc}/script
backup = $${rootdirectory:srv}/backup
promises = $${rootdirectory:etc}/promise
[directory]
recipe = slapos.cookbook:mkdirectory
cron-entries = $${rootdirectory:etc}/cron.d
crontabs = $${rootdirectory:etc}/crontabs
cronstamps = $${rootdirectory:etc}/cronstamps
ca-dir = $${rootdirectory:srv}/ssl
logrotate-backup = $${basedirectory:backup}/logrotate
report = $${rootdirectory:etc}/report
stunnel-conf = $${rootdirectory:etc}/stunnel
logrotate-entries = $${rootdirectory:etc}/logrotate.d
xml-report = $${rootdirectory:var}/xml_report
#----------------
#--
#-- Deploy cron.
[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:wrapper}
binary = $${basedirectory:services}/crond
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = $${rootdirectory:bin}/cron_simplelogger
log = $${basedirectory:log}/crond.log
#----------------
#--
#-- Deploy logrotate.
[cron-entry-logrotate]
<= cron
recipe = slapos.cookbook:cron.d
name = logrotate
frequency = 0 0 * * *
command = $${logrotate:wrapper}
[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-stunnel]
<= logrotate
recipe = slapos.cookbook:logrotate.d
name = stunnel
log = $${stunnel:log-file}
frequency = daily
rotate-num = 30
notifempty = true
create = true
post = $${stunnel:post-rotate-script}
[logrotate-entry-cron]
<= logrotate
recipe =slapos.cookbook:logrotate.d
name = crond
log = $${cron-simplelogger:log}
frequency = daily
rotate-num = 30
notifempty = true
create = true
#----------------
#--
#-- Deploy stunnel.
[stunnel]
recipe = slapos.cookbook:stunnel
stunnel-binary = ${stunnel:location}/bin/stunnel
wrapper = $${rootdirectory:bin}/stunnel
log-file = $${basedirectory:log}/stunnel.log
config-file = $${directory:stunnel-conf}/stunnel.conf
key-file = $${directory:stunnel-conf}/stunnel.key
cert-file = $${directory:stunnel-conf}/stunnel.crt
pid-file = $${basedirectory:run}/stunnel.pid
local-host = $${instance-parameters:ipv4_random}
local-port = $${postgres-instance:port}
remote-host = $${instance-parameters:ipv6_random}
remote-port = 6446
client = false
post-rotate-script = $${rootdirectory:bin}/stunnel_post_rotate
#----------------
#--
#-- Certificate stuff.
[certificate-authority]
recipe = slapos.cookbook:certificate_authority
openssl-binary = ${openssl:location}/bin/openssl
ca-dir = $${directory:ca-dir}
requests-directory = $${cadirectory:requests}
wrapper = $${basedirectory:services}/ca
ca-private = $${cadirectory:private}
ca-certs = $${cadirectory:certs}
ca-newcerts = $${cadirectory:newcerts}
ca-crl = $${cadirectory:crl}
[cadirectory]
recipe = slapos.cookbook:mkdirectory
requests = $${directory:ca-dir}/requests/
private = $${directory:ca-dir}/private/
certs = $${directory:ca-dir}/certs/
newcerts = $${directory:ca-dir}/newcerts/
crl = $${directory:ca-dir}/crl/
#----------------
#--
#-- Creates a Postgres cluster, configuration files, and a database.
[postgres-instance]
recipe = slapos.cookbook:postgres
ipv6 = $${instance-parameters:ipv6}
ipv4 = $${instance-parameters:ipv4}
ipv6_random = $${instance-parameters:ipv6_random}
superuser = postgres
port = 5432
dbname = db
# pgdata_directory is created by initdb, and should not exist beforehand.
pgdata-directory = $${rootdirectory:var}/data
backup-directory = $${basedirectory:backup}/postgres
bin = $${rootdirectory:bin}
services = $${basedirectory:services}
dependency-symlinks = $${symlinks:recipe}
[ca-stunnel]
<= certificate-authority
recipe = slapos.cookbook:certificate_authority.request
executable = $${stunnel:wrapper}
wrapper = $${basedirectory:services}/stunnel
key-file = $${stunnel:key-file}
cert-file = $${stunnel:cert-file}
#----------------
#--
#-- Creates symlinks from the instance to the software release.
[symlinks]
recipe = cns.recipe.symlink
symlink_target = $${rootdirectory:bin}
symlink_base = ${postgresql:location}/bin
#----------------
#--
#-- Deploy slapmonitor.
[slapmonitor]
recipe = slapos.cookbook:slapmonitor
pid-file = $${postgres-instance:pgdata-directory}/postmaster.pid
database-path = $${basedirectory:log}/slapmonitor.db
slapmonitor-path = ${buildout:bin-directory}/slapmonitor
path = $${basedirectory:services}/slapmonitor
[slapmonitor-xml]
recipe = slapos.cookbook:slapmonitor-xml
database-path = $${basedirectory:log}/slapmonitor.db
slapmonitor-xml-path = ${buildout:bin-directory}/slapmonitor-xml
path = $${directory:report}/slapmonitor-xml
#----------------
#--
#-- Deploy promise scripts.
[postgres-promise]
recipe = slapos.cookbook:check_port_listening
path = $${basedirectory:promises}/postgres
hostname = $${instance-parameters:ipv6_random}
port = $${postgres-instance:port}
#----------------
#--
#-- Publish instance parameters.
[urls]
recipe = slapos.cookbook:publish
url = $${postgres-instance:url}
ip = $${instance-parameters:ipv6_random}
#----------------
#--
#-- Fetches parameters defined in SlapOS Master for this instance
[instance-parameters]
recipe = slapos.cookbook:slapconfiguration
computer = $${slap-connection:computer-id}
partition = $${slap-connection:partition-id}
url = $${slap-connection:server-url}
key = $${slap-connection:key-file}
cert = $${slap-connection:cert-file}
{% import 'parts' as parts %}
{% import 'replicated' as replicated %}
[buildout]
extends =
{{templateapache}}
# += because we need to take up parts (like instance-custom, slapmonitor etc) from the profile we extended
parts +=
{{ parts.replicate("postgres","3") }}
request-apache-backup-1
request-apache-backup-2
request-pull-backup-server-apache-1
request-pull-backup-server-apache-backup-1
request-pull-backup-server-apache-2
request-pull-backup-server-apache-backup-2
publish-connection-informations
apache-php
stunnel
certificate-authority
ca-stunnel
logrotate
logrotate-entry-apache
logrotate-entry-stunnel
cron
cron-entry-logrotate
dropbear-server
sshkeys-authority
dropbear-server-pbs-authorized-key
request-pull-backup-server
{{ replicated.replicate("postgres", "3", "postgres-export", "postgres-import") }}
[request-pull-backup-server]
<= request-pbs-common
name = PBS (Pull Backup Server)
return = ssh-key notification-url feeds-url
slave = false
[sshkeys-directory]
recipe = slapos.cookbook:mkdirectory
requests = ${directory:sshkeys}/requests
keys = ${directory:sshkeys}/keys
[sshkeys-authority]
recipe = slapos.cookbook:sshkeys_authority
request-directory = ${sshkeys-directory:requests}
keys-directory = ${sshkeys-directory:keys}
wrapper = ${basedirectory:services}/sshkeys_authority
keygen-binary = {{dropbear}}/bin/dropbearkey
[sshkeys-dropbear]
<= sshkeys-authority
recipe = slapos.cookbook:sshkeys_authority.request
name = dropbear
type = rsa
executable = ${dropbear-server:wrapper}
public-key = ${dropbear-server:rsa-keyfile}.pub
private-key = ${dropbear-server:rsa-keyfile}
wrapper = ${basedirectory:services}/sshd
[dropbear-server]
recipe = slapos.cookbook:dropbear
host = ${slap-network-information:global-ipv6}
port = 2222
home = ${directory:ssh}
wrapper = ${rootdirectory:bin}/raw_sshd
shell = ${rdiff-backup-server:wrapper}
rsa-keyfile = ${directory:ssh}/server_key.rsa
dropbear-binary = {{dropbear}}/sbin/dropbear
[dropbear-server-pbs-authorized-key]
<= dropbear-server
recipe = slapos.cookbook:dropbear.add_authorized_key
key = ${request-pull-backup-server:connection-ssh-key}
[rdiff-backup-server]
<= apache-php
recipe = slapos.cookbook:pbs
client = false
path = ${apache-php:htdocs}
wrapper = ${rootdirectory:bin}/rdiffbackup-server
rdiffbackup-binary = {{buildout}}/rdiff-backup
[request-apache-backup-1]
<= slap-connection
recipe = slapos.cookbook:request
name = Apache Backup 1
software-url = ${slap-connection:software-release-url}
software-type = apache-backup
return = url ssh-url ssh-public-key
config = authorized-key proxy-url
config-authorized-key = ${request-pull-backup-server:connection-ssh-key}
config-proxy-url = ${publish-connection-informations:url}
[request-apache-backup-2]
<= slap-connection
recipe = slapos.cookbook:request
name = Apache Backup 2
software-url = ${slap-connection:software-release-url}
software-type = apache-backup
return = url ssh-url ssh-public-key
config = authorized-key proxy-url
config-authorized-key = ${request-pull-backup-server:connection-ssh-key}
config-proxy-url = ${publish-connection-informations:url}
[request-pull-backup-server-apache-1]
<= request-pbs-common
name = PBS pulling from Apache 1
config = url name type server-key notify notification-id frequency
config-url = ssh://nobody@[${dropbear-server:host}]:${dropbear-server:port}/${rdiff-backup-server:path}
config-name = ${slap-connection:computer-id}-${slap-connection:partition-id}-apache
config-type = pull
config-server-key = ${sshkeys-dropbear:public-key-value}
config-notify = ${request-pull-backup-server:connection-notification-url}
config-notification-id = ${slap-connection:computer-id}-${slap-connection:partition-id}-apache-pull
config-frequency = 30 * * * *
slave = true
sla = instance_guid
sla-instance_guid = ${request-pull-backup-server:instance_guid}
[request-pull-backup-server-apache-2]
<= request-pbs-common
name = PBS pulling from Apache 2
config = url name type server-key notify notification-id frequency
config-url = ssh://nobody@[${dropbear-server:host}]:${dropbear-server:port}/${rdiff-backup-server:path}
config-name = ${slap-connection:computer-id}-${slap-connection:partition-id}-apache
config-type = pull
config-server-key = ${sshkeys-dropbear:public-key-value}
config-notify = ${request-pull-backup-server:connection-notification-url}
config-notification-id = ${slap-connection:computer-id}-${slap-connection:partition-id}-apache-pull
config-frequency = 30 * * * *
slave = true
sla = instance_guid
sla-instance_guid = ${request-pull-backup-server:instance_guid}
[request-pull-backup-server-apache-backup-1]
<= request-pbs-common
name = PBS pushing to ${request-apache-backup-1:name}
config = url name type server-key on-notification
config-url = ${request-apache-backup-1:connection-ssh-url}
config-name = ${request-pull-backup-server-apache-1:config-name}
config-type = push
config-server-key = ${request-apache-backup-1:connection-ssh-public-key}
config-on-notification = ${request-pull-backup-server:connection-feeds-url}${request-pull-backup-server-apache-1:config-notification-id}
slave = true
sla = instance_guid
sla-instance_guid = ${request-pull-backup-server:instance_guid}
[request-pull-backup-server-apache-backup-2]
<= request-pbs-common
name = PBS pushing to ${request-apache-backup-2:name}
config = url name type server-key on-notification
config-url = ${request-apache-backup-2:connection-ssh-url}
config-name = ${request-pull-backup-server-apache-2:config-name}
config-type = push
config-server-key = ${request-apache-backup-2:connection-ssh-public-key}
config-on-notification = ${request-pull-backup-server:connection-feeds-url}${request-pull-backup-server-apache-2:config-notification-id}
slave = true
sla = instance_guid
sla-instance_guid = ${request-pull-backup-server:instance_guid}
[directory]
ssh = ${rootdirectory:etc}/ssh
sshkeys = ${rootdirectory:srv}/sshkeys
Base resilient stack
====================
This stack is meant to be extended by SR profiles, or other stacks, that need to provide
automated backup/restore, election of backup candidates, and instance failover.
As reference implementations, both stack/lamp and stack/lapp define resilient behavior for
MySQL and Postgres respectively.
This involves three different software_types:
* pull-backup
* {mysoftware}_export
* {mysoftware}_import
where 'mysoftware' is the component that needs resiliency (can be postgres, mysql, erp5, and so on).
pull-backup
-----------
This software type is defined in
http://git.erp5.org/gitweb/slapos.git/blob/HEAD:/stack/resilient/instance-pull-backup.cfg.in?js=1
and there should be no reason to modify or extend it.
An instance of type 'pull-backup' will receive data from an 'export' instance and immediately populate an 'import' instance.
The backup data is automatically used to build an historical, incremental archive in srv/backup/pbs.
export
------
example:
http://git.erp5.org/gitweb/slapos.git/blob/HEAD:/stack/lapp/postgres/instance-postgres-export.cfg.in?js=1
This is the *active* instance - the one providing live data to the application.
A backup is run via the bin/exporter script: it will
1) run bin/{mysoftware}-backup
and 2) notify the pull-backup instance that data is ready.
The pull-backup, upon receiving the notification, will make a copy of the data and transmit it to the 'import' instances.
You should provide the bin/{mysoftware}-exporter script, see for instance
http://git.erp5.org/gitweb/slapos.git/blob/HEAD:/slapos/recipe/postgres/__init__.py?js=1#l207
http://git.erp5.org/gitweb/slapos.git/blob/HEAD:/slapos/recipe/mydumper.py?js=1#l71
By default, as defined in
http://git.erp5.org/gitweb/slapos.git/blob/HEAD:/stack/resilient/pbsready-export.cfg.in?js=1#l27
the bin/exporter script is run every 60 minutes.
import
------
example:
http://git.erp5.org/gitweb/slapos.git/blob/HEAD:/stack/lapp/postgres/instance-postgres-import.cfg.in?js=1
This is the *fallback* instance - the one that can be activated and thus become active.
Any number of import instances can be used. Deciding which one should take over can be done manually
or through a monitoring + election script.
You should provide the bin/{mysoftware}-importer script, see for instance
http://git.erp5.org/gitweb/slapos.git/blob/HEAD:/slapos/recipe/postgres/__init__.py?js=1#l233
http://git.erp5.org/gitweb/slapos.git/blob/HEAD:/slapos/recipe/mydumper.py?js=1#l71
In practice
-----------
Add resilience to your software
Let's say you already have a file instance-mysoftware.cfg.in that instantiates your
software. In which there is a part [mysoftware] where there is the main recipe
that instantiates the program.
You need to create two new files, instance-mysoftware-import.cfg.in and
instance-mysoftware-export.cfg.in, following this layout:
IMPORT:
[buildout]
extends = ${instance-mysoftware:output}
${pbsready-import:output}
parts +=
mysoftware
import-on-notification
[importer]
recipe = YourImportRecipe
wrapper = $${rootdirectory:bin}/$${slap-parameter:namebase}-importer
backup-directory = $${directory:backup}
...
EXPORT:
[buildout]
extends = ${instance-mysoftware:output}
${pbsready-export:output}
parts +=
mysoftware
cron-entry-backup
[exporter]
recipe = YourExportRecipe
wrapper = $${rootdirectory:bin}/$${slap-parameter:namebase}-exporter
backup-directory = $${directory:backup}
...
In the [exporter] / [importer] part, you are free to do whatever you want, but
you need to dump / import your data from $${directory:backup} and specify a
wrapper. I suggest you only add options and specify your export/import recipe.
-----------------------------------------------------------------------------------------
Finally, instance-mysoftware-import.cfg.in and
instance-mysoftware-export.cfg.in need to be downloaded and accessible by
switch_softwaretype, and you need to extend stack/resilient/buildout.cfg and
stack/resilient/switchsoftware.cfg to download the whole resiliency bundle.
Here is how it's done in the mariadb case for the lamp stack:
** buildout.cfg **
extends =
../resilient/buildout.cfg
[instance-mariadb-import]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/mariadb/instance-mariadb-import.cfg.in
output = ${buildout:directory}/instance-mariadb-import.cfg
md5sum = ...
mode = 0644
[instance-mariadb-export]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/mariadb/instance-mariadb-export.cfg.in
output = ${buildout:directory}/instance-mariadb-export.cfg
md5sum = ...
mode = 0644
** instance.cfg.in **
extends =
../resilient/switchsoftware.cfg
[switch-softwaretype]
...
mariadb = ${instance-mariadb:output}
mariadb-import = ${instance-mariadb-import:output}
mariadb-export = ${instance-mariadb-export:output}
...
Then, in the .cfg file where you want to instantiate your software, you can do, instead of requesting your software
* template-resilient.cfg.in *
[buildout]
...
parts +=
{{ parts.replicate("Name","3") }}
...
[...]
...
[ArgLeader]
...
[ArgBackup]
...
{{ replicated.replicate("Name", "3",
"mysoftware-export", "mysoftware-import",
"ArgLeader","ArgBackup") }}
and it'll expend into the sections require to request Name0, Name1 and Name2,
backuped and resilient. The leader will expend the section [ArgLeader], backups
will expend [ArgBackup]. If you don't need to specify any options, you can
omit the last two arguments in replicate().
Since you will compile your template with jinja2, there should be no $${},
because it is not yet possible to use jinja2 -> buildout template.
To compile with jinja2, see jinja2's recipe.
[buildout]
parts =
pbsready
pbsready-import
pbsready-export
template-replicated
template-parts
instance-frozen
template-resilient
#----------------
#--
#-- Profiles needed to setup automated backup and recovery.
#--
[pbsready]
# Common parts for pbsready-import and pbsready-export.
# Provides rdiff-backup, notification queue, ssh authentication,
# dropbear server, and the bully script.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/pbsready.cfg.in
output = ${buildout:directory}/pbsready.cfg
md5sum = e602f6746cbe5a1da82b90097719c4a1
mode = 0644
[pbsready-import]
# An import instance has an importer script, which is called
# by the parent PBS instance when the dump content is propagated.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/pbsready-import.cfg.in
output = ${buildout:directory}/pbsready-import.cfg
md5sum = eda0c1574d8991f4f9e08e3707c2b04b
mode = 0644
[pbsready-export]
# An export instance has an exporter script, and communicates
# to parent PBS instances to deliver the exported dump.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/pbsready-export.cfg.in
output = ${buildout:directory}/pbsready-export.cfg
md5sum = dd56f9c74e580475a17a9afb1d220390
mode = 0644
[template-pull-backup]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-pull-backup.cfg.in
output = ${buildout:directory}/instance-pull-backup.cfg
md5sum = 453d96f5a6c1230c01c878cc7640bae6
mode = 0644
[template-replicated]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/template-replicated.cfg.in
md5sum = 63b5649f3cf1c9a77315382793d9593f
mode = 0644
destination = ${buildout:directory}/template-replicated.cfg.in
[template-parts]
recipe = slapos.recipe.download
url = ${:_profile_base_location_}/template-parts.cfg.in
md5sum = c942f82552fcb42fc74a5f896e0cd5f3
mode = 0644
destination = ${buildout:directory}/template-parts.cfg.in
[instance-frozen]
# When an instance is detected as broken, its software type is changed to "frozen".
# On the next run of slapgrid-cp, the buildout profile is replaced by instance-frozen.cfg,
# which will run without removing any content because it raises an error.
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/instance-frozen.cfg.in
output = ${buildout:directory}/instance-frozen.cfg
[template-resilient]
recipe = slapos.recipe.template
url = ${:_profile_base_location_}/resilient.cfg.in
output = ${buildout:directory}/resilient.cfg
md5sum = 59e74d290d623de2c1e147e48f284fba
mode = 0644
[buildout]
parts =
\ No newline at end of file
[buildout] [buildout]
parts = parts =
connection-dict connection-dict
pbs pbs
cron logrotate
cron-entry-logrotate cron
logrotate cron-entry-logrotate
sshkeys-authority sshkeys-authority
sshkeys-dropbear sshkeys-dropbear
eggs-directory = ${buildout:eggs-directory} eggs-directory = ${buildout:eggs-directory}
develop-eggs-directory = ${buildout:develop-eggs-directory} develop-eggs-directory = ${buildout:develop-eggs-directory}
offline = true offline = true
[connection-dict]
recipe = slapos.cookbook:publish #----------------
ssh-key = $${sshkeys-dropbear:public-key-value} #--
notification-url = http://[$${notifier:host}]:$${notifier:port}/notify #-- Creation of all needed directories.
feeds-url = http://[$${notifier:host}]:$${notifier:port}/get/
[rootdirectory]
recipe = slapos.cookbook:mkdirectory
etc = $${buildout:directory}/etc
home = $${buildout:directory}/home
srv = $${buildout:directory}/srv
bin = $${buildout:directory}/bin
tmp = $${buildout:directory}/tmp
var = $${buildout:directory}/var
[basedirectory]
recipe = slapos.cookbook:mkdirectory
log = $${rootdirectory:var}/log
services = $${rootdirectory:etc}/service
run = $${rootdirectory:var}/run
backup = $${rootdirectory:srv}/backup
promises = $${rootdirectory:etc}/promise
ssh-home = $${rootdirectory:home}/ssh
notifier = $${rootdirectory:etc}/notifier
[directory]
recipe = slapos.cookbook:mkdirectory
logrotate-entries = $${rootdirectory:etc}/logrotate.d
logrotate-backup = $${basedirectory:backup}/logrotate
cronstamps = $${rootdirectory:etc}/cronstamps
cron-entries = $${rootdirectory:etc}/cron.d
crontabs = $${rootdirectory:etc}/crontabs
cronoutput = $${basedirectory:log}/cron-ouput
pbs-backup = $${basedirectory:backup}/pbs
sshkeys = $${rootdirectory:srv}/sshkeys
pbs-wrappers = $${rootdirectory:bin}/pbs
dot-ssh = $${basedirectory:ssh-home}/.ssh
notifier-feeds = $${basedirectory:notifier}/feeds
notifier-callbacks = $${basedirectory:notifier}/callbacks
#----------------
#--
#-- Set up the equeue and notifier.
[equeue] [equeue]
recipe = slapos.cookbook:equeue recipe = slapos.cookbook:equeue
...@@ -27,6 +66,8 @@ database = $${rootdirectory:srv}/equeue.db ...@@ -27,6 +66,8 @@ database = $${rootdirectory:srv}/equeue.db
wrapper = $${basedirectory:services}/equeue wrapper = $${basedirectory:services}/equeue
equeue-binary = ${buildout:bin-directory}/equeue equeue-binary = ${buildout:bin-directory}/equeue
# notifier.notify adds the [exporter, notifier] to the execution queue
# notifier.notify.callback sets up a callback
[notifier] [notifier]
recipe = slapos.cookbook:notifier recipe = slapos.cookbook:notifier
feeds = $${directory:notifier-feeds} feeds = $${directory:notifier-feeds}
...@@ -39,34 +80,19 @@ wrapper = $${basedirectory:services}/notifier ...@@ -39,34 +80,19 @@ wrapper = $${basedirectory:services}/notifier
server-binary = ${buildout:bin-directory}/pubsubserver server-binary = ${buildout:bin-directory}/pubsubserver
notifier-binary = ${buildout:bin-directory}/pubsubnotifier notifier-binary = ${buildout:bin-directory}/pubsubnotifier
[dropbear-client] [logrotate-entry-equeue]
recipe = slapos.cookbook:dropbear.client <= logrotate
dbclient-binary = ${dropbear:location}/bin/dbclient recipe = slapos.cookbook:logrotate.d
wrapper = $${rootdirectory:bin}/ssh name = equeue
home = $${basedirectory:ssh-home} log = $${equeue:log}
identity-file = $${basedirectory:ssh-home}/id_rsa frequency = daily
rotate-num = 30
[sshkeys-directory]
recipe = slapos.cookbook:mkdirectory
requests = $${directory:sshkeys}/requests/
keys = $${directory:sshkeys}/keys/
[sshkeys-authority]
recipe = slapos.cookbook:sshkeys_authority
request-directory = $${sshkeys-directory:requests}
keys-directory = $${sshkeys-directory:keys}
keygen-binary = ${dropbear:location}/bin/dropbearkey
wrapper = $${basedirectory:services}/sshkeys_authority
[sshkeys-dropbear] #----------------
<= sshkeys-authority #--
recipe = slapos.cookbook:sshkeys_authority.request #-- The pull-backup-server contains every backup (incremental)
name = pbs #-- to prevent a corrupt dump from destroying everything.
type = rsa
executable = $${dropbear-client:wrapper}
public-key = $${dropbear-client:identity-file}.pub
private-key = $${dropbear-client:identity-file}
wrapper = $${rootdirectory:bin}/do_backup
[pbs] [pbs]
<= notifier <= notifier
...@@ -82,10 +108,10 @@ wrappers-directory = $${directory:pbs-wrappers} ...@@ -82,10 +108,10 @@ wrappers-directory = $${directory:pbs-wrappers}
notifier-url = http://[$${notifier:host}]:$${notifier:port}/ notifier-url = http://[$${notifier:host}]:$${notifier:port}/
slave-instance-list = $${slap-parameter:slave_instance_list} slave-instance-list = $${slap-parameter:slave_instance_list}
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger #----------------
wrapper = $${rootdirectory:bin}/cron_simplelogger #--
log = $${basedirectory:log}/crond.log #-- Deploy cron.
[cron] [cron]
recipe = slapos.cookbook:cron recipe = slapos.cookbook:cron
...@@ -96,6 +122,16 @@ cronstamps = $${directory:cronstamps} ...@@ -96,6 +122,16 @@ cronstamps = $${directory:cronstamps}
catcher = $${cron-simplelogger:wrapper} catcher = $${cron-simplelogger:wrapper}
binary = $${basedirectory:services}/crond binary = $${basedirectory:services}/crond
[cron-simplelogger]
recipe = slapos.cookbook:simplelogger
wrapper = $${rootdirectory:bin}/cron_simplelogger
log = $${basedirectory:log}/crond.log
#----------------
#--
#-- Deploy logrotate.
[cron-entry-logrotate] [cron-entry-logrotate]
<= cron <= cron
recipe = slapos.cookbook:cron.d recipe = slapos.cookbook:cron.d
...@@ -106,7 +142,7 @@ command = $${logrotate:wrapper} ...@@ -106,7 +142,7 @@ command = $${logrotate:wrapper}
[logrotate] [logrotate]
recipe = slapos.cookbook:logrotate recipe = slapos.cookbook:logrotate
# Binaries # Binaries
logrotate-binary = ${logrotate:location}/sbin/logrotate logrotate-binary = ${logrotate:location}/usr/sbin/logrotate
gzip-binary = ${gzip:location}/bin/gzip gzip-binary = ${gzip:location}/bin/gzip
gunzip-binary = ${gzip:location}/bin/gunzip gunzip-binary = ${gzip:location}/bin/gunzip
# Directories # Directories
...@@ -116,15 +152,7 @@ logrotate-entries = $${directory:logrotate-entries} ...@@ -116,15 +152,7 @@ logrotate-entries = $${directory:logrotate-entries}
backup = $${directory:logrotate-backup} backup = $${directory:logrotate-backup}
state-file = $${rootdirectory:srv}/logrotate.status state-file = $${rootdirectory:srv}/logrotate.status
[logrotate-entry-equeue] [logrotate-entry-cron]
<= logrotate
recipe = slapos.cookbook:logrotate.d
name = equeue
log = $${equeue:log}
frequency = daily
rotate-num = 30
[logrotate-entry-equeue]
<= logrotate <= logrotate
recipe = slapos.cookbook:logrotate.d recipe = slapos.cookbook:logrotate.d
name = cron name = cron
...@@ -133,40 +161,61 @@ frequency = daily ...@@ -133,40 +161,61 @@ frequency = daily
rotate-num = 30 rotate-num = 30
[rootdirectory] #----------------
recipe = slapos.cookbook:mkdirectory #--
etc = $${buildout:directory}/etc/ #-- sshkeys
var = $${buildout:directory}/var/
srv = $${buildout:directory}/srv/
bin = $${buildout:directory}/bin/
tmp = $${buildout:directory}/tmp/
[basedirectory] [sshkeys-directory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
log = $${rootdirectory:var}/log/ requests = $${directory:sshkeys}/requests
services = $${rootdirectory:etc}/run/ keys = $${directory:sshkeys}/keys
run = $${rootdirectory:var}/run/
backup = $${rootdirectory:srv}/backup/
promises = $${rootdirectory:etc}/promise/
[directory] [sshkeys-authority]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:sshkeys_authority
cronstamps = $${rootdirectory:etc}/cronstamps/ request-directory = $${sshkeys-directory:requests}
cron-entries = $${rootdirectory:etc}/cron.d/ keys-directory = $${sshkeys-directory:keys}
crontabs = $${rootdirectory:etc}/crontabs/ wrapper = $${basedirectory:services}/sshkeys_authority
cronoutput = $${basedirectory:log}/cron-ouput/ keygen-binary = ${dropbear:location}/bin/dropbearkey
pbs-backup = $${basedirectory:backup}/pbs/
logrotate-entries = $${rootdirectory:etc}/logrotate.d/
logrotate-backup = $${basedirectory:backup}/logrotate/
sshkeys = $${rootdirectory:srv}/sshkeys
pbs-wrappers = $${rootdirectory:bin}/pbs/
dot-ssh = $${basedirectory:ssh-home}/.ssh/
notifier-feeds = $${basedirectory:notifier}/feeds/
notifier-callbacks = $${basedirectory:notifier}/callbacks/
[basedirectory] [sshkeys-dropbear]
ssh-home = $${rootdirectory:home}/ssh <= sshkeys-authority
notifier = $${rootdirectory:etc}/notifier/ recipe = slapos.cookbook:sshkeys_authority.request
name = pbs
type = rsa
executable = $${dropbear-client:wrapper}
public-key = $${dropbear-client:identity-file}.pub
private-key = $${dropbear-client:identity-file}
wrapper = $${rootdirectory:bin}/do_backup
#----------------
#--
#-- Dropbear.
[dropbear-client]
recipe = slapos.cookbook:dropbear.client
dbclient-binary = ${dropbear:location}/bin/dbclient
wrapper = $${rootdirectory:bin}/ssh
home = $${basedirectory:ssh-home}
identity-file = $${basedirectory:ssh-home}/id_rsa
#----------------
#--
#-- Slave instance list (empty default).
[slap-parameter]
slave_instance_list = []
#----------------
#--
#-- Publish instance parameters.
[connection-dict]
recipe = slapos.cookbook:publish
ssh-key = $${sshkeys-dropbear:public-key-value}
notification-url = http://[$${notifier:host}]:$${notifier:port}/notify
feeds-url = http://[$${notifier:host}]:$${notifier:port}/get/
[rootdirectory]
home = $${buildout:directory}/home/
[buildout]
extends = ${pbsready:output}
parts += cron-entry-backup
[urls]
notification-id = http://[$${notifier:host}]:$${notifier:port}/get/$${notifier-exporter:name}
[notifier-exporter]
# notifier.notify launches an (exporter) executable, and when finished,
# notifies the the pull-backup-servers.
<= notifier
recipe = slapos.cookbook:notifier.notify
name = exporter
title = Dumping $${slap-parameter:namebase}
executable = $${exporter:wrapper}
wrapper = $${rootdirectory:bin}/exporter
notify = $${slap-parameter:notify}
[cron-entry-backup]
# Schedule the periodic database dump.
# Through notifications, this triggers (one or more) incremental backups on PBS instances.
<= cron
recipe = slapos.cookbook:cron.d
name = backup
frequency = 0 * * * *
command = $${notifier-exporter:wrapper}
[buildout]
extends = ${pbsready:output}
parts += import-on-notification
[urls]
notification-url = http://[$${notifier:host}]:$${notifier:port}/notify
[import-on-notification]
# notifier.callback runs a script when a notification (sent by a parent PBS)
# is received
<= notifier
recipe = slapos.cookbook:notifier.callback
on-notification-id = $${slap-parameter:on-notification}
callback = $${importer:wrapper}
[buildout] [buildout]
extends = ${template-mariadb:output} parts +=
resiliency
parts =
urls urls
mariadb
stunnel stunnel
certificate-authority certificate-authority
ca-stunnel ca-stunnel
logrotate logrotate
logrotate-entry-mariadb
logrotate-entry-stunnel logrotate-entry-stunnel
logrotate-entry-cron logrotate-entry-cron
logrotate-entry-equeue logrotate-entry-equeue
...@@ -21,14 +18,99 @@ parts = ...@@ -21,14 +18,99 @@ parts =
dropbear-server-pbs-authorized-key dropbear-server-pbs-authorized-key
notifier notifier
#----------------
#--
#-- Creation of all needed directories.
[basedirectory]
services = $${rootdirectory:etc}/service
cache = $${rootdirectory:var}/cache
notifier = $${rootdirectory:etc}/notifier
[directory]
backup = $${basedirectory:backup}/$${slap-parameter:namebase}
ssh = $${rootdirectory:etc}/ssh/
sshkeys = $${rootdirectory:srv}/sshkeys
notifier-feeds = $${basedirectory:notifier}/feeds
notifier-callbacks = $${basedirectory:notifier}/callbacks
#----------------
#--
#-- Resiliency script for the bully algorithm
[resiliency]
# If enable-bully-service is true, the scripts will be run automatically.
# If false, they can be run with bin/bullly for all the PBSReady instances.
enable-bully-service = False
recipe = slapos.cookbook:addresiliency
wrapper-bully = bully
wrapper-takeover = takeover
services = $${basedirectory:services}
bin = $${rootdirectory:bin}
etc = $${rootdirectory:etc}
#----------------
#--
#-- Sets up an rdiff-backup server (with a dropbear server for ssh)
[urls] [urls]
ssh-public-key = $${sshkeys-dropbear:public-key-value} ssh-public-key = $${sshkeys-dropbear:public-key-value}
ssh-url = ssh://nobody@[$${dropbear-server:host}]:$${dropbear-server:port}/$${rdiff-backup-server:path} ssh-url = ssh://nobody@[$${dropbear-server:host}]:$${dropbear-server:port}/$${rdiff-backup-server:path}
[rdiff-backup-server]
recipe = slapos.cookbook:pbs
client = false
path = $${directory:backup}
wrapper = $${rootdirectory:bin}/rdiffbackup-server
rdiffbackup-binary = ${buildout:bin-directory}/rdiff-backup
#----------------
#--
#-- Set up the equeue and notifier.
[equeue]
recipe = slapos.cookbook:equeue
socket = $${basedirectory:run}/equeue.sock
log = $${basedirectory:log}/equeue.log
database = $${rootdirectory:srv}/equeue.db
wrapper = $${basedirectory:services}/equeue
equeue-binary = ${buildout:bin-directory}/equeue
# notifier.notify adds the [exporter, notifier] to the execution queue
# notifier.notify.callback sets up a callback
[notifier]
recipe = slapos.cookbook:notifier
feeds = $${directory:notifier-feeds}
callbacks = $${directory:notifier-callbacks}
id-file = $${rootdirectory:etc}/notifier.id
equeue-socket = $${equeue:socket}
host = $${slap-network-information:global-ipv6}
port = 8080
wrapper = $${basedirectory:services}/notifier
server-binary = ${buildout:bin-directory}/pubsubserver
notifier-binary = ${buildout:bin-directory}/pubsubnotifier
[logrotate-entry-equeue]
<= logrotate
recipe = slapos.cookbook:logrotate.d
name = equeue
log = $${equeue:log}
frequency = daily
rotate-num = 30
#----------------
#--
#-- sshkeys
[sshkeys-directory] [sshkeys-directory]
recipe = slapos.cookbook:mkdirectory recipe = slapos.cookbook:mkdirectory
requests = $${directory:sshkeys}/requests/ requests = $${directory:sshkeys}/requests
keys = $${directory:sshkeys}/keys/ keys = $${directory:sshkeys}/keys
[sshkeys-authority] [sshkeys-authority]
recipe = slapos.cookbook:sshkeys_authority recipe = slapos.cookbook:sshkeys_authority
...@@ -47,6 +129,11 @@ public-key = $${dropbear-server:rsa-keyfile}.pub ...@@ -47,6 +129,11 @@ public-key = $${dropbear-server:rsa-keyfile}.pub
private-key = $${dropbear-server:rsa-keyfile} private-key = $${dropbear-server:rsa-keyfile}
wrapper = $${basedirectory:services}/sshd wrapper = $${basedirectory:services}/sshd
#----------------
#--
#-- Dropbear.
[dropbear-server] [dropbear-server]
recipe = slapos.cookbook:dropbear recipe = slapos.cookbook:dropbear
host = $${slap-network-information:global-ipv6} host = $${slap-network-information:global-ipv6}
...@@ -62,49 +149,5 @@ dropbear-binary = ${dropbear:location}/sbin/dropbear ...@@ -62,49 +149,5 @@ dropbear-binary = ${dropbear:location}/sbin/dropbear
recipe = slapos.cookbook:dropbear.add_authorized_key recipe = slapos.cookbook:dropbear.add_authorized_key
key = $${slap-parameter:authorized-key} key = $${slap-parameter:authorized-key}
[rdiff-backup-server]
recipe = slapos.cookbook:pbs
client = false
path = $${directory:mariadb-backup}
wrapper = $${rootdirectory:bin}/rdiffbackup-server
rdiffbackup-binary = ${buildout:bin-directory}/rdiff-backup
[logrotate-entry-equeue]
<= logrotate
recipe = slapos.cookbook:logrotate.d
name = equeue
log = $${equeue:log}
frequency = daily
rotate-num = 30
[equeue]
recipe = slapos.cookbook:equeue
socket = $${basedirectory:run}/equeue.sock
log = $${basedirectory:log}/equeue.log
database = $${rootdirectory:srv}/equeue.db
wrapper = $${basedirectory:services}/equeue
equeue-binary = ${buildout:bin-directory}/equeue
[notifier]
recipe = slapos.cookbook:notifier
feeds = $${directory:notifier-feeds}
callbacks = $${directory:notifier-callbacks}
id-file = $${rootdirectory:etc}/notifier.id
equeue-socket = $${equeue:socket}
host = $${slap-network-information:global-ipv6}
port = 8080
wrapper = $${basedirectory:services}/notifier
server-binary = ${buildout:bin-directory}/pubsubserver
notifier-binary = ${buildout:bin-directory}/pubsubnotifier
[basedirectory]
cache = $${rootdirectory:var}/cache/
notifier = $${rootdirectory:etc}/notifier/
[directory]
mariadb-backup = $${basedirectory:backup}/mariadb/
ssh = $${rootdirectory:etc}/ssh/
sshkeys = $${rootdirectory:srv}/sshkeys
notifier-feeds = $${basedirectory:notifier}/feeds/
notifier-callbacks = $${basedirectory:notifier}/callbacks/
## not used at the moment
[buildout]
parts =
request-pull-backup-server
[request-pull-backup-server]
<= slap-connection
recipe = slapos.cookbook:request
name = PBS (Pull Backup Server)
software-url = $${slap-connection:software-release-url}
software-type = pull-backup
return = ssh-key notification-url feeds-url
slave = false
\ No newline at end of file
## Parts Needed for the resiliency
{% macro replicate(namebase, nbbackup) %}
request-{{namebase}}
request-{{namebase}}-2
{% for i in range(1,nbbackup|int) %}
request-{{namebase}}-pseudo-replicating-{{i}}
request-{{namebase}}-pseudo-replicating-{{i}}-2
{% endfor %}
{% for i in range(1,nbbackup|int) %}
request-pbs-{{namebase}}-{{i}}
request-pull-backup-server-{{namebase}}-{{i}}
request-pull-backup-server-{{namebase}}-backup-{{i}}
{% endfor %}
{% endmacro %}
{% macro replicate(namebase, nbbackup, typeexport, typeimport, heriteLeader='', heriteBackup='') %}
## Tells the Backupable recipe that we want a backup
[resilient]
config-namebase = {{namebase}}
## Every request is double to provide the 3 IPs.
[request-{{namebase}}]
<= resilient
slap-connection
{{heriteLeader}}
software-type = {{typeexport}}
name = {{namebase}}0
return = url ssh-public-key ssh-url notification-id ip
config = number authorized-key notify ip-list namebase
config-number = 0
config-authorized-key = {% for id in range(1,nbbackup|int) %} ${request-pbs-{{namebase}}-{{id}}:connection-ssh-key}{% endfor %}
config-notify = {% for id in range(1,nbbackup|int) %} ${request-pbs-{{namebase}}-{{id}}:connection-notification-url}{% endfor %}
config-ip-list =
{% for id in range(1,nbbackup|int) %}
[request-{{namebase}}-pseudo-replicating-{{id}}]
<= slap-connection
resilient
{{heriteBackup}}
recipe = slapos.cookbook:request
name = {{namebase}}{{id}}
software-url = ${slap-connection:software-release-url}
software-type = {{typeimport}}
return = url ssh-public-key ssh-url notification-url ip
pbs-notification-id = ${slap-connection:computer-id}-${slap-connection:partition-id}-{{namebase}}-push
config = number authorized-key on-notification ip-list namebase
config-number = {{id}}
config-authorized-key = ${request-pbs-{{namebase}}-{{id}}:connection-ssh-key}
config-on-notification = ${request-pbs-{{namebase}}-{{id}}:connection-feeds-url}${:pbs-notification-id}
config-ip-list =
{% endfor %}
[iplist]
config-ip-list = ${request-{{namebase}}:connection-ip}{% for j in range(1,nbbackup|int) %} ${request-{{namebase}}-pseudo-replicating-{{j}}:connection-ip}{% endfor %}
[request-{{namebase}}-2]
<= resilient
slap-connection
iplist
{{heriteLeader}}
recipe = slapos.cookbook:request
name = {{namebase}}0
software-url = ${slap-connection:software-release-url}
software-type = {{typeexport}}
return = url ssh-public-key ssh-url notification-id ip
config = number authorized-key notify ip-list namebase
config-number = 0
config-authorized-key = {% for id in range(1,nbbackup|int) %} ${request-pbs-{{namebase}}-{{id}}:connection-ssh-key}{% endfor %}
config-notify = {% for id in range(1,nbbackup|int) %} ${request-pbs-{{namebase}}-{{id}}:connection-notification-url}{% endfor %}
{% for id in range(1,nbbackup|int) %}
[request-{{namebase}}-pseudo-replicating-{{id}}-2]
<= slap-connection
resilient
iplist
{{heriteBackup}}
recipe = slapos.cookbook:request
name = {{namebase}}{{id}}
software-url = ${slap-connection:software-release-url}
software-type = {{typeimport}}
return = url ssh-public-key ssh-url notification-url
pbs-notification-id = ${slap-connection:computer-id}-${slap-connection:partition-id}-{{namebase}}-push
config = number authorized-key on-notification ip-list namebase
config-number = {{id}}
config-authorized-key = ${request-pbs-{{namebase}}-{{id}}:connection-ssh-key}
config-on-notification = ${request-pbs-{{namebase}}-{{id}}:connection-feeds-url}${:pbs-notification-id}
{% endfor %}
## The PBS and their push / pull slaves
## Adding a PBS provides resiliency
## Adding a backup server provides availability
## Having 3 backups pulling from the same PBS provides
##only availability, not resiliency
## WARNING : SLAVES ARE ALLOCATED AT RANDOM, THIS NEEDS TO BE FIXED.
[request-pbs-common]
<= slap-connection
recipe = slapos.cookbook:request
software-url = ${slap-connection:software-release-url}
software-type = pull-backup
{% for id in range(1,nbbackup|int) %}
[request-pbs-{{namebase}}-{{id}}]
<= request-pbs-common
name = PBS ({{namebase}} / {{id}})
return = ssh-key notification-url feeds-url
slave = false
[request-pull-backup-server-{{namebase}}-{{id}}]
<= request-pbs-common
name = PBS {{id}} pulling from ${request-{{namebase}}:name}
config = url name type server-key on-notification notify notification-id title
config-url = ${request-{{namebase}}:connection-ssh-url}
config-name = ${slap-connection:computer-id}-${slap-connection:partition-id}-{{namebase}}-{{id}}
config-type = pull
config-server-key = ${request-{{namebase}}:connection-ssh-public-key}
config-on-notification = ${request-{{namebase}}:connection-notification-id}
config-notify = ${request-pbs-{{namebase}}-{{id}}:connection-notification-url}
config-notification-id = ${slap-connection:computer-id}-${slap-connection:partition-id}-{{namebase}}-{{id}}-pull
config-title = Pulling from {{namebase}}
slave = true
sla = instance_guid
sla-instance_guid = ${request-pbs-{{namebase}}-{{id}}:instance_guid}
[request-pull-backup-server-{{namebase}}-backup-{{id}}]
<= request-pbs-common
name = PBS pushing on ${request-{{namebase}}-pseudo-replicating-{{id}}:name}
config = url name type server-key on-notification notify notification-id title
config-url = ${request-{{namebase}}-pseudo-replicating-{{id}}:connection-ssh-url}
config-name = ${request-pull-backup-server-{{namebase}}-{{id}}:config-name}
config-type = push
config-server-key = ${request-{{namebase}}-pseudo-replicating-{{id}}:connection-ssh-public-key}
config-on-notification = ${request-pbs-{{namebase}}-{{id}}:connection-feeds-url}${request-pull-backup-server-{{namebase}}-{{id}}:config-notification-id}
config-notify = ${request-{{namebase}}-pseudo-replicating-{{id}}:connection-notification-url}
config-notification-id = ${request-{{namebase}}-pseudo-replicating-{{id}}:pbs-notification-id}
config-title = Pushing to {{namebase}} backup {{id}}
slave = true
sla = instance_guid
sla-instance_guid = ${request-pbs-{{namebase}}-{{id}}:instance_guid}
{% endfor %}
{% endmacro %}
...@@ -21,6 +21,7 @@ exec-sitecustomize = false ...@@ -21,6 +21,7 @@ exec-sitecustomize = false
# Add location for modified non-official slapos.buildout # Add location for modified non-official slapos.buildout
find-links += find-links +=
http://www.nexedi.org/static/packages/source/slapos.buildout/ http://www.nexedi.org/static/packages/source/slapos.buildout/
http://www.nexedi.org/static/packages/source/
# Use only quite well working sites. # Use only quite well working sites.
allow-hosts += allow-hosts +=
...@@ -51,16 +52,26 @@ versions = versions ...@@ -51,16 +52,26 @@ versions = versions
networkcache-section = networkcache networkcache-section = networkcache
# Install slapos.cookbook containing all officials recipes # Install slapos.cookbook containing all officials recipes
# Explicitely define dependencies as well, because of buildout limitation
# if using "develop"
[slapos-cookbook] [slapos-cookbook]
recipe = zc.recipe.egg recipe = zc.recipe.egg
eggs = eggs =
${lxml-python:egg} ${lxml-python:egg}
slapos.cookbook slapos.cookbook
inotifyx
netaddr
slapos.core
xml_marshaller
pytz
[versions] [versions]
# Use SlapOS patched zc.buildout # Use SlapOS patched zc.buildout
zc.buildout = 1.6.0-dev-SlapOS-010 zc.buildout = 1.6.0-dev-SlapOS-010
# zc.recipe.egg 2.0.0a is buggy
zc.recipe.egg = 1.3.2
[networkcache] [networkcache]
download-cache-url = http://www.shacache.org/shacache download-cache-url = http://www.shacache.org/shacache
download-dir-url = http://www.shacache.org/shadir download-dir-url = http://www.shacache.org/shadir
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment