anchor.diff:  	#0   running   2014-01-24 05:07:18 PM   0.0%   18.5M of 1G   52.5M of 1G
   
   </pre>
  -
  
positive.code: ---
  title: Deploying an App
  owner: CAPI
  ---
  
  This topic describes how to deploy an app with the Cloud Foundry Command Line Interface (cf CLI).
  
  <p class="note"><strong>Note</strong>: See the <a href="../../buildpacks/">buildpacks</a> documentation for deployment guides specific to your app language or framework, such as the <a href="../../buildpacks/ruby/gsg-ror.html">Getting Started Deploying Ruby on Rails Apps</a> guide.</p>
  ## <a id="overview"></a> Overview
  
  To deploy an app, do the following:
  
  3. [(Optional) Configure Domains](#domain)
  4. [Determine Deployment Options](#options)
  5. [Push the App](#push)
  
  
  ## <a id='prepare'></a> Prerequisites
  
  Before you deploy your app to Cloud Foundry, make sure that:
  
  * Your app is *cloud-ready*.
  Cloud Foundry behaviors related to file storage, HTTP sessions, and port usage
  may require modifications to your app.
  
  * All required app resources are uploaded.
  
negative.code: You should explicitly exclude extraneous files that reside within your
  app directory structure, particularly if your app is large.
  
  * Every service that your app needs has an instance that it can access, for example running in the same space.
  
  * Your <%= vars.product_short %> installation supports the type of app you are going to
  push, or you have the URL of an externally-available buildpack that can stage
  the app.
  
  * You have all of the following:
    - The API endpoint for your <%= vars.product_short %> installation. Also known as the target
  URL, this is <%=vars.api_endpoint%>.
    - Your username and password for your <%= vars.product_short %> installation.
    - The organization and space where you want to deploy your app.
  A <%= vars.product_short %> workspace is organized into organizations, and within them,
  spaces.
  As a <%= vars.product_short %> user, you may have access to one or more organizations and
  spaces.
  
  ## <a id='domain'></a>(Optional) Configure Domains
  
  <%= vars.product_short %> directs requests to an app using a route, which is a URL
  made up of a host and a domain.
  
  * The name of an app is the default host for that app, unless you specify the host name with the <code>-n</code> flag.
  
  * Every app is pushed to a space that belongs to a domain.
  Every <%= vars.product_short %> installation has a default domain.
  You can specify a custom domain for the app if
    - The domain is registered
    - The domain is mapped to the org that contains the target space for the app
  
  <p class='note'><strong>Note</strong>:
  <%= vars.product_short %> ​allows​ app names, but not app URLs, to include underscores.
  <%= vars.product_short %> converts underscores to hyphens when setting a default app URL from an app name.
  </p>
  
  * The URL for your app must be different from other apps hosted by <%=vars.product_short%>.
  The following `cf push` options can help create a unique URL:
     - `-n` assigns a different HOST name for the app
     - `--random-route` creates a URL that includes the app name and random words
  
   <p class='note'><strong>Note</strong>: Run <code>cf help push</code> to view other options for the <code>cf push</code> command.</p>
  
  <%=vars.ssl%>
  
  For more information about domains, see [Routes and Domains](./routes-domains.html).
  
  ## <a id='options'></a>Determine Push Options
  
  Before you push an app, you need to decide on the following:
  
  * **Name**: You can use any series of alphanumeric characters as the name of your app.
  * **Instances**: Generally speaking, the more app instances you run, the less
  downtime your app will experience.
  If your app is still in development, running a single instance can
  simplify troubleshooting.
  For any production app, we recommend a minimum of two instances.
  * **Memory Limit**: The maximum amount of memory that each instance of your
  app can consume.
  If an instance exceeds this limit, <%= vars.product_short %> restarts the instance.
      <p class='note'><strong>Note</strong>: Initially, <%= vars.product_short %> immediately
  	restarts any instances that exceed the memory limit. If an instance
  	repeatedly exceeds the memory limit in a short period of time, <%= vars.product_short %>
  	delays restarting the instance.</p>
  * **Start Command**: This is the command that <%= vars.product_short %> uses to start each
  instance of your app.
  This start command varies by app framework.
  * **Subdomain (host) and Domain**:
  The route, which is the combination of subdomain and domain, must be globally
  unique.
  This is true whether you specify a portion of the route or allow <%= vars.product_short %>
  to use defaults.
  * **Services**: Apps can bind to services such as databases, messaging,
  and key-value stores.
  