...
Running backend server using SeaLights agent and preload.js
In order to To run your backend service with Sealights without changing the startup command, you can use the preload.js
file and the NODE_OPTIONS
environment variable
. This is a common practice in docker containers where the ENTRYPOINT
cannot be modified.
The agent contains a
preload.js
file undernode_modules/slnodejs/lib/preload.js
...
. You use it by setting the environment variable:
NODE_OPTIONS="--require ./node_modules/slnodejs/lib/preload.js"
...
In the current working directory, the agent will search for the token in the file
sltoken.txt
and the build session
...
ID in the file
buildSessionId
.Other parameters can be passed to
...
the agent using the following syntax:
SL_
+ {command line flag}
...
. For instance,
...
to pass the lab ID, you can set
SL_labId=my_lab_id
Sample docker file:
Code Block |
---|
ENV SL_labId=integ_test_otel ENV NODE_OPTIONS="--require ./node_modules/slnodejs/lib/preload.js" ENTRYPOINT [ "node", "--require", "./tracing.js", "index.js" ] |