Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Pcf commands


Published on

Compilation of PCF commands for reference

Published in: Technology
  • Be the first to comment

Pcf commands

  1. 1. PCF Rajan Prasad Upadhyay Rajan p Upadhyay 1
  2. 2. PCF Keywords • Api endpoint • Org, spaces • Target • Push • logs • Scale • Service, cups service • Binding/unbinding • routes Rajan p Upadhyay 2
  3. 3. Basic Commands • Cf api • Cf login • Cf logout • Cf target Rajan p Upadhyay 3
  4. 4. Other commands • Cf apps • Cf app APP_NAME • Cf push APP_NAME • Cf push –f <manifest_file> -p<package_file> • Cf scale APP_NAME • Cf scale APP_name –i <instances_num> -k <disk_limit> -m<memory> -f • Cf delete APP_NAME -r Rajan p Upadhyay 4
  5. 5. More commands • Cf rename APP_NAME NEW_NAME • Cf start APP_NAME • Cf stop APP_NAME • Cf restart APP_NAME • Cf restage APP_NAME • Cf events APP_NAME • Cf restart-app-instance APP_NAME Index • Cf logs APP_NAME Rajan p Upadhyay 5
  6. 6. Even more commands • Cf env App_Name • Cf set-env APP_NAME <Key> <Value> • Cf unset-env APP_NAME <Key> Rajan p Upadhyay 6
  7. 7. Services command • Cf marketplace • Cf services • Cf service SERVICE_INSTANCE • Cf create-service SERVICE PLAN SERVICE_INSTANCE • Cf delete-service SERVICE_INSTANCE • Cf rename-service SERVICE_INSTANCE NEW_SERVICE_INSTANCE • Cf bind-service APP_NAME SERVICE_INSTANCE • Cf unbind-service APP_NAME SERVICE_INSTANCE • Cf create-user-provided-service SERVICE_INSTANCE • Cf update-user-provided-service SERVICE_INSTANCE • Eg. Create database user provided service in interactive mode cf cups SERVICE_NAME -p "url, username, password, encrypted" Rajan p Upadhyay 7
  8. 8. Org commands • Cf orgs • Cf org ORG_NAME • Cf create-org ORG_NAME • Cf delete-org ORG_NAME • Cf rename-org ORG_NAME NEW_ORG_NAME Rajan p Upadhyay 8
  9. 9. Spaces • Cf spaces • Cf space SPACE_NAME • Cf create-space SPACE • Cf delete-space SPACE • Cf rename-space SPACE NEW_SPACE Rajan p Upadhyay 9
  10. 10. Domain commands • Cf domains • Cf create-domain ORG DOMAIN • Cf delete-domain DOMAIN • -- shared domain can only be created by admins • Cf create-shared-domain DOMAIN • Cf delete-shared-domain DOMAIN Rajan p Upadhyay 10
  11. 11. Routes command • Cf routes • Cf create-route SPACE DOMAIN [-n HOST] • Cf check-route HOST DOMAIN • Cf map-route APP_NAME DOMAIN [-n HOST] • Cf unmap-route APP_NAME DOMAIN • Cf delete-orphaned-routes • -- routing is very important Rajan p Upadhyay 11
  12. 12. extra commands • Cf buildpacks • Cf feature-flags Rajan p Upadhyay 12
  13. 13. Blue Green JVM • For zero down-time in production • Route = host + shared_domain • We can have many routes point to same application • Blue Gree JVM • deploy application in PR with a non production route. One prefixed green and one prefixed blue • Create the production route manually: without mapping to any jvm • Which ever instance is tested, point the PR_ROUTE to that jvm instance Rajan p Upadhyay 13
  14. 14. Blue green jvm example • Say in PR, an application ABC needs to be deployed with a route abc. Where and host=abc • Deploy the application with a host green-abc and app-name green-abc ie route = • Create the abc route manually cf creae-route <SPACE> –n abc • When testing is finished with the application and it ok, map the route cf map-route ABC –n abc • Now route abc. will also point to the application ABC in addition to • you can unmap the green-abc route from the application Rajan p Upadhyay 14
  15. 15. Blue green jvm example continued • Next time you have some change in code and want to deploy in PR • Deploy it with host blue-abc with a new applicationName blue-abc. • So the new instance will have a mapped route of • Lets say the testing is complete and you want to make this the production version. You can map the abc route to blue-abc application. Cf map-route blue-abc –n abc • Now the route abc. will be pointing to both the instances green- abc and blue-abc • Now unmap the route from the green-abc instance so that it will only point to blue-abc instance • Cf unmap-route green-abc –n abc • If some problem is discovered and you want to backout the changes, simply map the route to green-abc and unmap it from blue-abc. Rajan p Upadhyay 15