Most Powerful Open Source ERP

ERP5 Installation With SlapOS

  • Last Update:2014-10-06
  • Version:002
  • Language:en

This documentation will be soon become outdated. It will be replaced by the following documentation How to install ERP5 and UNG instances with SlapOS and a simplified installer for SlapOS based on the SlapOS lecture

How To deploy ERP5 with SlapOS?

Notes

This tutorial is used to install and/or develop ERP5 on your own machine. If you want to install a SlapOS master (Vifib clone), please go to http://www.slapos.org instead.

What is SlapOS?

SlapOS is a fully automated system to provide and manage services in a computer cloud. As described in this introduction, a SlapOS cloud is composed of 2 types of components: a SlapOS Master and many SlapOS Nodes.

A SlapOS Node is a computer which provides resources (disk space, IP, CPU) to the Cloud which can be used by Cloud users to instantiate some network services (KVM, ERP5 instance, Web Desktop, Mail server, Subversion server, NBD server, bittorrent server, etc.).

SlapOS Master is a REST web service used to store the Node configurations and assign them some tasks to execute.

Communication to SlapOS Master is achieved through slapos.slap python library which allows a user to directly from a python console manage his servers in the cloud, provide new services and much more.

All tasks on the node level are executed by a python daemon slapos.slapgrid which configure the node and report needed informations.

As the goal is to allow as many exotic environments to join the cloud, all software provided by the cloud should not be dependant to the OS configurations, and so, their installation should be OS-independent.  The choice we made is the use buildout to provide installation/instantiation functionalities.

How can I provide ERP5 to the SlapOS cloud?

This tutorial is separated in several steps. First, you will install, configure and run a small SlapOS daemon acting as a SlapOS Master "Light". It will be used to bootstrap the real SlapOS Master. Then, you will request the installation of the SlapOS Master with those utilities. Finally, you will instantiate SlapOS Master.

Providing a software is done in 2 steps.

First one is to install all binaries needed to run the software. This means, compiling software, getting binaries, installing python eggs, ...

The second step is to instantiate the software. This step means creating run directory, configuration files and startup scripts.  SlapOS requirement for this part is that it has to be fast (<1s) and in order to reach that goal, the software step has to provide all needed tools to the instantiation.

In order to understand more precisely, please look at this ERP5 Software Release.

The installation profile (software.cfg) provides all binaries, but it also provides the instantiation recipe (slapos.recipe.erp5) and the instantiation profile (in the template section).  Then, instantiation profile just have to use the instantiation recipe and nothing else.

Currently, the installation of the software will take hours due to slapgrid compiling all the dependencies of ERP5. Once a binary cache system is added, it will take only a few minutes.

Commands prepended with $ might be run as ordinary user, commands prepended by # requires superuser privileges.

Step 1: install SlapOS

Currently, some dependencies are still required to run slap. You will need the gcc and g++ compiler, uml-utilities for tunneling tools, and bridge-utils for bridge tools.

Create somewhere a directory for slapos software, in our example we will use /opt/slapos:

 # mkdir /opt/slapos

Enter this directory:

 $ cd /opt/slapos

In /opt/slapos create 'buildout.cfg' with content:

[buildout]
extends =
  http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/tags/slapos-0.57:/component/slapos/buildout.cfg

Install SlapOS tools using buildout:

 # python -S -c 'import urllib2;print urllib2.urlopen("http://www.nexedi.org/static/\
packages/source/slapos.buildout/bootstrap-1.5.3-dev-SlapOS-002.py").read()' | python -S -
 # bin/buildout -v

In /opt/slapos create 'slapos.cfg' configuration file with proper content:

[slapos]
software_root = /opt/slapgrid
instance_root = /srv/slapgrid
master_url = http://127.0.0.1:5000/
computer_id = vifibnode

[slapformat]
computer_xml = /opt/slapos/slapos.xml
log_file = /opt/slapos/slapformat.log
partition_amount = 10
bridge_name = br1331
partition_base_name = slappart
user_base_name = slapuser
tap_base_name = slaptap
# You can choose any other local network which does not conflict with your
# current machine configuration
ipv4_local_network = 10.0.0.0/16

[slapproxy]
host = 127.0.0.1
port = 5000
database_uri = /opt/slapos/proxy.db

Step 2: run a local SlapOS master

You will need to run slapproxy. It is a "SlapOS Master light", used to bootstrap the real SlapOS Master, with minimal functionalities.

 # bin/slapproxy -vc /opt/slapos/slapos.cfg

This command will run the daemon in foreground, so be sure to leave it opened until the end of the tutorial. You can open another terminal session to continue (or use dedicated tools such as screen).

Slapproxy will listen on configured IP and port, do not stop it, as this is local SlapOS master implementation.

Step 3 : Network configuration

Before using slapformat commands, you must set up a bridge network interface named ``slapbr0''. On that bridge, you must set up at least an IPv6 global address, even if it is only a localhost one.

