Sealights Node.js Agent - run Browser Agent with Sealights Https Collector
Setting up the Https Collector for testing
The Sealights Collector can be found at the following DockerHub link: Docker
Following are the pre-requisites for Https Collector:
TLS settings should be enabled.
TLS certificate for FQDN of the server where collector is installed is required to be provided in
config.yaml
Server should be accessible by FQDN.
The following is a sample configuration that can be used to run the Https Collector using Docker:
Create a file called
config.yaml
with the following content
tls:
enabled: true
certFile: "/collector/<certFileName>"
keyFile: "/collector/<certKeyFileName>"
collectors:
- name: collector
type: http
properties:
port: 16500
serverUrl: https://<customerId>.sealights.co
proxyUrl: <httpsProxyUrl>
logLevel: debug
insecureSkipVerify: true
target:
name: http
type: http
properties:
token: <sealightsAgentToken>
serverUrl: https://<customerId>.sealights.co/api
proxyUrl: <httpsProxyUrl>
logLevel: debug
insecureSkipVerify: true
Run the Collector using Docker:
docker run -it --rm -v $(pwd)/config.yaml:/collector/config.yaml -v $(pwd)/<certFileName>:/collector/<certFileName> -v $(pwd)/<certKeyFileName>:/collector/<certKeyFileName> -p 80:80 -p 8080:8080 -p 16500:16500 sealights/on-prem-collector:latest
Open
https://<ServerFQDN>:16500
in your browser and if everything worked as expected you should be redirected to your Sealights Dashboard.
Instrumenting an application for the browser using Collector URL
You would run your usual instrumentation command but provide an additional parameter, that is the Collector URL, for example to the following command:
npx slnodejs scan --workspacepath ./calculator-app --tokenfile sltoken.txt --buildsessionidfile buildSessionId --scm none --instrumentForBrowsers --enableOpenTelemetry --outputpath "sl_web"
We need to add --collectorUrl {collector url}
(ex. --collectorUrl https://<ServerFQDN>:16500/api
) parameter to the arguments list of the above command and the application once up and running with the browser agent will use the Collector for footprints, etc...