(based on http://docs.cloudfoundry.org/cf-cli/)
First, build and install the CLI snap:
$ sudo snap install cf --edge
(or --beta if you want to test a more stable version)
Print the help:
$ cf
$ cf help
$ cf -h
$ cf --help
NAME:
/snap/cf/x1/bin/cli - A command line tool to interact with Cloud Foundry
USAGE:
/snap/cf/x1/bin/cli [global options] command [arguments...] [command options]
VERSION:
BUILT_FROM_SOURCE-BUILT_AT_UNKNOWN_TIME
GETTING STARTED:
[...]
Change the language:
$ cf config --locale es-ES
$ cf help
NOMBRE:
/snap/cf/x1/bin/cli - Una herramienta de línea de mandatos para interactuar con Cloud Foundry
[...]
Set the language back to English:
$ cf config --locale en-US
The following step requires an account in https://pivotal.io/ and an organization in Pivotal Web Services. They offer a free trial.
Log in:
$ cf login -a api.run.pivotal.io -u $USER_EMAIL -p $USER_PASSWORD
API endpoint: api.run.pivotal.io
Authenticating...
OK
Targeted org $ORGANIZATION
Targeted space development
API endpoint: https://api.run.pivotal.io (API version: 2.58.0)
User: $USER_EMAIL
Org: $ORGANIZATION
Space: development
List the users in an organization:
$ cf org-users $ORGANIZATION
Getting users in org $ORGANIZATION as $USER_EMAIL...
ORG MANAGER
[...]
BILLING MANAGER
[...]
ORG AUDITOR
[...]
Set an organization role:
$ cf set-org-role $USER_EMAIL $ORGANIZATION OrgManager
Assigning role OrgManager to user $USER_EMAIL in org $ORGANIZATION as $USER_EMAIL...
OK
Get a test app: (required for the next steps)
$ git clone https://github.com/cloudfoundry-samples/pong_matcher_ruby.git ~/snap/cf/$REVISION/test-app
(where $REVISION is the revision of your installed Cloudfoundry CLI snap. If during this test it was the first time you installed, thant it will be x1)
$ cd ~/snap/cf/$REVISION/test-app
Create a service: (required for the next step)
$ cf create-service rediscloud 30mb redis
Creating service instance redis in org $ORGANIZATION / space development as $USER_EMAIL...
OK
Push an app:
$ cf push $APPLICATION -b ruby_buildpack
Using manifest file /home/elopio/snap/cloudfoundry-cli/x2/test-app/manifest.yml
Updating app $APPLICATION in org $ORGANIZATION / space development as $USER_EMAIL...
OK
Uploading elopio-app...
Uploading app files from: /home/$USER/snap/cloudfoundry-cli/$REVISION/test-app
Uploading 8.7K, 12 files
Done uploading
OK
Binding service redis to app $APPLICATION in org $ORGANIZATION / space development as $USER_EMAIL...
OK
Starting app $APPLICATION in org $ORGANIZATION / space development as $USER_EMAIL...
Downloading ruby_buildpack...
[...]
App started
OK
App $APPLICATION was started using this command `ruby server.rb`
Showing health and status for app $APPLICATION in org $ORGANIZATION / space development as $USER_EMAIL...
OK
requested state: started
instances: 1/1
usage: 256M x 1 instances
urls: $APPLICATION.cfapps.io
last uploaded: Sat Aug 13 01:21:52 UTC 2016
stack: cflinuxfs2
buildpack: ruby_buildpack
state since cpu memory disk details
#0 running [...] 0.0% 15.4M of 256M 75.1M of 1G
Create a user provided service instance:
$ cf cups sql-service-instance -p "host, port, dbname, username, password"
host> mysql.example.com
port> 1433
dbname> mysqldb
username> admin
password> Pa55w0rd
Creating user provided service sql-service-instance in org $ORGANIZATIon / space development as $USER_EMAIL...
Update a service instance:
$ cf uups sql-service-instance -p '{"port":"1443"}'
Updating user provided service sql-service-instance in org $ORGANIZATION / space development as $USER_EMAIL...
OK
TIP: Use 'cf restage' for any bound apps to ensure your env variable changes take effect
List plugin repositories:
$ cf list-plugin-repos
OK
Repo Name URL
CF-Community https://plugins.cloudfoundry.org
Install a plugin:
$ cf install-plugin 'Usage Report' -r CF-Community
**Attention: Plugins are binaries written by potentially untrusted authors. Install and use plugins at your own risk.**
Do you want to install the plugin Usage Report? (y or n)> y
Looking up 'Usage Report' from repository 'CF-Community'
10027352 bytes downloaded...
Installing plugin usagereport-plugin...
OK
Plugin usage-report v1.3.1 successfully installed.
Run a plugin:
$ cf usage-report
Gathering usage information
Org $ORGANIATION is consuming 256 MB of 2048 MB.
Space development is consuming 256 MB memory (12%) of org quota.
1 apps: 1 running 0 stopped
1 instances: 1 running, 0 stopped
You are running 1 apps in 1 orgs, with a total of 1 instances.
Uninstall a plugin:
$ cf uninstall-plugin usage-report
Uninstalling plugin usage-report...
OK
Plugin usage-report successfully uninstalled.
Tested in an up-to-date xenial virtual machine with kvm.
Issues found:
(workaround passing all the arguments to the command)