This can vary drastically from system to system, but there is quite simple way to have such bridge in 'loopback' mode (use root user) :

 # brctl addbr br1331
 # ip l s dev br1331 up
 # ip a a dev br1331 fd00::1/64

This configuration will be resetted if you reboot your machine, but you can make it persistent. On Debian systems, this is commonly done in ``/etc/network/interfaces'' file.

Note that if you declare any interface as part of the bridge (when you want your instances to be available not only on localhost), you should remove them from the configuration file.

Here is an example of the bridge with private IPv6 address:

auto br1331
iface br1331 inet6 static
   address fd00::1
   netmask 64
   bridge_ports none

You can have a look at bridge-utils-interfaces(5) and interfaces(5) manpages for further details.

Step 4: register your computer to the Cloud

In order to register your computer to the Cloud, you have to prepare some free 'slots' which will allow the SlapOS master to assign some resources for a service. We provide a default configuration tool, which does everything automatically for you with a configuration known as compatible with our exception.
This tool will create some system users, some directories, add some network interfaces which have to be linked to an existing bridge (in order to give network access to the services) and finally, register the computer configuration to the SlapOS master. You can find more informations on this subject by issuing the "bin/slapformat --help" command.

Now it is possible to run the utility (use root user) :

# bin/slapformat -c /opt/slapos/slapos.cfg

Step 5: Discover slapgrid (optional)

Let me introduce the third SlapOS utility : "slapgrid". slapgrid is the slapos "client" daemon. It will query the SlapOS Master (here, our little slapproxy) and will be responsible for installing software, all the instances, and push back to the master the usage of the instances.

At that step, you can run the it and see that no modification is requested from the SlapOS master (use root user).

# bin/slapgrid -c /opt/slapos/slapos.cfg

Slapgrid is actually separated in three binaries :
* slapgrid-sr (for Software Release) will install or remove software.
* slapgrid-cp (for Computer Partition) will instantiate and delete instances
* slapgrid-ur (for Usage Report) will send to the Master the usage of the different instances.
You can type --help to each of these command to have more informations.

Step 6: request software installation

In order to request a software installation, you have to use the slap library. slapconsole is a small interactive python interpreter wrapper where you can type slap commands.

$ bin/slapconsole /opt/slapos/slapos.cfg
import slapos.slap.slap
slap = slapos.slap.slap()
# Connect to slapproxy
slap.initializeConnection('http://127.0.0.1:5000/')
# Request to slapproxy the installation of a new software. Here the url refers
# to the ERP5 software release.
slap.registerSupply().supply(
    'http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/erp5:/software/erp5/software.cfg',
    computer_guid='vifibnode')

Step 7: compile the software

After having requested the installation of the software, you need to run slapgrid to actually install the software. (In short, slapgrid will ask slapproxy what should be installed, slapproxy will answer to install erp5).

# bin/slapgrid-sr -c /opt/slapos/slapos.cfg

Step 8: request an instance

Again, from the slapconsole

$ bin/slapconsole /opt/slapos/slapos.cfg
import slapos.slap.slap
slap = slapos.slap.slap()
slap.initializeConnection('http://127.0.0.1:5000/')

erp5_computer_partition = slap.registerOpenOrder().request(
    'http://git.erp5.org/gitweb/slapos.git/blob_plain/refs/heads/erp5:/software/erp5/software.cfg',
    'My ERP5 Instance')
# Please note somewhere the following partition id, you will use it later to
# fetch informations
erp5_computer_partition.getId()

The second parameter ('SlapOS Master') of the method is the reference of your instance. This command will return you a representation of the computer partition, that you will use to get the id of the partition (i.e. where your instance is) chosen by slapproxy.

Next time you will run slapgrid, slapproxy will ask instantiation of what you requested. If you run the above command another time, no other instance will be requested as long as the instance reference stays the same. This can be useful to fetch the partition ID of your instance.

Step 9: make slapgrid instantiate what you requested

Rerun slapgrid and it will create and start an instance (use root user)

# bin/slapgrid-cp -c /opt/slapos/slapos.cfg

Final step: use your service

Get your connection informations from the console. If you don't remember your partition ID, run step 7 (slapconsole) again.

$ bin/slapconsole
import slapos.slap.slap
slap = slapos.slap.slap()
slap.initializeConnection('http://127.0.0.1:5000/')

# The second parameter of the following function is the result of
# erp5_instance.getId() in step 8.
# It is usually 'slappart0' with slapproxy.
partition = slap.registerComputerPartition('vifibnode', 'slappart0')
partition.getConnectionParameter('site_url')
partition.getConnectionParameter('site_user')
partition.getConnectionParameter('site_password')

Use the information printed to access the Apache.

Known Issues

You might encounter errors in step 1 : "Install SlapOS tools using buildout" due to the fact that some distribution configured python in a bad way. To fix this just do :

$ unset PYTHONPATH

$ unset PYTHONDONTWRITEBYTECODE