Pivotal/Cloud Foundry/CLI
Cloud Foundry | Cloud Foundry CLI
Contents |
Installing CF CLI
Mac OSX (High Sierra)
First start by installing homebrew package manager
~$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Tap the Cloud Foundry repo and install CF CLI
~$ brew tap cloudfoundry/tap ~$ brew install cf-cli
For good measure you should install git if you have not.
~$ brew install git
Installing Maven
In case you need to install Maven. Download the latest binary copy: http://mirrors.ocf.berkeley.edu/apache/maven/maven-3/3.5.3/binaries/ such as apache-maven-3.5.3-bin.tar.gz
unpack it.
~$ tar -xvf apache-maven-3.5.3-bin.tar.gz
Quick Reference CF CLI
cf-login
Sign into PWS (Pivotal Web Services).
Man file
~$ cf login -u username -o org -s space -a api.run.pivotal.io
To logout it is as simple as
~$ cf logout
cf config
Set configuration variables such as language, timeouts, color, etc.
Man file | Localize
~$ $ cf config --locale YOUR_LANGUAGE Language Examples: English (US): en-US German: de-DE Spanish: es-ES
cf apps
Show all apps in your authenticated instance with their state and some details.
~$ cf apps
cf app
Show expanded details on an app
~$ cf app <app_name>
cf restart
restart an app
~$ cf restart <app_name>
cf restage
Recreate the app's executable artifact using the latest pushed app files and the latest environment (variables, service bindings, buildpack, stack, etc.)
~$ cf restage <app_name>
cf services
list all service instances
~$ cf services
cf logs
Show logs from an app either as a snapshot or live stream
Snapshot: ~$ cf logs <app_name> --recent Stream: ~$ cf logs <app_name>
cf-marketplace
View available elephantsql plans.
~$ cf marketplace -s elephantsql
cf create-service
create a new service, such as a elephantsql instance
~$ cf create-service elephantsql turtle <db_name>
cf bind-service
bind the service to the app
~$ cf bind-service <app_name> <service_name>
cf scale
scale the number of instances to improve app performance such as user load and concurrent requests.
~$ cf scale <app-name> -i <number of instances> ~$ cf scale <app-name> -m 1G <or other memory size> ~$ cf scale <app-name> -k 512M <or other disk size>
cf env
shows the current environment variables for the app
~$ cf env <app-name>