Most Powerful Open Source ERP

How to Install a SlapOS Slave Node with a USB Key

A step by step guide to bootstrap a SlapOS Slave Node, using a USB key.
  • Last Update:2013-07-15
  • Version:002
  • Language:en

Installing SlapOS Slave Node with a USB Key

The goal of this tutorial is to explain how to install SlapOS on a dedicated PC using the SlapOS system image which is copied to a USB key. With this approach, it is possible to add a new SlapOS Slave node in very a short time and with little effort.

Agenda

  • The Requirements
  • The Computer
  • The Key
  • The Monitor

The tutorial is split into 4 parts. First we shall list the requirements to install SlapOS with a USB key. Second, we will explain how to add a so-called Computer to VIFIB. Then we will explain how to generate a USB key and configure it. We will finally explain how to monitor each computer.

The Requirements

  • A VIFIB Account
  • A USB Key
  • A Fresh PC

In order to install SlapOS on a USB key, there are a couple of requirements. First, you need to have an account on www.slapos.org. You can get such an account by subsribing to VIFIB (Free). The subscription form is available each time you try to login.

You will then need a USB key of 8GB or more. It is probalbly possible to use a 4GB key but this is not recommended. You will also need a Fresh PC with a hard disk of 60 GB or more. We recommend to use SSD disks for Cloud applications, since only SSD disks provide enough reads and writes per second to support the kind of multi-user load implied by Cloud applications. You PC will be completely erased by the USB Key at the first boot. So, make sure you have no valuable data inside.

You will also need a GNU/Linux PC such as your laptop. This laptop will be used to download the SlapOS image and copy it to the USB key. You will need 1.5 GB of free disk space.

Also, knowledge of how to write an image to a USB key would be a plus.

The Key

Write a key (CLI)

# Download http://community.slapos.org/download/latest-oem
    # Untar it
    tar xzf SlapOS_Image.x86_64-0.5.16.oem.tar.gz


    # Write key
    dd if=SlapOS_Image.x86_64-0.5.16.raw of=/dev/sdX 
      

First download the SlapOS image. This image was created with SuSE studio. It is a universal image which can be installed on a USB key or on a hard disk. SuSE studio can also generate images for VMWare, qemu, VirtualBox, etc. for those who want to try SlapOS on a virtual machine rather than on a bare metal server (Here is the image for Virtual Machines). After the download is completed, unpack the image with tar.

You can now write the image to the USB key. Plug the USB key into your PC. You will need to have superuser rights to proceed or use sudo. Identify which device (/dev/sdX) is the one which corresponds to the USB key you just inserted, by running the command:

- lsblk

in a terminal (you should easily find your key thanks to its size, also note that most of the time your computer hard disk will be /dev/sda and that partitions, with name like /dev/sdX1 do not interest us here).

Once you know which device corresponds to the USB key, you may proceed.

Boot

You can now insert the USB key into the Fresh PC. Before that make sure that your PC BIOS is well configured. The PC should boot on the USB key (not on the hard disk). The PC should have virtualization enabled if you wish to host virtual machines. And the PC should be able to restart automatically after a power failure (APM setting).

You can now boot. Wait for the boot sequence to finish. At the end connect as root. Login is :"root" and password is "linux". Then run:

# Run command:
slapprepare

# A dialogue will then appear:

Automatically register new computer to Vifib? [y,n]:

# If you don't have any configuration file ready answer "Y" else "N"

# Note about slapos configuration: If you already have your slapos configuration (slapos.cfg, certificate, key) place it in "/etc/opt/slapos/" or "/etc/slapos" before running "slapprepare" command. To use ipv6 provided by vifib add line "ipv6_interface = tapVPN" in [slapformat] part in slapos.cfg .

# You will be asked for a name of a computer. Put something you will remember as identification
Number of SlapOS partitions for this computer? 

# You can put the value you want. We advise 20.

Is this a virtual Machine? [y,n]:

# Answer "n"

Do you want to use SlapOS with a second disk ? [y,n]:

# If you want to use your computer's hard disk answer "y" else "n"

Do you want to use vpn to provide ipv6? [y,n]:

