Before you begin
What you’ll need:
- Dynatrace environment credentials
- Cloud Foundry CLI
- Supported applications and versions
What is Cloud Foundry?
Cloud Foundry is a Platform-as-a-Service that consists of a set of open source tools that help you run applications at scale. Once the platform is set up and running, your developers can push applications to it. Health management, fail-over, and load-balancing of application instances are provided out of the box.
Applications deployed on Cloud Foundry are usually run through technology-specific buildpacks that provide framework and runtime support for applications running on the Cloud Foundry platform.
These guidelines apply to integration with Java Buildpack, IBM WebSphere Application Server Liberty Buildpack, and Node.js apps (using the Dynatrace NPM module for PaaS).
Generate PaaS token
The first step is to get your environment ID and generate a PaaS token for your Dynatrace environment. All the required information is presented to you in the Deploy Dynatrace wizard.
- From your Dynatrace home dashboard, open the Dynatrace menu and select Deploy Dynatrace.
- On the Deploy Dynatrace page, click Set up PaaS integration. Here you can copy the environment ID and generate the PaaS token that Dynatrace needs to link your Dynatrace account with Cloud Foundry apps, as shown below.
Get the Cloud Foundry CLI
The code examples below use the
cf CLI for interfacing with Cloud Foundry clusters. You can find the appropriate CLI for your operating system on GitHub.
Create a Dynatrace service in your Cloud Foundry environment
Cloud Foundry allows you to connect applications with 3rd party tools and other external resources (for example, databases) by means of services. On Cloud Foundry, service instances hold the credentials that are required to connect to such resources. You’ll use this same approach to connect your apps with OneAgent.
This is why you need to define a service instance by either creating a so-called “user-provided service” or by using a service broker application.
Please select one of the following:
Option 1: Create a user-provided service
Create a single service instance for Dynatrace with the name
dynatrace as a substring. For example:
You will then be prompted for:
Be sure to replace
<paastoken> with your credentials, as explained above.
If you’re using Dynatrace Managed, you need to add an extra field to the payload that specifies the API endpoint of your Managed Server:
This needs to be set to
Option 2: Create a service instance via service broker
If you want to maintain Dynatrace credentials in a central location, use a service broker. For complete details, visit GitHub. You must configure and run the broker as an application, add the service broker to Cloud Foundry, enable service access to users, and finally, create the service instance.
Option 3: Create a service instance via the service broker on the Pivotal Network
If you run a Pivotal Cloud Foundry environment you can make use of the Dynatrace Service Broker tile on the Pivotal Network. For full details, see the instructions for the Dynatrace Service Broker tile.
Bind Dynatrace service to your application
You can either bind the created Dynatrace service to your application in your
manifest.yml file prior to starting your app or you can bind the service to your app and restage the app afterwards.
If you’re pushing a Java application, this could look like the following example:
If you’re pushing a Node.js app to Cloud Foundry you need to first install the NPM module and load the module in your application.
Note: For Node.js applications, it’s considered best practice to exclude the
node_modules directory from the upload to Cloud Foundry to save time and bandwidth. For this reason add
node_modules/ to a text file named
npm install in your project directory.
As the first statement of your application, add:
Supported integrations with Cloud Foundry - Beta
Dynatrace is currently integrated with:
- Java Buildpack
- IBM WebSphere Application Server Liberty Buildpack
- Dynatrace npm module for PaaS to monitor Node.js apps
Please note that these buildpacks are maintained by the Cloud Foundry Foundation on GitHub. If you experience issues with the integration of Dynatrace into these buildpacks or the npm module, please get in touch with Dynatrace Support. The Cloud Foundry integrations are currently considered Beta.
Using earlier buildpack versions
If you’re using versions of the Java Buildpack or the IBM WebSphere Application Server Liberty Buildpack that were released before Nov 30th, 2016 you’ll need to provide deprecated tenant token credentials. Please refer to using earlier Cloud Foundry buildpack versions.