Skip to main content

SlapOS recipes.

Project description

slapos.cookbook

Cookbook of SlapOS recipes.

testing

Unit tests for recipes can be found under slapos/test/recipe. To run the tests use provided unittest.defaultTestLoader inside slapos/test/test_recipe by invoking

python setup.py test –test-suite slapos.test.test_recipe.additional_tests

generic_cloudooo

The generic_cloudooo recipe helps you to deploy cloudooo services with their configuration files.

How to use generic_cloudooo?

Here is an example of a section to add in your software.cfg :

[cloudooo-configuration]
recipe = slapos.cookbook:generic_cloudooo
configuration-file = ${directory:etc}/cloudooo.cfg
wrapper = ${directory:services}/cloudooo
data-directory = ${directory:srv}/cloudooo
ip = 0.0.0.0
port = 1234
ooo-paster = ${directory:bin}/cloudooo_paster
mimetype_entry_addition =
  text/html application/pdf wkhtmltopdf
openoffice-port = 1235
ooo-binary-path = ${directory:libreoffice-bin}/program
environment =
  FONTCONFIG_FILE = $${fontconfig-conf:output}
  PATH = ${binary-link:target-directory}
ooo-uno-path = ${directory:libreoffice-bin}/basis-link/program

Where :

  • configuration-file is the path where the put the configuration file;

  • wrapper is the path where the put the final executable file;

  • data-directory is the folder where cloudooo would put it’s temporary files;

  • ip and port is where cloudooo will listen to;

  • ooo-paster is the path of the program that will load cloudooo configuration and start the application;

  • mimetype_entry_addition is additional entries to give to the default mimetype registry. (see section below.) The mimetype entry list is sorted in order to make the global mimetype at the bottom of the list. (i.e. * * ooo > text/* * ooo)

    mimetype_entry_addition =
      <input_format> <output_format> <handler>
  • openoffice-port is the port where the internal OpenOffice.org service will listen to;

  • ooo-binary-path is the path of the openoffice service executable file;

  • environment are environment vars to use with the openoffice binary;

  • ooo-uno-path is the path where UNO library is installed.

Default mimetype registry

application/vnd.oasis.opendocument* * ooo
application/vnd.sun.xml* * ooo
application/pdf text/* pdf
application/pdf * ooo
video/* * ffmpeg
audio/* * ffmpeg
application/x-shockwave-flash * ffmpeg
application/ogg * ffmpeg
application/ogv * ffmpeg
image/png image/jpeg imagemagick
image/png * ooo
image/* image/* imagemagick
text/* * ooo
application/zip * ooo
application/msword * ooo
application/vnd* * ooo
application/x-vnd* * ooo
application/postscript * ooo
application/wmf * ooo
application/csv * ooo
application/x-openoffice-gdimetafile * ooo
application/x-emf * ooo
application/emf * ooo
application/octet* * ooo
* application/vnd.oasis.opendocument* ooo

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.

mkdirectory

mkdirectory loops on its options and create the directory joined

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

These recipes provide the ability to save some buildout parameters and their value in a custom file, inside the instance folder.

In both recipes, you HAVE TO give a filename, which will be stored at the root of the instance folder

WriteRecipe :

  • Is used to create a section (named according to the buildout section_name).

  • You can give then as much parameters you wish, with their default values.

  • Whenever you run buildout, if the parameter has yet been saved in the config file, it will do nothing.

  • If the parameter’s value has changed in the config file, it won’t be overwritten

  • /!If you decide to change the default value of one parameter, ALL other parameters will be reseted in the config file, even if you changed it manually. Explanation : The default values aren’t expected to change, except while development purposes.

ReadRecipe :

  • It fills its own section with all the options in all the sections of the config file.

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.

Source Distribution

slapos_cookbook-1.0.477.tar.gz (113.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

slapos_cookbook-1.0.477-py3-none-any.whl (181.5 kB view details)

Uploaded Python 3

File details

Details for the file slapos_cookbook-1.0.477.tar.gz.

File metadata

  • Download URL: slapos_cookbook-1.0.477.tar.gz
  • Upload date:
  • Size: 113.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for slapos_cookbook-1.0.477.tar.gz
Algorithm Hash digest
SHA256 327d00d0fa3caf5676e127ebdabe1487e52ab5a08164134dfa3ec6a3ce348dfe
MD5 e62bbd6a5f07fec0344e7a78f4646aff
BLAKE2b-256 b10efa72957b741f2497efb522554e75bfeebd561941056d1201ec1c19076e9e

See more details on using hashes here.

File details

Details for the file slapos_cookbook-1.0.477-py3-none-any.whl.

File metadata

File hashes

Hashes for slapos_cookbook-1.0.477-py3-none-any.whl
Algorithm Hash digest
SHA256 48b4897447f16189c48f6f3f1654b4f79a41700f6975ac930c4f76eab49387f7
MD5 18eea44be77edd1dd5cbd0b44eff7b66
BLAKE2b-256 655c95f59c8e0959a3277621fc95ba695d84e9190d7d991514857b0e798c5ff9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page