Skip to main content

Add the Contrast service broker for Node.js

Use the Contrast service broker to easily bind services to an application in VMware Tanzu (Pivotal Cloud Foundry) and use the Contrast Node.js agent.

Steps

To set up VMware Tanzu:

  1. Contact Support.

  2. Once you have a service broker source code, deploy the service broker application:

    cf push contrast-security-service-broker

    The service broker now appears in PCF.

  3. Configure plans with the CONTRAST_SERVICE_PLANS environment variable (the service broker does not offer any plans by default).

    You can also use the Pivotal Ops Manager to set the environment variables. If you are using IBM Cloud, you can select the application, select Runtime and then Environment Variables to set the value.

    Example: This example shows how to set the value in the command line.

    cf set-env contrast-security-service-broker CONTRAST_SERVICE_PLANS
        " {
                "ServicePlan1": {
                     "name":"ServicePlan1",
                     "teamserver_url":"https://yourteamserverurl.com",
                     "username":"your_username",
                     "org_uuid":"00000000-1111-2222-3333-000000000000",
                     "api_key":"your_api_key",
                     "service_key":"your_service_key"
                 },
                 "AnotherServicePlan":{
                     "name":"AnotherServicePlan",
                     "teamserver_url":"https://yourteamserverurl.com",
                     "username":"your_username",
                     "org_uuid":"00000000-1111-2222-3333-000000000001",
                     "api_key":"your_api_key",
                     "service_key":"some_other_service_key"
                     }
                 } "

    To run the agent on IBM Cloud, you must use single quotes to set the CONTRAST_SERVICE_PLANS environment variable. Example:

        cf set-env contrast-security-service-broker CONTRAST_SERVICE_PLANS
        " {
                'ServicePlan1': {
                     'name':'ServicePlan1',
                     'teamserver_url':'https://yourteamserverurl.com',
                     'username':'your_username',
                     'org_uuid':'00000000-1111-2222-3333-000000000000',
                     'api_key':'your_api_key',
                     'service_key':'your_service_key'
                 },
                 'AnotherServicePlan':{
                     'name':'AnotherServicePlan',
                     'teamserver_url':'https://yourteamserverurl.com',
                     'username':'your_username',
                     'org_uuid':'00000000-1111-2222-3333-000000000000',
                     'api_key':'your_api_key',
                     'service_key':'some_other_service_key'
                     }
                 } "
  4. Restage your application with a command similar to this example:

    cf restage contrast-security-service-broker
  5. Set an environment variable for a username and a password:

    cf set-env contrast-security-service-broker SECURITY_USER_NAME aSecureUsername
    cf set-env contrast-security-service-broker SECURITY_USER_PASSWORD aSecurePassword
  6. Create a service broker instance. Define at least one service plan for this. You must use the same username and password created in the previous step.

    cf create-service-broker contrast-security-service-broker USER_NAME PASSWORD
    <URL of your application>

    On IBM Cloud, add --space-scoped at the end of the command. For example:

    cf create-service-broker contrast-security-service-broker USER_NAME PASSWORD
    <URL of your application> --space-scoped
  7. All service brokers start as private. Make it public with:

    cf enable-service-access contrast-security-service-broker
  8. Once the service broker is working, create a service instance and bind it to the application. To create a service instance, run the following command:

    cf create-service contrast-security-service-broker ServicePlan1 <name_of_service>
  9. Bind the service broker to your application by running the following command:

    cf bind-service <app_name> <name_of_service>

    You should now see the agent start up with your application. You will also see your application in Contrast.

See also

Add Contrast service broker tile