Starting, Restarting, and Restaging Applications
Page last updated:
This topic describes how to start, restart, and restage applications in Cloud Foundry.
To start your application, run the following command from your application root directory:
$ cf push YOUR-APP
For more information about deploying applications, see the Deploy an Application topic.
Cloud Foundry determines the start command for your application from one of the three following sources:
-ccommand-line option in the Cloud Foundry Command Line Interface (cf CLI). See the following example:
$ cf push YOUR-APP -c "node YOUR-APP.js"
commandattribute in the application manifest. See the following example:
command: node YOUR-APP.js
The buildpack, which provides a start command appropriate for a particular type of application.
The source that Cloud Foundry uses depends on factors explained below.
The first time you deploy an application,
cf push uses the buildpack start command by default.
cf push defaults to whatever start command was used for the previous push.
To override these defaults, provide the
-c option, or the command attribute in the manifest.
When you provide start commands both at the command line and in the manifest,
cf push ignores the command in the manifest.
To force Cloud Foundry to use the buildpack start command, specify a start command of
You can specify a null start command in one of two ways.
-ccommand-line option in the cf CLI:
$ cf push YOUR-APP -c "null"
commandattribute in the application manifest:
This can be helpful after you have deployed while providing a start command at the command line or the manifest.
At this point, a command that you provided, rather than the buildpack start command, has become the default start command.
In this situation, if you decide to deploy using the buildpack start command, the
null command makes that easy.
Start commands are used in special ways when you migrate a database as part of an application deployment. See the Migrating a Database in Cloud Foundry topic for more information.
To restart your application, run the following command:
$ cf restart YOUR-APP
Restarting your application stops your application and restarts it with the already compiled droplet. A droplet is a tarball that includes:
- application source code
The Diego cell unpacks, compiles, and runs a droplet on a container.
Restart your application to refresh the application’s environment after actions such as binding a new service to the application or setting an environment variable that only the application consumes. However, if your environment variable is consumed by the buildpack in addition to the application, then you must restage the application for the change to take effect.
To restage your application, run the following command:
$ cf restage YOUR-APP
Restaging your application stops your application and restages it, by compiling a new droplet and starting it.
Restage your application if you have changed the environment in a way that affects your staging process, such as setting an environment variable that the buildpack consumes. The staging process has access to environment variables, so the environment can affect the contents of the droplet.
Restaging your application compiles a new droplet from your application without updating your application source. If you must update your application source, re-push your application by following the steps in the section above.Create a pull request or raise an issue on the source for this page in GitHub