skip to navigation
skip to content

slapos.cookbook 0.54.1

SlapOS recipes.

Latest Version: 1.0.53


Cookbook of SlapOS recipes.


0.54.1 (2012-06-18)

* Fix 0.54 release containing wrong code in

0.54 (2012-06-18)

* Apache frontend: won't block sending slave informations to SlapOS Master
in case of problem from one slave instance.[Cedric de Saint Martin]
* Apache frontend will send IP informations for slaves in case slave is about
custom domain. [Cedric de Saint Martin]
* Ability to use LAMP applications without configuration. [Cedric de Saint
* Users can specify custom domain in LAMP applications. [Cedric de Saint

0.53 (2012-06-07)

* Switch slaprunner into generic recipe, and add cloud9 recipe. [Cedric de
Saint Martin]

0.52 (2012-05-16)

* Request bugfix: Correct default software_type (was: RootInstanceSoftware).
[Cedric de Saint Martin]
* Request will raise again if requested instance is not ready
[Romain Courteaud]
* Apache Frontend: assume apache is available from standard ports.
Consequence: url connection parameter of slave instance doesn't contain
port. [Cedric de Saint Martin]
* Apache Frontend bugfix: correctly detect slave instance type (zope).
[Cedric de Saint Martin]
* Apache Frontend: "default" slave instances are available through http
in addition to https. [Cedric de Saint Martin]
* Apache Frontend: Configuration: Add mod_deflate and set ProxyPreserveHost
[Cedric de Saint Martin]

0.51 (2012-05-14)

* LAMP stack bugfix: Users were losing data when slapgrid is ran (Don't
erase htdocs if it already exist). [Cedric de Saint Martin]

0.50 (2012-05-12)

* LAMP stack bugfix: fix a crash where recipe was trying to restart
non-existent httpd process. [Cedric de Saint Martin]
* LAMP stack bugfix: don't erase htdocs at update [Cedric de Saint Martin]
* Apache Frontend: Improve Apache configuration, inspired by Nexedi
production frontend. [Cedric de Saint Martin]
* Allow sysadmin of node to customize frontend instance.
[Cedric de Saint Martin]
* Apache Frontend: Change 'zope=true' option to 'type=zope'.
[Cedric de Saint Martin]
* Apache Frontend: listens to plain http port as well to redirect to https.
[Cedric de Saint Martin]

0.49 (2012-05-10)

* Apache Frontend supports Zope and Varnish. [Cedric de Saint Martin]

0.48 (2012-04-26)

* New utility recipe: slapos.recipe.generate_output_if_input_not_null.
[Cedric de Saint Martin]
* New promise recipe: slapos.recipe.url_available: check if url returns http
code 200. [Cedric de Saint Martin]
* Fix: slapos.recipe.request won't raise anymore if instance is not ready.
[Cedric de Saint Martin]
* Fix: slapos.recipe.request won't assume instance reference if not
specified. [Cedric de Saint Martin]

0.47 (2012-04-19)

* Slap Test Agent [Yingjie Xu]

0.46 (2012/04/12)

* xvfb and firefox initial release [Romain Courteaud]

0.45 (2012-03-29)

* slaprunner: change number of available partitions to 7 [Alain Takoudjou]

0.44 (2012-03-28)

* minor: apachephp: update apache configuration to work with Apache2.4

0.43 (2012-03-28)

* minor: erp5: add missing .zcml files into egg. [Cedric de Saint Martin]

0.42 (2012-03-26)

* erp5: Add web_checker recipe. [Tatuya Kamada]
* erp5: Add generic_varnish recipe. [Tatuya Kamada]
* erp5: Simplify erp5_update to only create the ERP5 site. [Romain Courteaud]
* erp5: Allow to pass CA parameters from section. [Łukasz Nowak]

0.41 (2012-03-21)

* Release new "generic" version of KVM, includes frontend.
[Cedric de Saint Martin]

0.40.1 (2012-03-01)

* Fix manifest to include files needed for apache. [Cedric de Saint Martin]

0.40 (2012-03-01)

* apache_frontend initial release. [Cedric de Saint Martin]

0.39 (2012-02-20)

* seleniumrunner initial release. [Cedric de Saint Martin]

0.38 (2011-12-05)

* erp5: Swtich to percona, as maatkit is obsoleted. [Sebastien Robin]
* erp5: Improve haproxy configuration. [Sebastien Robin]
* erp5: Support sphinxd. [Kazuhiko Shiozaki]
* erp5: Improve and make logging more usual. [Sebastien Robin]
* erp5: Allow mysql connection from localhost. [Romain Courteaud]
* erp5: Allow to control Zope/Zeo cache [Arnaud Fontaine]
* erp5: Increase precision in logs [Julien Muchembled]
* erp5: Improve erp5 update [Arnaud Fontaine, Rafael Monnerat]

0.37 (2011-11-24)

* KVM : allow access to several KVM instances without SSL certificate duplicate
problem. [Cedric de Saint Martin]

0.36 (2011-11-16)

* erp5testnode : the code of testnode is not in slapos repository anymore

0.35 (2011-11-10)

* KVM : Promise are now working properly. [Łukasz Nowak]
* KVM : Use NoVNC with automatic login. [Cedric de Saint Martin]
* KVM : Use websockify egg and remove numpy hack. [Cedric de Saint Martin]

0.34 (2011-11-08)

* Any LAMP software can specify its own php.ini [Alain Takoudjou]
* LAMP : Fix bug where buildout does not has sufficient rights to update
application parts. [Alain Takoudjou]
* LAMP : Update formatting when returning list of renamed files.
[Alain Takoudjou]

0.33 (2011-10-31)

* erp5 : use percona toolkit instead of maatkit [Sebastien Robin]

0.32 (2011-10-28)

* LAMP : Recipe can now call lampconfigure from slapos.toolbox which will
configure PHP application instance when needed. [Alain Takoudjou Kamdem]

0.31 (2011-10-16)

* Split big redundant recipes into small ones. In order to factorize the code
and have everything in the buildout file. [Antoine Catton, Romain Courteaud,
Łukasz Nowak]
* LAMP : Update apache and php configuration files to work with a lot of different
PHP software. [Alain Takoudjou Kamdem]
* LAMP : Recipe can launch scripts, move or remove files or directories
when a given condition is filled. Useful when PHP apps require you to
remove "admin" directory after configuration for example.
[Alain Takoudjou Kamdem]

0.30 (2011-10-06)

* LAMP : Update apache and php configuration files to work with a lot of different
PHP software. [Alain Takoudjou Kamdem]

0.29 (2011-09-28)

* mysql: bug fix on database recovering (avoid importing dump two times). [Antoine Catton]

0.28 (2011-09-27)

* lamp.request: requesting the mariadb software release instead of itself. [Antoine Catton]
* lamp.request: adding support of remote backup repo (using a different
software type). The default remote backup is a davstorage. [Antoine Catton]

0.27 (2011-09-27)

* mysql: add backup and backup recovering using different software type. [Antoine Catton]

0.26 (2011-09-27)

* Davstorage: returning more explicit url (using webdav scheme). [Antoine Catton]
* Other mysql minor fixes. [Antoine Catton]

0.25 (2011-09-21)

* mysql: Restore to default behaviour. [Antoine Catton]
* mysql: Use mysqldump instead of non trustable backup system. [Antoine Catton]

0.24 (2011-09-19)

* mysql: Unhardcode the requested url. [Antoine Catton]

0.23 (2011-09-19)

* Clean code in mysql recipe [Cedric de Saint Martin]
* librecipe: Provide createPromiseWrapper method. [Antoine Catton]
* kvm: Expose promisee checks to slapgrid. [Antoine Catton]
* davstorage: Initial version. [Antoine Catton]
* mysql: Support DAV backup. [Antoine Catton]

0.22 (2011-09-12)

* Fix haproxy setup for erp5 [Sebastien Robin]

0.21 (2011-09-12)

* Update PHP configuration to set session and date options.
[Alain Takoudjou Kamdem]
* Improve logrotate policy and haproxy config for erp5
[Sebastien Robin]

0.20 (2011-09-07)

* Update and fix KVM/noVNC installation to be compatible with new WebSocket
protocol (HyBi-10) required by Chrome >= 14 and Firefox >= 7.
[Cedric de Saint Martin]

0.19 (2011-09-06)

* Update PHP configuration to disable debug logging. [Cedric de Saint Martin]

0.18 (2011-08-25)

* Repackage egg to include needed .bin files. [Cedric de Saint Martin]

0.17 (2011-08-25)

* Add XWiki software release [Cedric de Saint Martin]

0.16 (2011-07-15)

* Improve Vifib and pure ERP5 instantiation [Rafael Monnerat]
* Use configurator for Vifib [Rafael Monnerat]

0.15 (2011-07-13)

* Encrypt connection by default. [Vivien Alger]

0.14 (2011-07-13)

* Provide new way to instantiate kvm. [Cedric de Saint Martin, Vivien Alger]

0.13 (2011-07-13)

* Implement generic execute_wait wrapper, which allows to wait for some files
to appear before starting service depending on it. [Łukasz Nowak]

0.12 (2011-07-11)

* Fix slaprunner, phpmyadmin software releases, added
wordpress software release. [Cedric de Saint Martin]

0.11 (2011-07-07)

* Enable test suite runner for vifib.

0.10 (2011-07-01)

* Add PHPMyAdmin software release used in SlapOS tutorials
[Cedric de Saint Martin]
* Add slaprunner software release [Cedric de Saint Martin]

0.9 (2011-06-24)

* mysql recipe : Changing slapos.recipe.erp5.execute to
slapos.recipe.librecipe.execute [Cedric de Saint Martin]

0.8 (2011-06-15)

* Add MySQL and MariaDB standalone software release and recipe
[Cedric de Saint Martin]
* Fixed slapos.recipe.erp5testnode instantiation [Sebastien Robin]

0.7 (2011-06-14)

* Fix slapos.recipe.erp5 package by providing site.zcml in it. [Łukasz Nowak]
* Improve slapos.recipe.erp5testnode partition instantiation error reporting
[Sebastien Robin]

0.6 (2011-06-13)

* Fixed slapos.recipe.erp5 instantiation. [Łukasz Nowak]

0.5 (2011-06-13)

* Implement zabbix agent instantiation. [Łukasz Nowak]
* Drop dependency on Zope2. [Łukasz Nowak]
* Share more in slapos.recipe.librecipe module. [Łukasz Nowak]

0.4 (2011-06-09)

* Remove reference to slapos.tool.networkcache as it was removed from pypi. [Łukasz Nowak]
* Add Kumofs standalone software release and recipe [Cedric de Saint Martin]
* Add Memcached standalone software release and recipe [Cedric de Saint Martin]

0.3 (2011-06-09)

* Moved out template and build to separate distributions [Łukasz Nowak]
* Depend on slapos.core instead of depracated slapos.slap [Romain Courteaud]
* Fix apache module configuration [Kazuhiko Shiozaki]
* Allow to control full environment in erp5 module [Łukasz Nowak]

0.2 (2011-05-30)

* Allow to pass zope_environment in erp5 entry point [Łukasz Nowak]

0.1 (2011-05-27)

* All slapos.recipe.* became slapos.cookbook:* [Łukasz Nowak]


Instantiates CloudOOo instance.


Instantiates ERP5 instance.



Instantiates KumoFS instance.



The erp5.recipe.kvm aims to integrate KVM setups and buildout. This recipe is
able to download one remote image and setup a KVM environment to use it.

This recipe is also capable to reuse images or partitions already present on
disk to create the setup.


The follow examples lists different kind of configurations.

KVM with Remote and gzipped Image


image = http://URL/public.mdv2010.0_x86_64.qcow2.img.gz

# md5 checks are optional
md5_download = adcff8adcff8adcff8adcff8
md5_image = 1a4e371a4e371a4e371a4e371a4e37

gzip = true

# Use -hda instead -drive arg
# Default is drive (see Options bellow)
image_type = hda

### Common Configuration bellow. ###

# VNC is optional
kvm_vnc = <some-ip>:<vnc-display>

# Graphic is optional
kvm_graphic = std

# Define list of redirections.
kvm_redir =

kvm_net =

# This automatically create a redirection for 13456 -> 22
ssh_port = 13456
ssh_key_path = /path/to/mykey.key

KVM with Remote and raw Image


image = http://URL/public.mdv2010.0_x86_64.qcow2.img
md5_download = 1a4e371a4e371a4e371a4e371a4e37
md5_image = 1a4e371a4e371a4e371a4e371a4e37

gzip = false

### The Rest Same configuration as previous ###

KVM with direct local Image file

This does not copy and/or download the image::


file = /home/you/public.mdv2010.0_x86_64.qcow2.img
md5_image = 1a4e371a4e371a4e371a4e371a4e37

### The Rest Same configuration as previous ###

KVM with a linux partition

This does not copy and/or download the image::


file = /dev/sdb

### The Rest Same configuration as previous ###



When define, it does not use buildout parts directory to allocate the image.


URL to a remote image.


Use file makes recipe ignore image option. You can define a path to a image
or partion to use.


You can define how the KVM will use the image with "-hdx" or "-drive". By
default it uses drive and the result is:

"kvm -drive file=IMAGE,if=virtio,cache=none,boot=on ..."

if you use image_type=hda:

"kvm -hda IMAGE ..."


If true means the image is compressed (gzipped), and the recipe will
uncompress the image before copy it.


When defined, this values is used to verify the file downloaded.


When defined, this values is used to verify the image generated, don't use it
when a partition is used in file parameter.


Define the ip-address:display used by KVM to start the VNC server. If not
defined, no VNC port is created.


Define port redirections to the buildout.


If defined it adds the "-vga value" at the KVM command.


Define the net definitions, each value defines one "-net" in kvm command.

kvm_net =

It generates:

"kvm -net user,hostname=publicmandriva -net nic,model=ne2k_pci ..."


Use "-snapshot" when run a KVM. This not write the changes direct into the
image. Default value is False.


If defined creates a new redirection for port 22 and creates few script to
connect to the instance.


By default it uses localhost. You don't need to define this.


Path to the ssh key used to connect without password to the image running.


Define the server that will be used to connect to the instance.


Place where the scripts will be created. By default it uses bin-directory from


Place where the pid file will be created, by default it uses var-directory
from buildout.

Generated Commands

Few scripts are generated to you manage your KVM instance. The scripts names are
created with the followed standard:


Commands usage

KVM-PARTS-NAME-ctl (start|stop|status|restart)

This script is used to manage the KVM instance.


Copy the local file to a remote place.


Copy the remote file to a local place.


Run a command into remote KVM computer.



The ``slapos.recipe.kvm_frontend`` aims to provide proxy server to KVM instances.

It allows HTTPS IPv4/IPv6 proxying (with or without domain name), and supports
the WebSocket technology needed for VNC-in-webapplication noVNC.

It works following the master/slave instances system. A master instance is
created, containing all what is needed to run the proxy. Slave instances
are later created, adding one line in the master instance's proxy configuration
that specify the IP/port to proxy to the KVM.

The slave instance (kvm) is then accessible from

Instance parameters

Incoming master instance parameters

``port`` - Port of server, optional, defaults to 4443.
``domain`` - domain name to use, optional, default to
``redirect_plain_http`` - if value is one of ['y', 'yes', '1', 'true'], instance
will try to create a simple http server on port 80
redirecting to the proxy. Optional.

Incoming slave instance parameters

``host`` - KVM instance IP or hostname. Mandatory.
``port`` - KVM instance port, Mandatory.
``https`` - if value is one of ['n', 'no', '0', 'false'], will try to connect
to target in plain http. Optional.

Connection parameters

Outgoing master connection parameters

``domain_ipv6_address`` - Proxy IP
``site_url`` - Proxy URL

Outgoing slave connection parameters are :

``site_url`` - URL of instance
``domain_name`` - Domain name of proxy
``port`` - Port of proxy


The lamp recipe helps you to deploy simply a php based application on slapos. This recipe is
able to setup mariadb, apache and apache-php for your php application, and is also capable of
configuring your software during installation to ensure a full compatibility.

How to use?

just add this part in your software.cfg to use the lamp.simple module

egg = slapos.cookbook
module = lamp.simple

you also need to extend lamp.cfg

extends =


When you install some software (such as prestashop) you need to remove or rename folder, with slapos you can not
access to the www-data directory. to do this, you need to tell to lamp recipe to remove or/and it when software
will be instantiated. Some software requires more than rename or delete a folder (manualy create database etc...)
in this case you need to write a python script and lamp recipe must run it when installing your software.

How to use?

this part of lamp recipe work with slapos.toolbox, Therefore you must add it to your recipe.
in software.cfg, replace instance-recipe-egg part by

recipe = zc.recipe.egg
python = python2.7
eggs =

and add into your instance.cfg

lampconfigure_directory = ${buildout:bin-directory}/lampconfigure


the action (delete, rename, script, chmod) only starts when the condition is filled.
in instance.cfg, add

file_token = path_of_file

and the action will begin when path_of_www-data/path_of_file will be created
you can also use database to check condition. add

table_name = name_of_table
constraint = sql_where_condition

name_of_table is the full or partial name(in some cases we can not know the prefix used to create tables) of table
into mariadb databse for example table_name = admin. if you use
name_of_table = **, the action will begin when database is ready.
constraint is the sql_condition to use when search entry into name_of_table for example constraint = `admin_id`=1

you can't use file_token and table_name at the same time, otherwise file_token will be used in priority. Beware of conditions that will never be satisfied.

The action starts when condition is true
1- delete file or folder
into instance.cfg, use

delete = file_or_folder1, file_or_folder2, file_or_folder3 ...

for example delete = admin

2- rename file or folder
into instance.cfg, use

rename_chmod = mode (optional)
rename = old_name1 => new_name1, old_name2 => new_name2, ...

you can also use
rename = old_name1, old_name2 => new_name2, ... in this case old_name1 will be rename and the new name will be chose
by joining old_name1 and mysql_user: this should give
rename = old_name1 => old_name1-mysql_user, old_name2 => new_name2, ...
use rename_chmod to apply a mode to new_name1, new_name2, ...

3- Change mode of file or directory

this is usefull if you want to change the mode of files into your www-data, use

chmod = file1, file2, ....
mode = mode_to_apply (ex= 0644)

4- Launch python script

use script = ${configure-script:location}/${configure-script:filename} into instance.cfg, add part configure-script
into software.cfg

parts = configure-script

recipe =
location = ${buildout:parts-directory}/${:_buildout_section_name_}
url =
filename =
download-only = True

The should contain a main function, sys.argv is given to the main. you can write like this
def setup(args):
mysql_port, mysql_host, mysql_user, mysql_password, mysql_database, base_url, htdocs = args

if __name__ == '__main__':

base_url: is the url of php software
htdocs: is the path of www-data directory
mysql_user, mysql_password, mysql_database, mysql_host: is the mariadb parameters
you can also use "import MySQLdb" if you want to access to database via your python script


Slapified recipe to interact with any libcloud supported IaaS system



Thanks to using slapos.cookbook:librecipe it is easier to create zc.buildout recipes in SlapOS environment.

How to use?

In of recipe add only one install requires to slap.lib.recipe.

In code itself subclass from slap.lib.recipe.BaseSlapRecipe.BaseSlapRecipe.

Use _install hook:


from slap.lib.recipe.BaseSlapRecipe import BaseSlapRecipe

class Recipe(BaseSlapRecipe):
def _install(self):
# refer below for list of available objects
specific code
of recipe

Available variables self.:

* name and options passed by zc.buildout during init
* work_directory -- buildout's directory
* bin_directory -- places for generated binaries
* running_wrapper_location -- filename of wrapper to create
* data_root_directory -- directory container for data -- inside this
directory it is advised to create named directories for provided servers
which needs data
* backup_directory -- directory container for backups -- inside this
directory it is advised o created named directories for backups, with same
structure as in data_root_directory
* var_directory -- container for various, unix following things:

* log_directory -- container for logs
* run_directory -- container for pidfiles and sockets

* etc_directory -- place to put named files and directories of configuration
for provided servers
* computer_id -- id of computer
* computer_partition_id -- if of computer partition
* server_url - url of Vifib server
* software_release_url -- url of software release being instantiated
* slap -- initialised connection to Vifib server
* computer_partition -- initialised connection to computer partition
* request -- shortcut to computer partition request method

By default all directories are created before calling _install hook.

_install method shall return list of paths which are safe to be removed by
buildout during part uninstallation.

Important assumptions

Because in SlapOS environment zc.buildout does not know when data are changed,
recipes shall be always uninstalled/installed. This is done during constructing
recipe instance which subclasses from BaseSlapRecipe.


Instantiates Memcached instance.


mkdirectory loops on its options and create the directory joined

.. Note::

Use a slash ``/`` as directory separator. Don't use system dependent separator.
The slash will be parsed and replace by the operating system right separator.

Only use relative directory to the buildout root directory.

The created directory won't be added to path list.


Instantiates MySQL instance.



Instantiate an proactive environment.

Allows to run selenium tests through browser and xvfb. Posts the results on
Nexedi ERP5.

* project : name of the project inside of ERP5 test result instance
* user : username to use in ERP5 instance to test
* password : password to use in ERP5 instance to test
* suite_name : name of test suite to launch
* url : url to portal_test of ERP5 isntance to test
* test_report_instance_url : url of test_result_module to put results

* Example :

<parameter id="project">Vifib</parameter>
<parameter id="user">myuser</parameter>
<parameter id="password">mypassword</parameter>
<parameter id="suite_name">my_zuite</parameter>
<parameter id="url">https://myerp5totest/erp5/portal_tests</parameter>
<parameter id="test_report_instance_url"></parameter>





Generic testnode.



Instantiates an xwiki environment.

File Type Py Version Uploaded on Size
slapos.cookbook-0.54.1.tar.gz (md5) Source 2012-06-18 214KB