Skip to main content

Installing the Docker environment

It guides you how to create a DockerFile in the Docker environment to install and run the Node.js agent. For the example file used in the following guide, see the following link.

File structure

The Node.js agent's sample file has the structure as follows.

  • html: Sample application folder.

  • Dockerfile: Configuration file to build the Docker image.

  • http.js: Sample application file.

  • package.json: Document for the sample application information and dependency management.

  • whatap.conf: Option configuration file for monitoring.

  • security.conf (or paramkey.txt): Parameter encryption key.

Installing the agent

Add the Node.js agent in the package.json file or execute the npm installation command.

package.json
"dependencies": {
"whatap": "^0.4.72"
}
npm install --save whatap

Container image building

Write the Docker file to build the image.

Dockerfile
FROM node:latest

WORKDIR /app
ADD . .

RUN npm install

CMD ["node","http.js"]

Build

Execute the build command.

$ docker build -t sampleapp/nodejs:0503 .

Execution

Start the container by setting the collection server IP and access key in the environment variables. The application runs along with the Node.js agent.

export WHATAP_LICENSE={access Key}
export WHATAP_SERVER_HOST={collection server IP}

$ docker run --rm -p 3500:3500 \
-e whatap_server_host=$WHATAP_SERVER_HOST \
-e license=$WHATAP_LICENSE \
sampleapp/nodejs:0503

Next steps

  • Checking the installation

    If you have applied all for project creation and agent installation, check the checklist in [the following] (install-check).

  • Agent setting

    It provides various features for monitoring by applying some options to the agent configuration file (whatap.conf). It includes basic configuration, configuration for server connection and data transfer, how to manage the configuration files for multiple application servers, and transaction tracing, and more. For more information, see the following.

  • Starting the monitoring

    After all settings are made, restart the application server. The agent starts collecting data. First, check whether the monitoring data has been collected in Application Dashboard. For more information about Application Dashboard, see the following.