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 :
.. code-block:: ini
[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`)
.. code-block:: ini
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
-------------------------
.. code-block:: ini
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
.. 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.
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.
Raw data
{
"_id": null,
"home_page": "https://lab.nexedi.com/nexedi/slapos",
"name": "slapos.cookbook",
"maintainer": "Nexedi",
"docs_url": null,
"requires_python": null,
"maintainer_email": "info@nexedi.com",
"keywords": "slapos recipe",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/0d/5d/c17ee3b79477e1f07dba62cf13af7e91b676ee6c98b43e4ba09395ad9ea0/slapos.cookbook-1.0.369.tar.gz",
"platform": null,
"description": "slapos.cookbook\n===============\n\nCookbook of SlapOS recipes.\n\n\ntesting\n=======\n\nUnit tests for recipes can be found under ``slapos/test/recipe``. To run the\ntests use provided unittest.defaultTestLoader inside ``slapos/test/test_recipe``\nby invoking \n\n python setup.py test --test-suite slapos.test.test_recipe.additional_tests\n\n\ngeneric_cloudooo\n================\n\nThe generic_cloudooo recipe helps you to deploy cloudooo services with their configuration files.\n\n\nHow to use generic_cloudooo?\n----------------------------\n\nHere is an example of a section to add in your software.cfg :\n\n.. code-block:: ini\n\n [cloudooo-configuration]\n recipe = slapos.cookbook:generic_cloudooo\n configuration-file = ${directory:etc}/cloudooo.cfg\n wrapper = ${directory:services}/cloudooo\n data-directory = ${directory:srv}/cloudooo\n ip = 0.0.0.0\n port = 1234\n ooo-paster = ${directory:bin}/cloudooo_paster\n mimetype_entry_addition =\n text/html application/pdf wkhtmltopdf\n openoffice-port = 1235\n ooo-binary-path = ${directory:libreoffice-bin}/program\n environment =\n FONTCONFIG_FILE = $${fontconfig-conf:output}\n PATH = ${binary-link:target-directory}\n ooo-uno-path = ${directory:libreoffice-bin}/basis-link/program\n\n\nWhere :\n\n- `configuration-file` is the path where the put the configuration file;\n- `wrapper` is the path where the put the final executable file;\n- `data-directory` is the folder where cloudooo would put it's temporary files;\n- `ip` and `port` is where cloudooo will listen to;\n- `ooo-paster` is the path of the program that will load cloudooo configuration\n and start the application;\n- `mimetype_entry_addition` is additional entries to give to the default\n mimetype registry. (see section below.) The mimetype entry list is sorted in\n order to make the global mimetype at the bottom of the list.\n (i.e. `* * ooo` > `text/* * ooo`)\n\n .. code-block:: ini\n\n mimetype_entry_addition =\n <input_format> <output_format> <handler>\n\n- `openoffice-port` is the port where the internal OpenOffice.org service will\n listen to;\n- `ooo-binary-path` is the path of the openoffice service executable file;\n- `environment` are environment vars to use with the openoffice binary;\n- `ooo-uno-path` is the path where UNO library is installed.\n\n\nDefault mimetype registry\n-------------------------\n\n.. code-block:: ini\n\n application/vnd.oasis.opendocument* * ooo\n application/vnd.sun.xml* * ooo\n application/pdf text/* pdf\n application/pdf * ooo\n video/* * ffmpeg\n audio/* * ffmpeg\n application/x-shockwave-flash * ffmpeg\n application/ogg * ffmpeg\n application/ogv * ffmpeg\n image/png image/jpeg imagemagick\n image/png * ooo\n image/* image/* imagemagick\n text/* * ooo\n application/zip * ooo\n application/msword * ooo\n application/vnd* * ooo\n application/x-vnd* * ooo\n application/postscript * ooo\n application/wmf * ooo\n application/csv * ooo\n application/x-openoffice-gdimetafile * ooo\n application/x-emf * ooo\n application/emf * ooo\n application/octet* * ooo\n * application/vnd.oasis.opendocument* ooo\n\n\nlibrecipe\n=========\n\nThanks to using slapos.cookbook:librecipe it is easier to create zc.buildout recipes in SlapOS environment.\n\nHow to use?\n-----------\n\nIn setup.py of recipe add only one install requires to slap.lib.recipe.\n\nIn code itself subclass from slap.lib.recipe.BaseSlapRecipe.BaseSlapRecipe.\n\nUse _install hook:\n\n::\n\n from slap.lib.recipe.BaseSlapRecipe import BaseSlapRecipe\n\n class Recipe(BaseSlapRecipe):\n ...\n def _install(self):\n # refer below for list of available objects\n specific code\n of recipe\n\nAvailable variables self.:\n\n * name and options passed by zc.buildout during init\n * work_directory -- buildout's directory\n * bin_directory -- places for generated binaries\n * running_wrapper_location -- filename of wrapper to create\n * data_root_directory -- directory container for data -- inside this\n directory it is advised to create named directories for provided servers\n which needs data\n * backup_directory -- directory container for backups -- inside this\n directory it is advised o created named directories for backups, with same\n structure as in data_root_directory\n * var_directory -- container for various, unix following things:\n\n * log_directory -- container for logs\n * run_directory -- container for pidfiles and sockets\n\n * etc_directory -- place to put named files and directories of configuration\n for provided servers\n * computer_id -- id of computer\n * computer_partition_id -- if of computer partition\n * server_url - url of Vifib server\n * software_release_url -- url of software release being instantiated\n * slap -- initialised connection to Vifib server\n * computer_partition -- initialised connection to computer partition\n * request -- shortcut to computer partition request method\n\nBy default all directories are created before calling _install hook.\n\n_install method shall return list of paths which are safe to be removed by\nbuildout during part uninstallation.\n\nImportant assumptions\n---------------------\n\nBecause in SlapOS environment zc.buildout does not know when data are changed,\nrecipes shall be always uninstalled/installed. This is done during constructing\nrecipe instance which subclasses from BaseSlapRecipe.\n\n\nmkdirectory\n===========\n\nmkdirectory loops on its options and create the directory joined\n\n.. Note::\n\n Use a slash ``/`` as directory separator. Don't use system dependent separator.\n The slash will be parsed and replace by the operating system right separator.\n\n Only use relative directory to the buildout root directory.\n\nThe created directory won't be added to path list.\n\n\nThese recipes provide the ability to save some buildout parameters and their value in a custom file, inside the instance folder.\n\nIn both recipes, you HAVE TO give a filename, which will be stored at the root of the instance folder\n\n\nWriteRecipe : \n-------------\n\n* Is used to create a section (named according to the buildout section_name).\n* You can give then as much parameters you wish, with their default values.\n* Whenever you run buildout, if the parameter has yet been saved in the config file, it will do nothing.\n* If the parameter's value has changed in the config file, it won't be overwritten\n* /!\\ 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.\n\nReadRecipe :\n\n* It fills its own section with all the options in all the sections of the config file.\n\n",
"bugtrack_url": null,
"license": "GPLv3",
"summary": "SlapOS recipes.",
"version": "1.0.369",
"project_urls": {
"Homepage": "https://lab.nexedi.com/nexedi/slapos"
},
"split_keywords": [
"slapos",
"recipe"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0d5dc17ee3b79477e1f07dba62cf13af7e91b676ee6c98b43e4ba09395ad9ea0",
"md5": "861f0a40dabf5dcae20b0f385b40d045",
"sha256": "fffd1056f3468c94031a01b2db7adb63e3340b53d7930835409138189230a6b7"
},
"downloads": -1,
"filename": "slapos.cookbook-1.0.369.tar.gz",
"has_sig": false,
"md5_digest": "861f0a40dabf5dcae20b0f385b40d045",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 104560,
"upload_time": "2024-10-04T07:48:44",
"upload_time_iso_8601": "2024-10-04T07:48:44.664049Z",
"url": "https://files.pythonhosted.org/packages/0d/5d/c17ee3b79477e1f07dba62cf13af7e91b676ee6c98b43e4ba09395ad9ea0/slapos.cookbook-1.0.369.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-04 07:48:44",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "slapos.cookbook"
}