4. Backgroundより※
Project to rewrite the Cloud Foundry CLI tool
using Go. This project should currently be
considered alpha quality software and
should not be used in production
environments. If you need something more
stable, please check out the RubyGem.
※https://github.com/cloudfoundry/cli
7. とりあえずubuntuでGOを
apt-getインストール
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.2 LTS
Release:
12.04
Codename:
precise
$ sudo apt-get install golang-go
$ go version
go version go1
12. Anyninesにtargetを向ける
$ ./go-cf target https://api.de.a9s.eu/
FAILED
Incorrect Usage.
NAME:
target - Set or view the targeted org or space
ALIAS:
t
USAGE:
cf target [-o ORG] [-s SPACE]
OPTIONS:
-o ''
organization
-s ''
space
13. apiコマンドでtargetを向ける
./go-cf api http://api.de.a9s.eu
Setting api endpoint to http://api.de.a9s.eu...
FAILED
Invalid JSON response from server: json:
cannot unmarshal number into Go value of
type string
14. v2のall-in-oneに変更
$ ./go-cf api http://api.192.168.12.129.xip.io
Setting api endpoint to
http://api.192.168.12.129.xip.io...
OK
Warning: Insecure http API endpoint detected:
secure https API endpoints are recommended
API endpoint: http://api.192.168.12.129.xip.io (API
version: 2.0.0)
Not logged in. Use 'cf login' to log in.
16. apps
$ ./go-cf apps
Getting apps in org system_domain and space
develop as admin...
OK
name state instances memory disk urls
sinatra started 1/1
256M 1G
17. scale
$ ./go-cf scale sinatra -i 2
Scaling app sinatra...
Stopping sinatra...
OK
Starting sinatra...
OK
0 of 2 instances running (2 starting)
Started
18. app
$ ./go-cf app sinatra
Showing health and status for app sinatra...
OK
state: started
instances: 2/2
usage: 256M x 2 instances
urls:
status since
cpu memory
disk
#0 running 2013-10-22 07:31:29 PM 0.0% 17.8M of 256M 53.4M of 1G
#1 running 2013-10-22 07:31:29 PM 0.0% 17.9M of 256M 53.4M of 1G
20. 再度push
go-cf push sinatra -d hogehoge.com
Uploading sinatra...
OK
Stopping sinatra...
OK
Starting sinatra...
OK
........................
0 of 1 instances running (1 starting)
Started
23. v0.0.1.alpha時のヘルプ
COMMANDS:
target, t
Set or view the target
login, l
Log user in
set-env, se
Set an environment variable for an application
logout, lo
Log user out
push, p
Push an application
apps, a
List all applications in the currently selected space
delete, d
Delete an application
start, s
Start applications
stop, st
Stop applications
create-service, cs Create service instance
bind-service, bs Bind a service instance to an application
unbind-service, us Unbind a service instance from an application
delete-service, ds Delete a service instance
routes, r
List all routes
services, sv
List all services in the currently selected space
help, h
25. 【参考】コマンド一覧(1/8)
$ ./go-cf -h
NAME:
cf - A command line tool to interact with Cloud Foundry
USAGE:
[environment variables] cf [global options] command [arguments...] [command options]
VERSION:
1.0.0.rc1-a79e769418
COMMANDS:
help
api
app
apps, a
auth
Show help
Set or view target api url
Display health and status for app
List all apps in the target space
Authenticate user non-interactively
26. 【参考】コマンド一覧(2/8)
bind-service, bs
Bind a service instance to an app
buildpacks
List all buildpacks
create-buildpack
Create a buildpack
create-org, co
Create an org
create-service, cs
Create a service instance
create-service-auth-token
Create a service auth token
create-service-broker
Create a service broker
create-space
Create a space
create-user
Create a new user
create-user-provided-service, cups Make a user-provided service available to cf apps
delete, d
Delete an app
delete-buildpack
Delete a buildpack
delete-domain
Delete a domain
delete-org
Delete an org
delete-route
Delete a route
delete-service, ds
Delete a service instance
27. 【参考】コマンド一覧(3/8)
delete-service-auth-token
Delete a service auth token
delete-service-broker
delete-space
delete-user
domains
env, e
events
files, f
Print out a list of files in a directory or the contents of a specific file
login, l
Log user in
logout, lo
logs
Delete a service broker
Delete a space
Delete a user
List domains in the target org
Show all env variables for an app
Show recent app events
Log user out
Tail or show recent logs for an app
28. 【参考】コマンド一覧(4/8)
marketplace, m
map-domain
map-route
org
org-users
orgs, o
passwd, pw
push, p
Push a new app or sync changes to an existing app
quotas
List available usage quotas
rename
List available offerings in the marketplace
Map a domain to a space
Add a url route to an app
Show org info
Show org users by role
List all orgs
Change user password
Rename an app
30. 【参考】コマンド一覧(6/8)
service
Show service instance info
service-auth-tokens
service-brokers
services, s
List all services in the target space
set-env, se
Set an env variable for an app
set-org-role
Assign an org role to a user
set-quota
Define the quota for an org
set-space-role
Assign a space role to a user
share-domain
Share a domain with all orgs
List service auth tokens
List service brokers
31. 【参考】コマンド一覧(7/8)
space
Show target space's info
space-users
spaces
List all spaces in an org
stacks
List all stacks
start, st
Start an app
stop, sp
Stop an app
target, t
Set or view the targeted org or space
unbind-service, us
unmap-domain
unmap-route
unset-env
unset-org-role
unset-space-role
Show space users by role
Unbind a service instance from an app
Unmap a domain from a space
Remove a url route from an app
Remove an env variable
Remove an org role from a user
Remove a space role from a user