SlapOS recipes.
Project description
slapos.cookbook
0.1 (2011-05-27)
All slapos.recipe.* became slapos.cookbook:* [Łukasz Nowak]
build
Recipe to build the software.
Example buildout:
[buildout] parts = file [zlib] # Use standard configure, make, make install way recipe = slapos.cookbook:build url = http://prdownloads.sourceforge.net/libpng/zlib-1.2.5.tar.gz?download md5sum = c735eab2d659a96e5a594c9e8541ad63 slapos_promisee = directory:include file:include/zconf.h file:include/zlib.h directory:lib statlib:lib/libz.a dynlib:lib/libz.so linked:libc.so.6 rpath: dynlib:lib/libz.so.1 linked:libc.so.6 rpath: dynlib:lib/libz.so.1.2.5 linked:libc.so.6 directory:lib/pkgconfig file:lib/pkgconfig/zlib.pc directory:share directory:share/man directory:share/man/man3 file:share/man/man3/zlib.3 [file] recipe = slapos.cookbook:buildcmmi url = ftp://ftp.astron.com/pub/file/file-5.04.tar.gz md5sum = accade81ff1cc774904b47c72c8aeea0 environment = CPPFLAGS=-I${zlib:location}/include LDFLAGS=-L${zlib:location}/lib -Wl,-rpath -Wl,${zlib:location}/lib slapos_promisee = directory:bin dynlib:bin/file linked:libz.so.1,libc.so.6,libmagic.so.1 rpath:${zlib:location}/lib,!/lib directory:include file:include/magic.h directory:lib statlib:lib/libmagic.a statlib:lib/libmagic.la dynlib:lib/libmagic.so linked:libz.so.1,libc.so.6 rpath:${zlib:location}/lib dynlib:lib/libmagic.so.1 linked:libz.so.1,libc.so.6 rpath:${zlib:location}/lib dynlib:lib/libmagic.so.1.0.0 linked:libz.so.1,libc.so.6 rpath:${zlib:location}/lib directory:share directory:share/man directory:share/man/man1 file:share/man/man1/file.1 directory:share/man/man3 file:share/man/man3/libmagic.3 directory:share/man/man4 file:share/man/man4/magic.4 directory:share/man/man5 directory:share/misc file:share/misc/magic.mgc [somethingelse] # default way with using script recipe = slapos.cookbook:build url_0 = http://host/path/file.tar.gz md5sum = 9631070eac74f92a812d4785a84d1b4e script = import os os.chdir(%(work_directory)s) unpack(%(url_0), strip_path=True) execute('make') execute('make install DEST=%(location)s') slapos_promisee = ...
TODO:
add linking suport, buildout definition:
slapos_link = <relative/path> [optional-path
can be used as:
[file] slapos_link = bin/file bin/file ${buildout:bin-directory}/bin/anotherfile
Which will link ${file:location}/bin/file to ${buildout:bin-directory}/bin/file and ${file:location}/bin/file to ${buildout:bin-directory}/bin/anotherfile
download
Extremely simple recipe to download using zc.buildout download utility.
Usage
[buildout] parts = download [download] recipe = slapos.cookbook:download url = https://some.url/file
Such profile will download https://some.url/file and put it in buildout:parts-directory/download/download
filename parameter can be used to change destination named filename.
destination parameter allows to put explicit destination.
md5sum parameter allows pass md5sum.
mode (octal, so for rw-r–r– use 0644) allows to set mode
Exposes target attribute which is path to downloaded file.
Notes
This recipe suffers from buildout download utility issue, which will do not try to redownload resource with wrong md5sum.
erp5
Instantiates ERP5 instance.
erp5testnode
helloworld
It only installs a dummy wrapper saying “Hello World!” and sends to the master an “HelloWorld” parameter.
java
This recipe downloads and installs java in your buildout.
Buildout configuration:
Add this section to your buildout configuration:
[buildout] parts = ... your other parts ... java ... [java] recipe = slapos.cookbook:javaBy default it will fetch Java 6u25, but you might want to install from another location or another version like this:
[java] recipe = slapos.cookbook:java download-url = ftp://location/to/self-extracting/java.binOr you can install openjdk instead.
[java] recipe = slapos.cookbook:java flavour = openjdk
Notes:
This recipe only works with linux at the moment
This recipe requires rpm2cpio and cpio to be installed on your system.
kvm
Introduction
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.
Examples
The follow examples lists different kind of configurations.
KVM with Remote and gzipped Image
[kvm-testing-with-remote-gzip-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 = tcp:13480::80 kvm_net = user,hostname=publicmandriva nic,model=ne2k_pci # This automatically create a redirection for 13456 -> 22 ssh_port = 13456 ssh_key_path = /path/to/mykey.key
KVM with Remote and raw Image
[kvm-testing-with-remote-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:
[kvm-testing-with-local-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:
[kvm-testing-a-linux-partition] file = /dev/sdb ### The Rest Same configuration as previous ###
Options
location
When define, it does not use buildout parts directory to allocate the image.
image
URL to a remote image.
file
Use file makes recipe ignore image option. You can define a path to a image or partion to use.
image_type
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 …”
gzip
If true means the image is compressed (gzipped), and the recipe will uncompress the image before copy it.
md5_download
When defined, this values is used to verify the file downloaded.
md5_image
When defined, this values is used to verify the image generated, don’t use it when a partition is used in file parameter.
kvm_vnc
Define the ip-address:display used by KVM to start the VNC server. If not defined, no VNC port is created.
kvm_redir
Define port redirections to the buildout.
kvm_graphic
If defined it adds the “-vga value” at the KVM command.
kvm_net
Define the net definitions, each value defines one “-net” in kvm command. Example:
- kvm_net =
user,hostname=publicmandriva nic,model=ne2k_pci
It generates:
“kvm -net user,hostname=publicmandriva -net nic,model=ne2k_pci …”
kvm_snapshot
Use “-snapshot” when run a KVM. This not write the changes direct into the image. Default value is False.
ssh_port
If defined creates a new redirection for port 22 and creates few script to connect to the instance.
ssh_hostname
By default it uses localhost. You don’t need to define this.
ssh_key_path
Path to the ssh key used to connect without password to the image running.
ssh_user
Define the server that will be used to connect to the instance.
kvm_bin_directory
Place where the scripts will be created. By default it uses bin-directory from buildout.
kvm_run_directory
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:
KVM-PARTS-NAME-ctl
Commands usage
KVM-PARTS-NAME-ctl (start|stop|status|restart)
This script is used to manage the KVM instance.
KVM-PARTS-NAME-sendfile REMOTEFILE LOCALFILE
Copy the local file to a remote place.
KVM-PARTS-NAME-getfile REMOTEFILE LOCALFILE
Copy the remote file to a local place.
KVM-PARTS-NAME-runscript COMMAND
Run a command into remote KVM computer.
libcloud
Slapified recipe to interact with any libcloud supported IaaS system
libcloudrequest
librecipe
Thanks to using slapos.cookbook:librecipe it is easier to create zc.buildout recipes in SlapOS environment.
How to use?
In setup.py 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.
nbdserver
nosqltestbed
proactive
Instantiate an proactive environment.
sheepdogtestbed
siptester
slaprunner
template
Fully networked template recipe, reusing collective.recipe.template with ability to download template over the network
Usage
[buildout] parts = template [template] recipe = slapos.cookbook:template url = http://server/with/template # optional md5sum md5sum = 1234567890 output = ${buildout:directory}/result
All parameters except url and md5sum will be passed to collective.recipe.template, so please visit http://pypi.python.org/pypi/collective.recipe.template for full information.
testnode
Generic testnode.
vifib
xwiki
Instantiates an xwiki environment.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.