Cloud Foundry Command Line Interface (cf CLI) is your primary tool for deploying and managing your applications and tasks.
Following are the Steps in Deploying Pivotal App
- Clone the App
git clone https://github.com/cloudfoundry-samples/cf-sample-app-rails.git
-
Log in and Target the API Endpoint
cf login -a YOUR-API-ENDPOINT
-
Create a Service Instance
cf create-service SERVICE_NAME
- Creating a Route
Before deploying an app we need a route(API url) which tells where the app would be deployed.Now when creating a route, you need a route which may or may not available. You can opt for random route as below if the route is not available during time of pushCustom Route
cf create-route SPACE_NAME DOMAIN_NAME DESIRED_ROUTE_NAME cf create-route cloudnative cfapps.io pal-tracker.cfapps.io
Random Route
cf push APP_NAME -p APP_LOCATION/APP_NAME.jar --random-route
- Deploy the App
cf push APP_NAME
- Bind the Service Instance
cf bind-service APP_NAME SERVICE_NAME
- Verify the App – by browsing URL
APP_NAME.cfapps.io
-
A droplet is an archive within Cloud Foundry that contains the application ready to run on Diego. A droplet is the result of the application staging process.
cf restage APP_NAME
-
Use cf restage to refresh the environment variables and cf services to get the list of services
Viewing Recent Logs in CLIcf logs APP_NAME --recent
-
Viewing List of Environment Variables Available
cf env APP_NAME
-
Set environment from Command Prompt
In the below example welcome.message is a variable created by user in gradle.build to be available at environment level.You can override it by supplying value in command promptcf set-env APP_NAME ENV_VAR_NAME ENV_VAR_VALUE cf set-env pal-tracker welcome.message "Hi There"
-
Unset environment from Command Prompt
cf unset-env APP_NAME ENV_VAR_NAME
- Viewing app info
cf app APP_NAME
- Scaling app – Vertical Scaling app instance has more memory or disk space
-m allows to set memory space for app
-f forces the app to restartcf scale APP_NAME -m 768Mb -f
- Scaling app – Horizontal Scaling more app instances serving requests
Allows to set no of Instancescf scale APP_NAME -i 2