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

  1. Clone the App
    git clone https://github.com/cloudfoundry-samples/cf-sample-app-rails.git
    
  2. Log in and Target the API Endpoint

    cf login -a YOUR-API-ENDPOINT
    
  3. Create a Service Instance

    cf create-service SERVICE_NAME
    
  4. 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 push

    Custom 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
    
  5. Deploy the App
    cf push APP_NAME
    
  6. Bind the Service Instance
     cf bind-service APP_NAME SERVICE_NAME
    
  7. Verify the App – by browsing URL
     
    APP_NAME.cfapps.io
    
  8. 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
    
  9. Use cf restage to refresh the environment variables and cf services to get the list of services
    Viewing Recent Logs in CLI

    cf logs APP_NAME --recent
    
  10. Viewing List of Environment Variables Available

    cf env APP_NAME
    
  11. 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 prompt

    cf set-env APP_NAME ENV_VAR_NAME ENV_VAR_VALUE
    cf set-env pal-tracker welcome.message "Hi There"
    
  12. Unset environment from Command Prompt

    cf unset-env APP_NAME ENV_VAR_NAME
    
  13. Viewing app info
    cf app APP_NAME
    
  14. 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 restart

    cf scale APP_NAME -m 768Mb -f
    
  15. Scaling app – Horizontal Scaling more app instances serving requests
    Allows to set no of Instances

    cf scale APP_NAME -i 2
    

Comments are closed.