Hyper Open Edge Cloud

How To Add A Parameter

How To Add A Parameter
  • Last Update:2021-04-13
  • Version:002
  • Language:en

Agenda

  1. Prerequisites
  2. Access Theia
  3. Add title Parameter
  4. Update Md5sum    
  5.  Validation
You can also refer to the Commit according to this tutorial.

Prerequisites

  1. A Theia Runner: HowTo Request A Theia Runner 
  2. Prepare For The Deployment of Software on Theia 
  3. Supply A Software And Request An Instance On Theia Runner
  4. Inspect Logs In Rapid.Space Theia Runner

Access Theia

You can access the Theia using the url and logging in with username and password.

Locate instance_html5as.cfg.in

Locate instance_html5as.cfg.in to add title parameter.

Add title Parameter

Add title into [publish-connection-information], so it can be published while inspecting the connection parameters.

title = Title ${slap-parameter:title}! 

Add [slap-parameter] section with title, so we can customize the title while requesting the instance.  

Update Md5sum

Any buildout.cfg files downloaded by Buildout must have a corresponding MD5 sum. This is done for security and to enforce strict stability of the software release overtime.

Since we modified intance_html5as.cfg.in to have a title parameter, the MD5 sum should be updated to software.cfg.

After located intance_html5as.cfg ($ cd ~/srv/project/slapos/software/html5as-base/), you can run:

$ md5sum instance_html5as.cfg.in

to get MD5 sum of the file. Then copy the hash into [instance_html5as] section in software.cfg to replace the old md5sum.

  

Run Request Script

Since we modified intance_html5as.cfg.in to have a title parameter, the instance will be  re-instantiated by auto-running. You can retrieve the log of slapos node instance following Inspect Logs In Rapid.Space Theia Runner to verify if the the instance is ready: 

$ tail -f ~/srv/runner/var/log/slapos-node-instance.log

Once it's instantiated successfully, you can inspect the connection parameters by rerunning the request script:

$ cd ~/srv/project/slapos/software/html5as-base/
$ . ../../../request-script.sh 

The connection parameters with 'title': 'Title couscous!' are expected.

You can also verify the server_url by

$ curl server_url

Hello World! will be displayed. 

  

Update Parameter in Request Script

To pass on the parameters to the requesting instance, we rely on --parameters key='value' of slapos request command.

Open the request script and add the parameter:

slapos request $software_name'_1' $software_release_uri --parameters title='John Doe'

  

Re-run Request Script

To pass on the parameter, we are supposed to request the instance again by rerunning the request script:

$ cd ~/srv/project/slapos/software/html5as-base/
$ . ../../../request-script.sh 

As you can see, the connection parameters are still the previous ones, because to apply the modification, the instance will be re-instantiated by auto-running.  You can retrieve the log of slapos node instance following Inspect Logs In Rapid.Space Theia Runner to verify if the the instance is ready: 

$ tail -f ~/srv/runner/var/log/slapos-node-instance.log

  

The parameter is taken into account

To inspect the modification of connection parameters, we are supposed to run the requesting script again:

$ cd ~/srv/project/slapos/software/html5as-base/
$ . ../../../request-script.sh 

As you can see from the output,  the value of 'title' parameter has been changed form 'Title couscous!' to 'Title John Doe!'.

You can also verify the server_url by curl

curl server_url

Hello World! will be displayed.