Sealights Node.js Agent - run Browser Agent with Sealights Collector

Setting up the Collector for local testing

The Sealights Collector can be found at the following DockerHub link: Docker

The following is a sample configuration that can be used to run the Collector locally using Docker:

  1. Create a file called config.yaml with the following content

tls: enabled: false cert: "" key: "" collectors: - name: collector type: http properties: logLevel: debug port: 16500 serverUrl: https://example-server.sealights.co target: name: http type: http properties: logLevel: debug serverUrl: https://example-server.sealights.co/api token: {agent-token}
  1. Run the Collector using Docker:

docker run -it --rm -v $(pwd)/config.yaml:/collector/config.yaml -p 80:80 -p 8080:8080 -p 16500:16500 sealights/on-prem-collector:latest
  1. Open http://localhost: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 http://localhost:16500) 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...