SeaLights Node.js agent - Cloud Foundry Integration

 

SeaLights node agent is integrated into the Cloud Foundry nodejs buildpack. So you can use it in your application by performing the following simple steps:

  1. Create SeaLights service configuration

  2. Push an application

  3. Bind an application with the service

  4. Restage an application

Create Service Configuration

To manage application integrations with third-party services Cloud Foundry has the mechanism of the User-Provided Services. So the first step is to create such a service with the configuration. Here is the command “create-user-provided-service“ that does that:

cf cups sealights -p '{"token":"ey…"}'

It is also possible to provide a token file

cf cups sealights -p '{"tokenfile":"/path/to/sltoken.txt"}'

Note: you have to escape " character in the windows commands line, so the command will look like this:

cf cups sealights -p '{\"token\":\"ey…\"}'

You will be able to change the parameters later with the command “update-user-provided-service

See below the complete list of the available parameters

Push an application

You can push an application as usual with the command “push

Note: you can use a manifest.yml file to simplify an application deployment

Bind Application with the service

Now you can bind your published application with the service

Restage Application

In order to apply changes you have to publish your application again, or just restage it with a command restage once the Sealights service bound the test listener will be triggered

Sealights env vars

Sealights test listener args are provided by env vars as the following

Prameter name

Description

Prameter name

Description

SL_LAB_ID

Allow to determine customer lab id - unique ID for a set of test labs in case multiple labs are running simultaneously

SL_BUILD_SESSION_ID

Sealights build session id

SL_BUILD_SESSION_ID_FILE

File that contains Sealights session id.

SL_PROXY

Address of proxy to run connection through

SL_PROJECT_ROOT

The root dir will be used to resolve path against it, default is CWD

SL_TEST_STAGE

Name of the test stage

 

How it works

Sealights use the AfterCompile hook in the nodejs-buildpack to install an agent and all required dependencies in the target container. So once the application is pushed to the cloud foundry service the following steps occur:

  1. Sealights hook verifies that the application is bound with the sealights service

  2. Install the agent from the npm repository

  3. Modify target application start command