How to login to CF using cli : cf login -a <https://api.address> -u <username> -p <password>
cf login -a <https://api.address> -u <username> -p <password> --skip-ssl-validation
For switching between space and organization :
cf target -s <space-name>
cf target -o <organization-name>
To review current target configuration : cf target
How to push an application to cf
cf push <app name> --random-route --no-start -m <memory allocation> -i <number of instances>
i
instances--no-start
can be added when app should just be packaged and not started. This is especially usefull when app is required to be bound to services for it to work properly. This way a restage or restart of app is not required-p <path to jar>
can be added to push a specific jar as appcf start <app name>
How to view events : cf events <appname>
For Tailing logs : cf logs <app name>
--recent
for most recent logsFor getting all detailed configuration of apps deployed in cf space and org
cf curl "v2/apps"
cf curl "v2/apps/<app metadata.guid>/stats
For detailed stats of the appFor scaling application : cf scale <appname> -m <memory allocation> -i <integer - number of instances>
For creating new service from Marketplace:
cf marketplace
cf create-service <marketplace place service name> <plan> <user service name>
cf bind-service <appaname> <user service name>
cf restart <appname>
Converting the app into user provided service : cf create-user-provided-service <service name/app name> -p <uri>
Manifest can be used to define the bound services, memory, instances, package path location etc
cf create-app-manifest <app name> -p <file name >
For creating log drain service, we need the log drain url of service being used, like splunk, papertrail or any logging service
cf create-user-provided-service <log drain service name> -l syslog://<log drain url>
Blue-Green Deployments
cf routes
cf push <name v2> -p <package path> -m<memory> -n<subdomain different than current prod> --no-start
cf map-route <name v2> <domain> -n <subdomain prod one>
cf unmap-route <name v1> <domaine> -n <subdomain>
PCF NOTE
Metrics : http://docs.pivotal.io/pcf-metrics/1-3/using.html```
*To provide particular buildpack during push*
cf push <appname> -p <package location> -b <buildpack location>
*For setting JRE version*
cf set-env <appname> JBP_CONFIG_OPEN_JDK_JRE "<jre: < version: 1.8.0_45 >>"
We need to restage app after this change
cf restage <appname>
*For pushing service broker*
cf push <app name> ...
cf set-env <app name> SERVICE_ID <unique id>
cf set-env <app name> SERVICE_NAME <unique Name>
cf set-env <app name> PLAN_ID <plan name>
Start app
Register the service broker
cf create-service-broker <unique broker name> <username> <passowrd> <url> --space-scoper
*******************************************************************
```Cloud Metrics
cf list-plugin-repos
--> to List the available plugins - CF-Community should come up
to install cf TOP plugin - powerful tool for health monitoring.
cf install-plugin -r CF-Community "top"
This plugin can run any cli command for all apps deployed in the particular targetted space.
To install : cf install-plugin do-all -r "CF-Community"
To run : cf do-all COMMAND ARGS (example : cf do-all restage <> - where <> signifies all applications in targetted space)
The best monitoring plugin out there. Shows an interactive view to monitor complete health of Cloud Foundry orgs,space,apps and routes
To install : cf install-plugin -r CF-Community "top"
To run : cf top