This tutorial will teach you how to use a useful Bash script on Theia for supplying a software and requesting an instance on Theia.
You can follow the preview tutorial: HowTo Request A Theia Runner and How To Access Theia Runner to get started.
slapos supply
: This command is used to add the software to the list of software to be supplied to a node.
$ slapos supply $software_release_uri slaprunner
slapos supply [software] [node]
For example, the software is html5as-base, located in ~/srv/project/slapos/software/html5as-base/software.cfg. We can set a variable named software_release_uri
and the value is ~/srv/project/slapos/software/html5as-base/software.cfg
.
In the case of Rapid.Space Theia, Node is the embedded node named slaprunner
When you are inside theia, you are actually talking to a slapproxy (small slapos master) dedicated to your Theia.
After supply, the master will list the software as to be supplied by the node. And on the next run of slapos node software
in the node will start installing the software.
slapos request
: request the allocation of an instance to the master. This commands also get status and parameters of the instance if it has any (the command is meant to be run multiple time until you get the status).
$ slapos request $software_name'_1' $software_release_uri
slapos request "instance_name" [software]
In order to deploy a service, use slapos request
to ask the master to allocate an instance for you. Since the slapproxy (small master in Theia) only knows a local node, you are sure the master will allocate the software to your local node. “instance_name” is up to you, and [software]
must be exactly the same path you supplied earlier.
request
is the command to:
#!/bin/sh
software_name=html5as-base
software_release_uri=~/srv/project/slapos/software/$software_name/software.cfg
slapos supply $software_release_uri slaprunner
slapos request $software_name'_1' $software_release_uri
From terminal, we can use the command presented before to supply a software and request an instance. More documentation is available here: slapos command line.
For convenience, and to make sure you always request the proper software, it is recommended to use a script like the one presented here. Change the software_name of the software release to the one you need, which should be listed in ~/srv/project/slapos/software/
Instances are identified by their name, make sure your instance name is unique. Requesting the same instance with a different software release url is possible, it is used to update instances.
Locate the connection parameter on your Theia service. You can access the Theia using the url and logging in with username and password.
The bash file has already listed under PROJECT directory.
Duplicate the request script bash file and rename to request-your-software-name.sh.
Edit the file to suit your situation. Here, for example, we would like to deploy html5as-base. The software.cfg
is located: ~/srv/project/slapos/software/html5as-base/software.cfg. So we set software_name
as html5as_base
so the software_release_uri
will be ~/srv/project/slapos/software/html5as-base/software.cfg
.
As the computer name is slaprunner
, we supply $software_release_uri
to slaprunner
. $software_name'_1'
is the name for your software's instance.
#!/bin/sh software_name=html5as-base software_release_uri=~/srv/project/slapos/software/$software_name/software.cfg slapos supply $software_release_uri slaprunner slapos request $software_name'_1' $software_release_uri
Open a Terminal by clicking the button on the toolbar or hitting Ctrl+Shift+².
Locate the script and launch it by
bash request-html5as-base.shPlease make sure you are launching the duplicated request script instead of the original request script. The original request script will be overwritten all the time because it is a part of the configuration of Theia.
~/srv/project
, to launch request-html5as-base.sh
, we need type
bash request-html5as-base.sh
This the output of slapos supply
and slapos request.
2021-03-05 17:48:23 slapos[37281] INFO Requesting software installation of /srv/slapgrid/slappart73/srv/project/slapos/software/html5as-base/software.cfg... 2021-03-05 17:48:23 slapos[37281] INFO Done.
This the output of slapos supply.
2021-03-05 17:48:23 slapos[37297] INFO Requesting html5as-base_1 as instance of /srv/slapgrid/slappart73/srv/project/slapos/software/html5as-base/software.cfg... 2021-03-05 17:48:23 slapos[37297] INFO Instance requested. State is : started. 2021-03-05 17:48:23 slapos[37297] INFO Connection parameters of instance are: 2021-03-05 17:48:23 slapos[37297] INFO {} 2021-03-05 17:48:23 slapos[37297] INFO You can rerun the command to get up-to-date information.
This the output of slapos request.
As it is the first time that we launched the request script, the script is creating the service. After the instance instantiate, you can return the script to get up-to-date information. The connection parameters will be listed.
Compile and Instantiate
Verify connection parameter
You will have the connection parameters as soon as you have the instance instantiated.
slapos node software
: this is the command a node is launching to actually compile/remove the softwares
You can run slapos node software
in Terminal to compile the software.
slapos node software (--all)
will compile the software locally in the node. The compilation directory will be used later to instantiate your service . Your instance will be deployed totally from the software
installation directory (no more access to internet).
slapos node instance
: run instance deployment on the node
After have an instance requested, you can run slapos node instance (--all)
in Terminal to instantiate your software. This is the command actually deploying the service in the node.
You will have the connection parameters as soon as you have the instance instantiated.
For more information, please contact Jean-Paul, CEO of Rapid.Space (+33 629 02 44 25).