garden

module
v0.0.0-...-0351ae2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2014 License: Apache-2.0

README

                                                 ,-.
                                                  ) \
                                              .--'   |
                                             /       /
                                             |_______|
                                            (  O   O  )
                                             {'-(_)-'}
                                           .-{   ^   }-.
                                          /   '.___.'   \
                                         /  |    o    |  \
                                         |__|    o    |__|
                                         (((\_________/)))
                                             \___|___/
                                        jgs.--' | | '--.
                                           \__._| |_.__/

Warden in Go, because why not.

REST API

Garden provides a Google protocol buffer interface which is also surfaced as a REST API.

For example, if Garden Linux is deployed to localhost and configured to listen on port 7777, the following commands may be used to kick its tyres:

# list containers (should be empty)
curl http://127.0.0.1:7777/containers

# create a container
curl -H "Content-Type: application/json" \
  -XPOST http://127.0.0.1:7777/containers \
  -d '{"rootfs":"docker:///busybox"}'

# list containers (should list the handle returned above)
curl http://127.0.0.1:7777/containers

# spawn a process
#
# curl will choke here as the protocol is hijacked, but...it probably worked.
curl -H "Content-Type: application/json" \
  -XPOST http://127.0.0.1:7777/containers/${handle}/processes \
  -d '{"path":"sleep","args":["10"]}'

Testing

Pre-requisites

  • git (for garden and its dependencies on github)
  • mercurial (for some dependencies not on github)

Make a directory to contain go code:

$ mkdir ~/go

From now on, we assume this directory is in /root/go.

Install Go 1.2.1 or later. For example, install gvm and issue:

$ gvm install go1.2.1
$ gvm use go1.2.1

Extend $GOPATH and $PATH:

$ export GOPATH=/root/go:$GOPATH
$ export PATH=$PATH:/root/go/bin

Install godep (used to manage garden's dependencies):

$ go get github.com/kr/godep

Get garden and its dependencies:

$ go get github.com/cloudfoundry-incubator/garden

and in this directory, re-build the protocol (if you've changed it) see below.

Install ginkgo (used to test garden):

$ go install github.com/onsi/ginkgo/ginkgo

Run the tests (skipping performance measurements):

$ ginkgo -r

Building the protocol

Pre-requisite

  • protoc; download the archive, unpack it into a directory with no spaces in the full path; and build according to INSTALL.txt.

To build the protocol:

$ go get code.google.com/p/gogoprotobuf/{proto,protoc-gen-gogo,gogoproto}
$ make protocol

Directories

Path Synopsis
api
fakes
This file was generated by counterfeiter
This file was generated by counterfeiter
connection/fakes
This file was generated by counterfeiter
This file was generated by counterfeiter
Package garden is a generated protocol buffer package.
Package garden is a generated protocol buffer package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL