Request Frontend From Instance Buildout

Agenda

  • Prerequisite
  • Add Frontend Request
  • Add Promise
  • Provide URL
  • Verification

It should not be expected for standard user to access services in ipv6. Rapid.Space and generaly SlapOS infrastructures contain an IPv4 frontend used to access an IPv6 backend transparently.

Most software release request an ipv4 frontend automatically for users to access the service. If the Theia you are using have been provided on Rapid.Space, you are accessing an IPv6 service through an ipv4 frontend.

This tutorial explains how to request an IPv4 frontend automatically in the context of html5as-base.

Here is the commit introducing this functionality to html5as Software release: commit diff

Prerequisite

Request frontend

In instance_html5as.cfg.in, add a frontend request section [html5as-frontend]. This section use slapos.cookbook:requestoptional recipe, a recipe dedicated to request new instances automatically. parameters are given with keys starting with config-. So here config-url is the url parameter of the request and our backend address. As the frontend provides https access with valid certificates config-https-only is forced to be true to make sure http is not used.

# Request a CDN entry to master
[html5as-frontend]
# Extend slap-connnection to get the credentials for the request
<= slap-connection
# Recipe used to make requests
recipe = slapos.cookbook:requestoptional
name = HTML5AS frontend
# Specify the software url of the frontend software release
software-url = http://git.erp5.org/gitweb/slapos.git/blob_plain/HEAD:/software/apache-frontend/software.cfg
# It is not a dedicated instance but an instance allocated on a shared instance
shared = true
config-url = ${html5as:access_url}
config-https-only = true
# The parameter expected to be received from the request are listed here.
return = domain secure_access

Add Promise

In order to make sure the frontend url is working, a new promise is supposed to be added. This promise use the module check_url_available to check the url and make sure it doesn't raise an http error. Add the new section in instance_html5as.cfg.in

# Add a promise to make sure the cdn is properly configured
[html5as-frontend-promise]
<= monitor-promise-base
promise = check_url_available
name = html5as-http-frontend.py
url = ${html5as-frontend:connection-secure_access}
config-url = ${:url}
config-check-secure = 1

Return frontend url

For end user to access the service via a frontend. We return the url in the publish-connection-information section in instance_html5as.cfg.in.

[publish-connection-information]
...
# Add dependency to the promise so that frontend sections are processed
# and there is no need to declare the new part in buildout:parts
server-cdn-url = ${html5as-frontend-promise:url}

Update md5sums

Refer How To Move to md5sum automatic update to update md5sum:

$ cd ~/srv/project/slapos/software/html5as-base
$ ../../update-hash

Validation

  1. Run Request Script until it return server-cdn-url
  2. Access server-cdn-url in your browser

Wait for server-cdn-url

You can check the output of the request script from time to time until the server-cdn-url returned (it may take up to 30 minutes!) by using the path : 

$ /srv/slapgrid/slappart27/srv/project/request-html5as-base.sh

If it's not the correct path, you can get the path by right clicking on "request-html5as-base.sh" and selecting "Copy Path"

Access server-cdn-url

Access the server-cdn-url from your browser. The Converse application is displayed.

Thank You

  • Rapid.Space
  • 147 Rue du Ballon
  • 59110 La Madeleine
  • France
  • +33629024425
  • contact (@) rapid.space

For more information, please contact Jean-Paul, CEO of Rapid.Space (+33 629 02 44 25).