Skip to main content

Node.js installation and configuration in a container

Use this workflow with the Add New Node.js agent wizard to ensure you have all the steps covered for installing and configuring the Node.js in a container. Using the wizard is the simplest way to deploy a new agent.

Before you begin

Make sure you have everything you need before you start.

  • The agent will need to be able to reach your Contrast instance. It can be a local/on-premise instance or a hosted instance. A proxy can be configured if the environment has limited network access.

  • It must use supported technologies and system requirements

  • Understand the order of precedence

  • You will also need access to a command line interface (with a chosen directory for downloading the agent) and your organization's instance of Contrast

Start the Node.js agent wizard

  1. Open the agent wizard:

    • Northstar: From the left navigation, select Administration > Agent management. Then, select Add agent at the top of the view.

    • Contrast: Use either of these options:

      • From the header, select Add New and then, select the Application card.

      • Select Administration > Agent management. Then, select Add agent at the top of the view.

  2. Under Select a language, select Node.

  3. Select the operating system you are using.

  4. Under Select application deployment method, select Install with a container.

  5. Under Select method to deploy with containers, select Dockerfile or Kubernetes (Linux or OS X only) or follow agent installation instructions (for Windows).

Install with Linux or OS X

Dockerfile: Build image with the agent

  1. Under Build image with agent, copy the displayed command and add it to your Dockerfile. You can modify your application with the provided command to include the agent.

  2. Copy the displayed command to build the image.

Dockerfile: Configure the agent

Under Configure the agent, select the best options to get the configuration details that the agent needs to communicate with Contrast:

  1. Optionally, select Register the application.

    When you register an application, you can assign it to groups for access control. You can also assign tags and metadata to the application.

  2. Select Use Connection Token.

    This configuration method uses a single variable to specify authentication values.

    Copy the displayed code and set the variable in a location where the agent has access to it.

  3. Continue by verifying the agent deployment.

Kubernetes: Select a method to configure agent operator

  1. Under Select method to configure agent operator, select Helm (recommended) or Manifest.

  2. For Helm:

    1. Under Download and set up files, copy the displayed commands to create a values file. Skip this step if the operator is already installed.

    2. Under the Install and deploy Helm chart, copy the displayed commands to complete the configuration. Skip this step if the operator is already installed.

    3. Label your namespaces to add AgentInjectors.

      kubectl label namespace/<YourNamespaceName> agents.contrastsecurity.com/agent-injectors=true
    4. Under Label the deployments, use the displayed commands to label your deployments.

  3. For Manifest:

    1. Under Install operator, copy the displayed commands to install the Contrast agent operator.

    2. Under Configure operator, copy the displayed commands to configure the Contrast agent operator.

    3. Under Configure injector, copy or download the clusterAgentInjector.yaml

    4. Label your namespaces to add AgentInjectors

      kubectl label namespace/<YourNamespaceName> agents.contrastsecurity.com/agent-injectors=true
    5. Under Label the deployments, use the displayed commands to label your deployments.

    6. Optionally, under Configure agent (optional), copy the displayed commands to configure these entities.

  4. Continue by verifying the agent deployment.

Install with Windows

Build image with the agent

  1. Under Build image with agent, copy the displayed command and add it to your Dockerfile.

  2. You can modify your application with the provided command to include the agent.

  3. Copy the displayed command to build the image.

Configure the agent

Under Configure the agent, select the best options to get the configuration details that the agent needs to communicate with Contrast:

  1. Optionally, select Register the application.

    When you register an application, you can assign it to groups for access control. You can also assign tags and metadata to the application.

  2. For agent versions 5.15.0 and later, select Use Connection Token.

    This configuration method uses a single variable to specify authentication values.

    Copy the displayed code and set the variable in a location where the agent has access to it.

  3. If you prefer to configure the agent using a YAML file, select Download configuration.

    Copy the displayed code to generate a YAML file that contains your authentication settings.

  4. Continue by verifying the agent deployment.

Verify the agent deployment

  1. Interact with your application as you normally would. For example, interact with your application's web interface or send API commands.

  2. Select Administration, then Agent management to verify that your agent appears in the list.

  3. Verify that you see the name of your application in the list.

  4. Select Servers in the header.

  5. Verify that you see the name of your local server in the list.