Configuring SlapOS Client
What is SlapOS Client?
SlapOS client is a set of tools allowing you to manage your SlapOS Nodes, your instances and your SlapOS Master account. It is bundled with the standard SlapOS Node installation.
It will allow you to request and manage your instances, to install Software Release on your nodes, as if you were on slapos.org, but with all the power of terminal.
Step 0: requirements
- A GNU/Linux Server
- slapos-node package installed on the machine. No need for actual node configuration, only the package itself (containing the binaries) are required.
- A SlapOS Account
- NO ROOT ACCOUNT IS NEEDED. Don't use root, except if you have a specific reason to do so.
To follow this tutorial, you will need a server with a GNU/Linux distribution, slapos-node package installed and slapos.org account.
Step 1: Register and obtain a Credential security Token
Go to slapos.org (or any other SlapOS Master), register if not already done, go to My Account and click on Generate a Credential Secuity Token:
Step 1.5: Save the New Token
- As soon as you click on the button a new token will be generated. Save this token for future use on this tutorial.
Step 2: Run slapos configure client
Run slapos command below, to create the configuration files, when asked please input the Token Saved on Step above.
This command will generate the following files:
- $HOME/.slapos/slapos-client.cfg
- $HOME/.slapos/certificate : Your user SSL Cetificate
- $HOME/.slapos/key: Your user SSL Private Key
You can now, Edit $HOME/.slapos/slapos-client.cfg to include some aliases:
alias =
webrunner https://lab.nexedi.com/nexedi/slapos/raw/1.0.49/software/slaprunner/software.cfg
Check certificates
In order to check if certificate is okay (good location, rights, content...), you can run those commands:
To check validity of certificate:
$ /opt/slapos/parts/openssl/bin/openssl x509 -noout -in $HOME/.slapos/client.crt
To check the key:
$ /opt/slapos/parts/openssl/bin/openssl rsa -noout -in $HOME/.slapos/client.key -check
If you see no output or if command states it's okay, well, everything is okay.
Using slapos client commands
slapos supply
Request installation of a software on a node:
- slapos supply webrunner COMP-XXXX
Remove a software from a node:
- slapos remove webrunner COMP-XXXX
Note: Replace COMP-XXXX by the computer number of where you wanna gonna to supply the software.
slapos request
Request a new or existing instance of wordpress named "mywordpress":
- slapos request mywebrunner webrunner
You can't, as of yet, destroy an instance through the command-line.
slapos console
Open the SlapOS console:
slapconsole is for quite advanced usages. It is basically a Python prompt with all slap modules injected and ready to be used.
We will learn here how to use slapconsole.
Global Variables
- software_list
- kvm
- mysql-5.1
- ...
Official doc available here.
Explanations
- request is a method which can be used to create new instances of any resource / software on a computer
- supply is a method to define that a given computer can create instances of a given resource
- slap is a configured instance of the Slap class of the API. It is used for advanced usages.
- software_list is a dictionnary containing all the officially supported software releases by Vifib.
- All the officially supported software releases are also available as global variable : kvm, mysql-5.1, joomla, etc.