anchor.diff:  <%=vars.dev_console_note%>
   </p>
   
  -## <a id='troubleshoot'></a>Troubleshooting ##
  +### <a id='troubleshoot'></a>Troubleshooting ###
   If your application fails to start, verify that the application starts in your local environment. Refer to the [Troubleshooting Application Deployment and Health](./../../devguide/deploy-apps/troubleshoot-app-health.html) topic to learn more about troubleshooting.
  -
  -### App Deploy Fails ###
  -Even when the deploy fails, the app might exist on <%=vars.product_short%>. Run `cf apps` to review the apps in the currently targeted org and space. You might be able to correct the issue using the <%=vars.dev_console_2%>, or you might have to delete the app and redeploy.
  -
  -Common reasons deploying an app fails include:
  -
  -* You did not successfully create and bind a needed service instance to the app, such as a PostgreSQL or MongoDB service instance. Refer to Step 3: Create and Bind a Service Instance for a RoR Application.
  -* You did not successfully create a unique URL for the app. Refer to the troubleshooting tip App Requires Unique URL.
  -
  -### App Requires Unique URL ###
  -<%=vars.product_short%> requires that each app that you deploy has a unique URL. Otherwise, the new app URL collides with an existing app URL and <%=vars.product_short%> cannot successfully deploy the app. You can resolve this issue by running `cf push` with either of the following flags to 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. Using this option might create a long URL, depending on the number of words that the app name includes.
   
   
   
   
   
   
  +
  +
  
positive.code: 
  Run `cf create-service [SERVICE] [PLAN] [SERVICE_INSTANCE]` to create a service instance for your app. Choose a SERVICE and PLAN from the list, and provide a unique name for the SERVICE_INSTANCE.
  
  <p class="tip"><strong>Sample App Step</strong><br />Run <code>cf create-service elephantsql turtle rails-postgres</code>. This creates a service instance named <code>rails-postgres</code> that uses the <code>elephantsql</code> service and the <code>turtle</code> plan, as the example below shows.
  
  <pre class="terminal">
  $   cf create-service elephantsql turtle rails-postgres
  Creating service rails-postgres in org Cloud-Apps / space development as clouduser@example.com....
  OK
  </pre>
  </p>
  
  #### Bind a Service Instance ####
  
  When you bind an app to a service instance, <%=vars.product_short%> writes information about the service instance to the VCAP_SERVICES app environment variable. The app can use this information to integrate with the service instance.
  
  Most services support bindable service instances. Refer to your service provider's documentation to confirm if they support this functionality.
  
  You can bind a service to an application with the command `cf bind-service APPLICATION SERVICE_INSTANCE`.
  
  Alternately, you can configure the deployment manifest file by adding a `services` block to the `applications` block and specifying the service instance. For more information and an example on service binding using a manifest, see the Sample App Step.
  
  <%=vars.dev_console_5%>
  
  <p class="tip"><strong>Sample App Step</strong><br />You can skip this step. The manifest for the sample app contains a <code>services</code> sub-block in the <code>applications</code>block, as the example below shows. This binds the <code>rails-postgres</code> service instance you created in the previous step.
  
  <pre class="code">
  ---
  applications:
  ...
    services:
      - rails-postgres
  </pre>
  </p>
  
  ### Step 4: Configure the Manifest File  ###
  
  You can specify app deployment options in a manifest that the `cf push` command uses. For more information about application manifests and supported attributes, refer to the [Deploying with Application Manifests](./../../devguide/deploy-apps/manifest.html) topic.
  
  <p class="tip"><strong>Sample App Step</strong><br />You can skip this step. The <code>manifest.yml</code> file for <code>rails_sample_app</code> does not require any additional configuration to deploy the app.
  </p>
  
  ### Step 5: 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%>.
  
    <%=vars.gen_GSG%>
  
    <p class="tip"><strong>Sample App Step</strong><br />You must do this step to run the sample app.</p>
  
  
  ### Step 6: (Optional) Configure a Production Server  ###
  
  <%=vars.product_short%> uses the default standard Ruby web server library WEBrick for Ruby and RoR apps. However, <%=vars.product_short%> can support a more robust production web server, such as Phusion Passenger, Puma, Thin, or Unicorn.
  
  To instruct <%=vars.product_short%> to use a web server other than WEBrick, you configure a text file called a _Procfile_. A Procfile enables you to declare required runtime processes, called _process_ _types_, for your web app. Process managers in a server use the process types to run and manage the workload.
  
  When you deploy, <%=vars.product_short%> determines if a Procfile exists and uses the Procfile to configure your app with the specified production web server settings.
  
  In a Procfile, you declare one process type per line and use the following syntax, as shown in the example below:
  
  * `PROCESS_TYPE` is the command name in the format of an alphanumeric string. Specifically for RoR web apps, you can declare `web` and `worker` process types.
  * `COMMAND` is the command line to launch the process.
  
  Example process type syntax:
      <pre class="code">
      PROCESS_TYPE: COMMAND
  </pre>
  
  To set a different production web server for your app:
  
  1. Add the gem for the web server to your Gemfile.
  
  1. In the `config` directory of your app, create a new configuration file or modify an existing file.
  
      Refer to your web server documentation for how to configure this file.
  
      Example Puma config file:
      <pre class="code">
      &#35; config/puma.rb
      threads 8,32
      workers 3
  
      on\_worker\_boot do
        # things workers do
      end
  </pre>
  
  1. In the root directory of your app, create a Procfile and add a command line for a `web` process type that points to your web server.
  
      The example below shows a command that starts a Puma web server and specifies the app runtime environment, TCP port, and paths to the server state information and configuration files.
      Refer to your web server documentation for how to configure the specific command for a process type.
  
      Example Procfile:
      <pre class="code">
      web: bundle exec puma -e $RAILS_ENV -p 1234 -S ~/puma -C config/puma.rb
      </pre>
  
  <p class="tip"><strong>Sample App Step</strong><br />You can skip this step. The <code>rails_sample_app</code> does not require a production server.</p>
  
  ### Step 7: Deploy an App ###
  
  <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]` to deploy your application.
  
  
negative.code: 
  If you want to view log activity while the app deploys, launch a new terminal window and run `cf logs [APP-NAME]`.
  
  In the terminal output of the `cf push` command, the `urls` field of the `App started` block contains the app URL. This is the `HOST_NAME` you specified with the `-n` flag plus the domain `<%=vars.app_domain%>`. Once your app deploys, use this URL to access the app online.
  
  
  ##<a id="next"></a>Next Steps ##
  
  You’ve deployed an app to <%=vars.product_short%>! Consult the sections below for information about what to do next.
  
  ###<a id="test"></a> Test a Deployed App ###
  
  Use the `cf` <%=vars.dev_console_2%> to review information and administer your app and your <%=vars.product_short%> account. For example, you could edit the `manifest.yml` to 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%>
  
  ### <a id='cli-manage'></a>Manage Your Application with the cf CLI ###
  
  Run `cf help` to view a complete list of commands, grouped by task categories, and run `cf help [COMMAND]` for detailed information about a specific command. For more information about using the `cf` CLI, refer to the cf Command Line Interface (CLI) topics, especially the <%=vars.cli_v6%> topic.
  
  