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:
Create SeaLights service configuration
Push an application
Bind an application with the service
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-nodejs -p '{"token":"ey…"}'
It is also possible to provide a token file
cf cups sealights-nodejs -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-nodejs -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”
cf 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
cf bind-service [app name] sealights-nodejs
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
cf restage [app name]
Sealights env vars
Sealights test listener args are provided by env vars as the following
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:
Sealights hook verifies that the application is bound with the sealights service
Install the agent from the npm repository
Modify target application start command
Last updated
Was this helpful?