On this page:
AppDynamics integrates with Pivotal Cloud Foundry (PCF). You can easily deploy AppDynamics-monitored PHP applications on the Pivotal platform.
Deploying a PHP Application in Pivotal
The following steps outline the workflow:
Before You Start
- Create a Pivotal Web Services account OR set up Pivotal Cloud Foundry PaaS.
- Install the cf command line interface. Go to the Pivotal Documentation and search for "install cf cli".
- Install the siege HTTP load tester and benchmarking utility (to generate traffic for the application).
You can use the following sample PHP application to go through this workflow. To clone this application, cd to your root git-repositories folder and enter:
Log In to Pivotal
Open a CLI or command-prompt window.
Identify your Pivotal API endpoint and version. Enter the following command:
cf apiYou should see output such as:
api version: 2.103.0
Log in to the Pivotal endpoint:
Enter your email address and Pivotal password when prompted.
Push the Application
- cd to the root directory of the PHP application you want to deploy
- Push the application and the Cloud Foundry PHP buildpack:
cf push <php-app-name-in-pivotal> -b
Bind the Application with an AppDynamics Service Instance
Set Up the Service Plan
- Log in to the Pivotal Ops Manager.
- If the AppDynamics Service Broker tile does not appear in the Installation Dashboard, click Import a Product in the left-side menu and import the AppDynamics tile.
- Double-click on the AppDynamics tile in the Installation Dashboard.
- In the Settings tab, click AppDynamics Controller Configuration (left menu). Then click Add (right side of the page).
- Enter the following Service Plan options. All these fields are required. See PHP Agent Configuration Properties.
- Controller configuration name
- Controller configuration description
- Account Name – The account name used to access the Controller
Account Access Key – In the Controller, click the gear icon
and choose License > Account > Access Key.
If the Account Access Key includes a one or more '$' characters, append a second '$' to every '$' included in the key string and surround the entire string with single quotes(').
- Controller Host
- Controller Port
- Click Save to save the changes and return to the Installation Dashboard.
- In the Installation Dashboard, click Apply Changes (right pane) and wait for all the changes to get applied.
Bind the Service Plan to the Application
- Log in to the Pivotal Apps Manager.
- Click Marketplace (left menu) and click AppDynamics under Services.
- Under Service Plans, select the service plan that you set up in the Ops Manager. Then click Select this plan. The Service tab confirms that the service is successfully bound to the application.
Restage the Application
- Enter the following:
cf bind-service <application-name>
Check the resulting output and verify that the app is successfully deployed. The last lines should confirm that the
stateof the app is
Verify the Application in the Controller
Generate load on the application as follows:
cf appsto see the URL path of the application.
Create a sample file "urls.txt" in any directory, add the URL link, and save.
To generate traffic, enter:
siege --log=/dev/null --concurrent=5 --file=urls.txt --time=90000000s
Log in to the Controller web UI, navigate to the Metric Browser, and verify that the application is getting detected and monitored.
After You Deploy
You might want to do one of the following after you deploy an application:
Setting Proxy Properties
If you are using a Proxy Server, the consumer application should specify the
https_proxy as an environment variable for the application running on PCF to communicate with the proxy server. Do the following:
- Set the environment variable for the application and the Controller.
For an HTTP proxy:
cf set-env <app-name> http_proxy http://user@password:myproxy....:8080/
For an HTTPS proxy:
cf set-env <app-name> https_proxy https://user@password:myproxy....:8080/
- Restage the application:
cf restage <app-name>
Scaling the Application Manually
You can scale the number of instance of the application using the cf CLI. The Pivotal infrastructure automatically load balances the traffic between multiple instances. Enter the following:
cf scale <app_name> -i <number_of_instances>