On this page:

 

Your Rating:
Results:
PatheticBadOKGoodOutstanding!
47 rates

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

  1. Create a Pivotal Web Services account OR set up Pivotal Cloud Foundry PaaS. 
  2. Install the cf command line interface. Go to the Pivotal Documentation and search for "install cf cli". 
  3. Install the siege HTTP load tester and benchmarking utility (to generate traffic for the application).

Sample 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:

git clone https://github.com/Appdynamics/PCF-multitier-php.git

Log In to Pivotal

  1. Open a CLI or command-prompt window. 

  2. Identify your Pivotal API endpoint and version. Enter the following command: 

          cf api 
    You should see output such as:

          api endpoint: https://api.my.pivotal.io
          api version: 2.103.0

    Log in to the Pivotal endpoint: cf login 

  3. Enter your email address and Pivotal password when prompted.  

Push the Application

  1. cd to the root directory of the PHP application you want to deploy
  2. Push the application and the Cloud Foundry PHP buildpack: 
    cf push <php-app-name-in-pivotal> -b https://github.com/cloudfoundry/php-buildpack

Bind the Application with an AppDynamics Service Instance

Set Up the Service Plan

  1. Log in to the Pivotal Ops Manager.
  2. 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.
  3. Double-click on the AppDynamics tile in the Installation Dashboard.
  4. In the Settings tab, click AppDynamics Controller Configuration (left menu). Then click Add (right side of the page).
  5. Enter the following Service Plan options. All these fields are required. See PHP Agent Configuration Properties.
    1. Controller configuration name
    2. Controller configuration description
    3. Account Name – The account name used to access the Controller 
    4. 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(').

    5. Controller Host
    6. Controller Port
  6. Click Save to save the changes and return to the Installation Dashboard.
  7. 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

  1. Log in to the Pivotal Apps Manager.
  2. Click Marketplace (left menu) and click AppDynamics under Services.
  3. 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

  1. Enter the following:
    cf bind-service <application-name>
  2. Check the resulting output and verify that the app is successfully deployed. The last lines should confirm that the state of the app is running

         state     since                  cpu    memory        disk           details
    #0   running   2018-02-15T02:06:03Z   0.0%   55.3M of 1G   341.7M of 1G   
     

Verify the Application in the Controller

  1. Generate load on the application as follows:

    1. Enter cf apps to see the URL path of the application.

    2. Create a sample file "urls.txt" in any directory, add the URL link, and save.

    3. To generate traffic, enter: siege --log=/dev/null --concurrent=5 --file=urls.txt --time=90000000s

  2. 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 http_proxy or https_proxy as an environment variable for the application running on PCF to communicate with the proxy server. Do the following:

  1. 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/
  2. 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>

 

  • No labels