Starting, Restarting, and Restaging Apps
This topic describes how to start, restart, and restage apps in Cloud Foundry.
To start your app, run the following command from your app root directory:
$ cf push YOUR-APP
For more information about pushing apps, see the Pushing an App topic.
Cloud Foundry determines the start command for your app 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 app manifest. See the following example:
command: node YOUR-APP.js
The buildpack, which provides a start command appropriate for a particular type of app.
The source that Cloud Foundry uses depends on factors explained below.
The first time you deploy an app,
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 app 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 app deployment. For more information, see Services Overview.
To restart your app, run the following command:
$ cf restart YOUR-APP
Restarting your app stops your app and restarts it with the already compiled droplet. A droplet is a tarball that includes:
- app source code
The Diego cell unpacks, compiles, and runs a droplet on a container.
Restart your app to refresh the app’s environment after actions such as binding a new service to the app or setting an environment variable that only the app consumes. However, if your environment variable is consumed by the buildpack in addition to the app, then you must restage the app for the change to take effect.
To restage your app, run the following command:
$ cf restage YOUR-APP
Restaging your app stops your app and restages it, by compiling a new droplet and starting it.
Restage your app 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 app compiles a new droplet from your app without updating your app source. If you must update your app source, re-push your app by following the steps in the section above.Create a pull request or raise an issue on the source for this page in GitHub