Hyper Open Edge Cloud

HowTo Deploy A Software On Theia Runner

HowTo Request A Theia Runner Embedded With A Software
  • Last Update:2021-03-04
  • Version:001
  • Language:en

Agenda

  1. Prerequisites
  2. Launch Request Script
  3. Explain Request Script
    • slapos supply [software] [node]
    • slapos request "instance_name" [software]
  4. Inspect Logs
    • slapos node software
    • slapos node instance
  5. Verify the Instance
  6. Verify Connection Parameters

This presentation aims to demonstrate how to deploy a software release on a SlapOS Theia. The process can be used for any software available on the SlapOS repository. Note, that the SlapOS Theia is an extensible platform to develop multi-language Cloud & Desktop IDEs with state-of-the-art web technologies. Instantiating a SlapOS thus means, creating a smaller encapsulated system for then deploying another software inside. This is a useful approach for developing or hosting simple software releases.

We’ll show how to deploy a "html5as-base" software release on a SlapOS Theia in this presentation. 

We will clarify the prerequisites in order to start the presentation. Then, we progress to show the steps to deploy "html5as-base" software release on SlapOS Theia.

Prerequisites

This deployment tutorial is based on Prepare For The Deployment of Software on Theia and Create A Request Bash Script On Theia Runner.  You are expected to finish the tutorials and have your request Bash script launched to get started.
   

Launch Request Script

At the end of Create A Request Bash Script On Theia Runner, the request script is launched.      

 Explain Request Script

#!/bin/sh
html5as_base=~/srv/project/slapos/software/html5as-base/software.cfg
slapos supply $html5as_base slaprunner
slapos request myInstance $html5as_base

From terminal, we can use slapos command line. To deploy a software, we should basically type these commands. To be convenient, we created this Bash script so we don't need to type every time.     

The information below may help you:

  • Client commands(slapos supply, slapos request) talking to the master as a human and requesting installation/deployment of services
  • Node commands(slapos node) talking to the master and doing the job of compiling the software and launching the services which is autorunning by default. Through the tutorial, we will retrieve the log of slapos node software and slapos node instance to understand
  • There is also an Understanding SlapOS Architecture you can refer to

Explain Request Script: slapos supply [software] [node]

slapos supply: ask the master to supply a software to a given node.

slapos supply $html5as_base slaprunner 

In our case, the software is html5as-base, located in ~/srv/project/slapos/software/html5as-base/software.cfg, for example. We have set a variable named html5as_base and the value is ~/srv/project/slapos/software/html5as-base/software.cfg

And Node is named slaprunner here. 

When you are inside theia, you are actually talking to a slapproxy (small slapos master) dedicated to your Theia. 

After supplied, the master knows that html5as-base software needs to be compiled in the node.

Explain Request Script: slapos request "instance_name" [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 myInstance $html5as_base

In order to deploy a service, you 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.

Explain Request Script: slapos request "instance_name" [software]

Instance requested! 

request is the command to:

  • create the service if it’s not yet created
  • get parameters from a service

As it is the first time that we launched the request script, the script is creating the service. 

 

Inspect Logs: slapos node software 

tail -fn 100  ~/srv/runner/var/log/slapos-node-software.log

To retrieve the log of slapos node software, you are supposed to type in the terminal:

tail -fn 100  ~/srv/runner/var/log/slapos-node-software.log

As Theia is configured autorun as running, which means slapos node software and slapos node instance are always running to compile and deploy, you don't need to launch the commands manually. 

Compilation can take anywhere from a few minutes (simple software, already compiled) to several hours. The log will inform of any errors or warnings encountered during compilation. As the log indicates, the software is compiled successfully. Now we can say, we have prepared everything from the software configuration file, and it can be used for instantiating an instance without network. 

slapos node software: this is the command a node is launching to actually compile/remove the softwares

Noteslapos node software 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).

 

 

Inspect Logs: slapos node instance 

tail -fn 100  ~/srv/runner/var/log/slapos-node-instance.log

To retrieve the log of slapos node instance, you are supposed to type in the terminal:

tail -fn 100  ~/srv/runner/var/log/slapos-node-instance.log

As Theia is configured autorun as running, which means slapos node software and slapos node instance are always running to compile and deploy, you don't need to launch the commands manually. 

slapos node instance: run instance deployment on the node 

After have an instance requested, slapos node instance will actually deploy the service on the node. In other words, it instantiates the software you supplied.

 

 

Verify the Instance

. request-html5as-base.sh

Please refer Create A Request Bash Script On Theia Runner to launch your request Bash script.

Since the software is compiled and the instance is deployed, you can get parameters from the service by the request script. As you can see from the screenshot:

2021-03-04 15:44:12 slapos[28987] INFO Connection parameters of instance are:
2021-03-04 15:44:12 slapos[28987] INFO {'server_url': 'http://[2001:67c:1254:45:a9d5::dd2e]:8081'}

Verify Connection Parameters

. request-html5as-base.sh

We can open the server_url via the URL: http://[2001:67c:1254:45:a9d5::dd2e]:8081 (IPv6 required, if you don't have one yet, you can refer to HowTo Install IPv6 On Your PC)

2021-03-04 15:44:12 slapos[28987] INFO Connection parameters of instance are:
2021-03-04 15:44:12 slapos[28987] INFO {'server_url': 'http://[2001:67c:1254:45:a9d5::dd2e]:8081'}