anchor.diff:  
   
   
  -## Deploy a Ratpack Sample Application ##
  -
  -This section describes how to deploy a Ratpack sample application to <%=vars.product_short%>.
  -
  -To learn how to deploy your own Ratpack app, see [Deploy Your Ratpack Application](#deploy-yourapp).
  -
  -### Prerequisites ###
  -
  -* [Git](http://git-scm.com) configured on your workstation and a [GitHub](https://github.com) account
  -* Basic Ratpack knowledge
  -* (**Optional**) [Spring Boot CLI](http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#cli) to run your Ratpack app locally
  -
  -### Step 1: Get a Sample Ratpack App from GitHub ###
  -
  -Run `git clone https://github.com/cf-platform-eng/cf-bg-demo.git` to clone the `cf-bg-demo` app from GitHub.
  -
  -### Step 2: Log in and Target the API Endpoint   ###
  -Run `cf login -a [API_ENDPOINT]`, enter your login credentials, and select a space and org. The API endpoint is <%=vars.api_endpoint%>.
  -
  -### Step 3: Deploy the Sample App ###
  -
  -1. `cd` to the cloned app directory.
  -1. Complete all the steps in the **Doing a Blue-Green Demo** section of the [cf-platform-eng/cf-bg-demo README](https://github.com/cf-platform-eng/cf-bg-demo).
  -
  -If you want to run the app locally using the Spring Boot CLI, complete the **Running Locally** section.
  -
  -  `cf push [APP_NAME]` pushes the specified app from the current directory to <%=vars.product_short%>. Use the `-n` or `--random-route` flag to create a unique URL for the app to avoid URL collisions with other apps.
  -
  -  `cf push` automatically searches for an [application manifest YAML file](./../../devguide/deploy-apps/manifest.html) and also determines the appropriate [buildpack](./index.html) for the app. A manifest specifies what `cf push` should do with the app and the buildpack provides framework and runtime support for your app. 
  -
  -  The example shows the terminal output of deploying the initial blue version of the app. Because this sample application does not have a manifest, the `-m` and `-b` flags substitute for the manifest and set the memory and buildpack location for the app. `cf push` uses these settings to create the app, create and bind and the route, and upload the app to <%=vars.product_short%>. It then starts one instance of the app with 512M. After the app starts, the output displays the health and status of the app.
  -
  -<pre class="terminal">
  -$ cf push -m 512M -b https://github.com/cloudfoundry/java-buildpack --random-route cf-bg-demo-blue
  -
  -Creating app cf-bg-demo-blue in org Cloud-Apps / space development as clouduser@example.com...
  -OK
  -
  -Creating route cf-bg-demo-blue-grouty-sarcode.<%=vars.app_domain%>...
  -OK
  -
  -Binding cf-bg-demo-blue-grouty-sarcode.cfapps.io to cf-bg-demo-blue...
  -OK
  -
  -Uploading cf-bg-demo-blue...
  -Uploading app files from: /Users/pivotal/workspace/cf-bg-demo
  -Uploading 262.9K, 19 files
  -OK
  -
  -Starting app cf-bg-demo-blue in org Cloud-Apps / space development as clouduser@example.com...
  -OK
  ------> Downloaded app package (576K)
  -Cloning into '/tmp/buildpacks/java-buildpack'...
  ------> Java Buildpack Version: 840da8b | https://github.com/cloudfoundry/java-buildpack#840da8b
  ------> Downloading Open Jdk JRE 1.7.0_65 from http://download.run.pivotal.io/openjdk/lucid/x86_64/openjdk-1.7.0_65.tar.gz (1.2s)
  -       Expanding Open Jdk JRE to .java-buildpack/open_jdk_jre (1.1s)
  ------> Downloading Spring Boot CLI 1.1.5_RELEASE from http://download.run.pivotal.io/spring-boot-cli/spring-boot-cli-1.1.5_RELEASE.tar.gz (0.4s)
  -       Expanding Spring Boot CLI to .java-buildpack/spring_boot_cli (0.1s)
  ------> Uploading droplet (39M)
  -
  -0 of 1 instances running, 1 starting
  -0 of 1 instances running, 1 starting
  -1 of 1 instances running
  -
  -App started
  -
  -Showing health and status for app cf-bg-demo-blue in org Cloud-Apps / space development as clouduser@example.com...
  -OK
  -
  -requested state: started
  -instances: 1/1
  -usage: 512M x 1 instances
  -urls: cf-bg-demo-blue-grouty-sarcode.<%=vars.app_domain%>
  -
  -	     state     since                    cpu    memory           disk   
  -	#0   running   2014-08-26 11:46:54 AM   0.0%   325.2M of 512M   114.5M of 1G
  -</pre>
  -
  -### Step 4: Test the Sample App ###
  -
  -You’ve deployed your first app to <%=vars.product_short%>!
  -
  -In Step 5 of the README instructions, you complete mapping both blue and green app versions to the zero downtime route. The composite image below shows the result of this mapping to the zero downtime route URL `cf-bg-demo-a1426.cfapps.io`. Refreshing the webpage causes the different app versions to display and demonstrates the <%=vars.product_short%> load balancing functionality in action.
  -
  -<%= image_tag("../images/blue_green_demo.png") %>
  -
  -Now let’s access your app online using its URL. In the terminal output, the `urls` field of the `App started` block contains the app URL. This is the `HOST_NAME` and alphanumeric suffix you specified with the `-n` flag plus the domain `<%=vars.app_domain%>`. Note that because you unmapped the blue app version from your zero downtime route URL in Step 6, only the green app version displays when you browse to this URL. Remap the blue app version to view both versions and test the <%=vars.product_short%> load balancing functionality.
  -
  -You can now use the `cf` <%=vars.dev_console_2%> to review information and administer your app and your <%=vars.product_short%> account. For example, you could increase the number of app instances from 1 to 3, and redeploy the app with a new app name and host name. 
  -
  -See the [Manage Your Application with the cf CLI](#cli-manage) section for more information. <%=vars.dev_console_4%>
  -
  -
  - 
  - 
  - 
  - 
  - 
positive.code: 
    <p class="tip"><strong>Sample App Step</strong><br />You must do this step to run the sample app.</p>
  
  
  ### Step 9: Deploy Your Application ###
  
  <p class="note"><strong>Note</strong>: You must use the cf CLI to deploy apps.</p>
  
  From the root directory of your application, run `cf push [APP-NAME] -p [PATH-TO-.distZip]` to deploy your application. 
  
  <p class="note"><strong>Note</strong>: You must deploy the <code>.distZip</code> artifact for a Ratpack app, and you must include the path to the <code>.distZip</code> file in the `cf push` command if you do not declare the path in the `applications` block of the manifest file. For more information, refer to the <a href="./java-tips.html">Tips for Java Developers</a> topic.</p>
  
  `cf push [APP-NAME]` creates a URL route to your application in the form HOST.DOMAIN, where HOST is your [APP-NAME] and DOMAIN is specified by your administrator. Your DOMAIN is`<%=vars.app_domain%>`. For example: `cf push my-app` creates the URL `my-app.<%=vars.app_domain%>`.
  
  The URL for your app must be unique from other apps that <%=vars.product_short%> hosts or the push will fail. Use the following options to help create a unique URL:
  
  * `-n` to assign a different HOST name for the app.
  * `--random-route` to create a URL that includes the app name and random words.
  * Run `cf help push` to view other options for this command.
  
  If you want to view log activity while the app deploys, launch a new terminal window and run `cf logs [APP-NAME]`.
  
  Once your app deploys, browse to your app URL. Search for the `urls` field in the `App started` block in the output of the `cf push` command. Use the URL to access your app online.
  
  
  	
  <p class="tip"><strong>Sample App Step</strong><br />
  <ol>
  <li>Build the app. Change to the <code>app</code>directory, and run <code>./gradlew distZip</code>.</li>
  <li>Push the app. Run <code>cf push pong_matcher_groovy -n [HOST_NAME]</code>.
  <br /><br />
  Example: <code>cf push pong_matcher_groovy -n groovy-ratpack-app</code>
  <p class="note"><strong>Note</strong>: You do not have to include the <code>-p</code> flag when you deploy the sample app. The sample app manifest declares the path to the archive that <code>cf push</code> uses to upload the app files.</p>
  </li>
  </ol>
  
  The example below shows the terminal output of deploying the <code>pong_matcher_groovy</code> app. <code>cf push</code> uses the instructions in the manifest file to create the app, create and bind the route, and upload the app. It then binds the app to the <code>baby-redis</code> service and follows the instructions in the manifest to start one instance of the app with 512 MB. After the app starts, the output displays the health and status of the app.
  </p>
  
  <pre class="terminal">
  
  
negative.code: ### Prerequisites ###
  
  * A Ratpack app that runs locally on your workstation
  * Intermediate to advanced Ratpack knowledge
  * The [cf Command Line Interface (CLI)](../../devguide/installcf/install-go-cli.html)
  * JDK 1.7 or 1.8 for Java 7 or 8 configured on your workstation.    
  
  <p class="note"><strong>Note</strong>: You can develop Ratpack applications in Java 7 or 8 or any JVM language. The Cloud Foundry Java buildpack uses JDK 1.8, but you can modify the buildpack and the manifest for your app to compile to JDK 1.7. Refer to <a href="#yourapp-step7">Step 7: Configure the Deployment Manifest</a>.</p>
  
  ### Step 1: Add the Cloud Foundry Java Client Library to Your Project ###
  
  The Cloud Foundry Java Client Library enables you to query and manage app instances and account instance information of a <%=vars.product_short%> account instance. For more information on including this library with your Gradle or Maven project and the specific objects that you can query, refer to the [Cloud Foundry Java Client Library](./java-client.html) topic.
  
  <p class="tip"><strong>Sample App Step</strong><br />You can skip this step. The sample app does not include the Cloud Foundry Java Client Library.</p>
  
  ### Step 2: (Optional) Integrate a Plugin for Your Build Tool ###
  
  