Updated: Sep 12, 2021
Deploy an Application in Cloud Foundry
There are different ways you can deploy your application. After the jar or the war file of the application is created you can directly provide the file to the command shown below:
$ cf push <appname> -p <war/jar file name with path>
cf push myapp -p /cloud/target/myapp_v1.0.war
The above command is the simplest way to deploy an application. Remember the path is a relative path, and it’s calculated from the directory where the command is issued from. The app name will be “myapp” ; this is specified as the third token in the command. The host name of the application will be “myapp” by default. The domain name will be the default domain of your account. After the app is deployed by issuing this command you will be able to see the route of the application.
View details of deployed application:
$ cf app <appname>
This command will show the current status of the app, the number of instances of the app running and the host+domain and the bound service instances.
In the cf push command there are many options. As an example, we can specify how many instances of the application we want to deploy, the default value is 1. We can also specify what will be the host name, default is <appname>. Many other options are possible.
However, application developers generally will not use this command to deploy applications in Cloud Foundry. The more preferable and easy way is to use a manifest file. Please checkout this blog to know how we can use a manifest file to deploy one or more applications in cloud foundry and its benefits.