Most Powerful Open Source ERP

Deploy Software on Theia

Document showing how to deploy software on the SlapOS Theia
  • Last Update:2020-11-23
  • Version:001
  • Language:en

Deploy Software on Theia

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.

Agenda

  • Introduction of Technologies
    • SlapOS
    • Theia
  • Prerequisites
    • A SlapOS Theia
  • Deployment of Software Release: helloworld
    1. Connect To Your Theia
    2. Clone Repository
    3. Locate Software Directory
    4. Deploy Helloworld Software
  • Inspect Services And Connection Parameters

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

The agenda of the presentation includes an introduction on SlapOS, as a tool used to deploy a wide range of different services and an introduction of Theia, as an IDE running on web.

After a short introduction, we will clarify the prerequisite in order to start the presentation. Then, we progress to show the steps to deploy the software release: helloworld on SlapOS Theia.

To verify the deployment, we will inspect the services and relevant connection parameters.

Introduction of Technologies

  • SlapOS
  • Theia
 

Here comes a brief  introduction of SlapOS and Theia.

SlapOS

SlapOS is a general purpose operating system used on distributed POSIX infrastructures (Linux, xBSD) to provide and manage software services focussing on cloud orchestration and edge computing. It allows automating DevOps including deployment, monitoring and billing of software used on arbitrary cloud infrastructures.
SlapOS can be used to act as cloud provider selling software as a service (SaaS), to offer platform as a service (PaaS) solutions or also the basic infrastructure as a service (IaaS). SlapOS can be run on private hardware and data centers or any public/cloud infrastructure.
This document explains the concepts underlying the SlapOS architecture.

Theia

Theia is an extensible platform to develop full-fledged multi-language Cloud & Desktop IDE-like products with state-of-the-art web technologies.

Prerequisites

A SlapOS Theia

To start deploying a software release, a SlapOS Theia is required.

You can follow How to request a SlapOS Theia service from SlapOS to have your SlapOS Theia IDE with a validated URL, a login and a password.

Deployment of Software Release: helloworld

  1. Connect To Your Theia
  2. Clone Repository
  3. Locate Software Directory
  4. Deploy Helloworld Software

This section will show how to access a SlapOS Theia and deploy a software. The screenshots show deployment of the helloworld software release, also used to explain how to extend a software release.

1. Connect To Your Theia

Locate the connection parameter on your Theia service. You can access the Theia using the url and logging in with username and password.
After logging in, you will see the platform of Theia, which is very similar to VS Code, if you want to become a power user, a large part of https://code.visualstudio.com/docs/ applies (for example that section on editing with multi cursor)

Tips: Avoid closing Slapos Theia with ctrl + w

 

Tip:

you can open in its own window. So that Ctrl+w does not close the browser tab.
All commands are available from command palette which comes with can be opened with F1.

2. Clone Repository

View->Find Command or Ctrl+shift+P

Open the command palette (View->Find Command or Ctrl+shift+P) and start typing “git” to find command (git clone) to clone repository.

SlapOS Git Repository

Next, enter the git repository location:

https://lab.nexedi.com/nexedi/slapos.git

Theia’s workspace

This cloned repository will be in Theia’s workspace and it’s visible in Explorer.

Tip:

You can always use the Terminal to run your commands.

git clone https://lab.nexedi.com/nexedi/slapos.git

In this case, for example, you can open a Terminal by clicking New Terminal in Terminal and type the git clone command.

Then you will get a same workplace.

3. Locate Software Directory

After the repository cloned, you are supposed to locate the Software directory which contains a list of all software releases available in Theia. The list is based on the official SlapOS software repository. From there you can open a file. You can also use Ctrl+P and start typing a filename. As we are going to deploy helloworld, let’s open the software configuration (software.cfg) of helloworld.

Tips:

  • ~/srv/projet is the default workspace root (the folders we can see in left pane when opening Theia for first time are this)

  • ~/srv/slapos for embedded SlapOS, with ~/srv/slapos/inst/ for instances and ~/srv/slapos/soft/ for software

  • The computer is named “local”
  • Terminal uses bash by default

4. Deploy Helloworld Software

  • slapos supply [software] [node]
  • slapos node software
  • slapos request "instance_name" [software]
  • slapos node instance

From terminal, we can use slapos command line. To deploy a software, we should basically follow 4 commands.

  • Client commands(slapos supply, slapos request) talking to the master and setting configuration for a node
  • Node commands(slapos node) talking to the master and asking for the configuration
  • There is also an Understanding SlapOS Architecture you can refer to

 

slapos supply [software] [node]

slapos supply: supply a software to a node.

slapos supply $PWD/slapos/software/helloworld/software.cfg local

In our case, the software is helloworld, located in /srv/slapgrid/slappart49/srv/project/slapos/software/helloworld/software.cfg. The path can be copied by right-clicking the exact file (software.cfg) -> Copy Path. Node is named local.

Software Supplied!

Helloworld software is supplied to local.

slapos node software

slapos node software: run software installation/deletion

  • Command line:

    slapos node software

or

  • Terminal -> Run Task : slapos node software

You can run slapos node software in Terminal to install the software. Or there is a task configured with the same label (Terminal -> Run Task, if there is an error, hit Run task again).

slapos node software will install everything for the instance. Your instance will be deployed totally from the software installation.

Task is building in terminal

Task starts the build in a new terminal. If you close that terminal process will be terminated.

Once saved the deployment of the software will begin. Deployment 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 deployment.

Connection Error

 

Sometimes external errors such as network errors happen and in that case we can retry software.

Software installed! 

By re-run the task, you can have your software successfully.

slapos request "instance_name" [software]

slapos request: request an instance and get status and parameters of instance

Enter the following commands in your terminal to start requesting:

slapos request "hello world instance" $PWD/slapos/software/helloworld/software.cfg

Once the software installed as the result of the last step, you can request instance with slapos request in your terminal. “instance_name” is up to you, and [software] depends on where the software configuration of the software are.

Instance requested! 

slapos node instance

slapos node instance: run instance deployment 

  • Command line:

    slapos node instance

or

  • Terminal -> Run Task : slapos node instance

After have an instance requested, you can run slapos node instance in Terminal to instantiate your software. Or there is a task configured with the same label (Terminal -> Run Task, if there is a connection error, hit Run task again):

Software applied to instance! 

Inspect Services And Connection Parameters

Run the command in your Terminal:

slapos request "hello world instance" $PWD/slapos/software/helloworld/software.cfg

request is also the command to get parameters from a service and create the service even if it’s not yet created.

slapos proxy show

slapos proxy show: display proxy instances and parameters
Run the command in your Terminal:

slapos proxy show

Proxy instances and parameters displayed 

With the help of slapos proxy show, the services defined in the software.cfg file should be started and displayed:

 slappart0       local           busy    /srv/slapgrid/slappart49/srv/project/slapos/software/helloworld/software.cfg RootSoftwareInstance hello world instance      -           started     1603890566.29

The connection parameters defined in the instance.cfg.in will be displayed:

slappart0: hello world instance (type RootSoftwareInstance)
    name = Hello John Doe!
    url.go = http://[2001:67c:1254:45:a9d5::d847]:7779
    url.python = http://[2001:67c:1254:45:a9d5::d847]:7777
    url.ruby = http://[2001:67c:1254:45:a9d5::d847]:7778

Thank You

Image Nexedi Office
  • Nexedi SA
  • 147 Rue du Ballon
  • 59110 La Madeleine
  • France