# It is better to put "y" to have a more stable ipv6

# Note about ipv6: If you don't have ipv6 on your network the key will connect automaticaly in vpn to a server to get a reliable ipv6. If your ipv6 connection is not reliable you can force the use of Vifib ipv6 by naming a file "openvpn-needed" in the directory containing slapos.cfg (by default /etc/opt/slapos/) .

Do you want to force the use lxc on this computer? [y,n]:

# If you plan to use LXC on this container answer 'y' else 'n' (if you don't know what is LXC just answer 'n')

Do you want a remote ssh access? [y,n]:

# WARNING: Slapprepare installs a boot script which reset root password.
If you do not want to loose access to your computer answer 'Y' and prepare a valide ssh public key available on internet

# A dialogue will then ask you to confirm this values. If everything seems right confirm.
You will be asked for your slapos community login and password.
You will also be asked for a ssh key. Enter the url of your public ssh key. You can use services like pastebin to enter your public key and get the "raw" link.

Once all software is installed, SlapOS will format the server and, if you have chosen the second disk option, the hard disk. Formatting the hard disk means that all your data will be lost, unless SlapOS was already installed. Formatting the server in SlapOS world means that 20 IPv6 adresses and 20 tap interfaces will be created and bridged. 20 users and 20 directories will also be created. Every resource which is executed on a SlapOS server is attached to its dedicated address, user and directory. This creates a simple form of compartment between processes without the overload of virtualization or chrooting.

The result of server formatting is uploaded to https://www.slapos.org.


The Monitor

Servers added to SlapOS need a kind of hardware monitoring. However, since SlapOS has the idea of distributed Cloud in mind, there is no default central monitoring tool. Instead, every operator of SlapOS infrastructure must create their own recipes to allocate monitoring instances and monitoring servers, just the way they like. The more diverse, the more reliable.

Add Zabbix Instance

$ ~/slapos-client/bin/slapconsole ~/slapos-client/slapos-client.cfg

    # Replace by your ID
    node_id = COMP-ID-of-your-computer
    # Install Zabbix on node
    supply(node_id, zabbixagent)
    # VIFIB Zabbix Server: (you can use yours)
    #   2001:41d0:1:9bff:21c:c0ff:fe11:dc1e,2001:41d0:1:9b1a::1 
    zabbix_instance = request(zabbixagent, 
    'zabbix monitoring for my machine', 
    filter_kw=dict(computer_guid=node_id), 
    partition_parameter_kw=dict(server='2001:41d0:1:9bff:21c:c0ff:fe11:dc1e,2001:41d0:1:9b1a::1', 
    hostname='your hostname')
    )

    # Wait ... and get parameters
    zabbix_instance.getConnectionParameter('ip')
    zabbix_instance.getConnectionParameter('port')
  

We'll describe here how Nexedi does it. In order to add a Zabbix instance, we use slapconsole and requet the instance on the computer which we want to monitor. We pass as parameters the IPv6 address of Zabbix master (2001:41d0:1:9bff:21c:c0ff:fe11:dc1e,2001:41d0:1:9b1a::1) and define the our own hostname as Zabbix will display it. As usual, we now have to wait (and it is better to do something else).

After waiting long enough, it is now possible to access the IP address and port number of the Zabbix client. We use the method getConnectionParameter for this purpose. We can then access zabbix.nexedi.com and register the Zabbix client by specifying IP and port. Nicely enough , Zabbix supports IPv6. out of the box.

One should note that by design, anyone will be able to add Zabbix clients on any server (and pay for that). The data which is gathered by Zabbix client (temperature, RAM occupation, etc.) is considered as non confidential if not public. This is a consequence of SlapOS security levels and our refusal to run any SlapOS process with superuser rights. We think our approach is right but would be happy to hear comments on this.

What Next?

Now that you know how to install a SlapOS Slave Node, you can contribute by adding computers.

How to Contribute

  • Add Computers
  • Add Computers
  • Add Computers
  • Add Computers

Each computer you add to VIFIB can at the same time help your friends to install open source applications on your server. It can also bring you cash when other parties use your computer for cloud applications. The more we are, the stronger SlapOS will become.