Pcf commands

15
PCF Rajan Prasad Upadhyay Rajan p Upadhyay 1

Transcript of Pcf commands

Page 1: Pcf commands

Rajan p Upadhyay 1

PCFRajan Prasad Upadhyay

Page 2: Pcf commands

Rajan p Upadhyay 2

PCF Keywords• Api endpoint• Org, spaces• Target• Push• logs• Scale• Service, cups service• Binding/unbinding• routes

Page 3: Pcf commands

Rajan p Upadhyay 3

Basic Commands • Cf api• Cf login• Cf logout• Cf target

Page 4: Pcf commands

Rajan p Upadhyay 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

Page 5: Pcf commands

Rajan p Upadhyay 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

Page 6: Pcf commands

Rajan p Upadhyay 6

Even more commands• Cf env App_Name• Cf set-env APP_NAME <Key> <Value>• Cf unset-env APP_NAME <Key>

Page 7: Pcf commands

Rajan p Upadhyay 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"

Page 8: Pcf commands

Rajan p Upadhyay 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

Page 9: Pcf commands

Rajan p Upadhyay 9

Spaces• Cf spaces• Cf space SPACE_NAME• Cf create-space SPACE• Cf delete-space SPACE• Cf rename-space SPACE NEW_SPACE

Page 10: Pcf commands

Rajan p Upadhyay 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

Page 11: Pcf commands

Rajan p Upadhyay 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

Page 12: Pcf commands

Rajan p Upadhyay 12

extra commands• Cf buildpacks• Cf feature-flags

Page 13: Pcf commands

Rajan p Upadhyay 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

Page 14: Pcf commands

Rajan p Upadhyay 14

Blue green jvm example• Say in PR, an application ABC needs to be deployed with a route abc. rajanu.com.npWhere shared-domain=rajanu.com.np and host=abc• Deploy the application with a host green-abc and app-name green-abc

ie route = green-abc.rajanu.com.np• Create the abc route manually

cf creae-route <SPACE> rajanu.com.np –n abc• When testing is finished with the application and it ok, map the route

cf map-route ABC rajanu.com.np –n abc• Now route abc. rajanu.com.np will also point to the application ABC in addition to

green-abc.rajanu.com.np• you can unmap the green-abc route from the application

Page 15: Pcf commands

Rajan p Upadhyay 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 blue-abc.rajanu.com.np• 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 rajanu.com.np –n abc

• Now the route abc. rajanu.com.np 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 rajanu.com.np –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.