go_service_broker

command module
v0.0.0-...-6d1d515 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

README

go_service_broker

This is a service broker written in Go Language for Cloud Foundry. This service broker supports creating VMs on AWS or SoftLayer. Since VMs take some to spin up creating them is done asynchronously.

This broker also supports creating service keys. This is a new feature added to the Service Broker v2.6 APIs. In this broker we implement service keys by creating SSH keys and adding them to the VM.

Finally, this broker also supports arbitrary service parameters. For AWS this is done by allowing the user to pass the ami-id to use when spinning up the VM. And for SoftLayer you can specify the Virtual Guest Device Block Device Template Group ID.

NOTE that for AWS, in this implementation, service bind operation will generate a keypair and inject the public key into that EC2 instance and return the corresponding credentials including private key, user name and public IP address information which can be used to ssh login that EC2 instance. The service unbind operation will revoke that public key from the EC2 instance.

Presentations

This sample project has been presented in CF Summit 2015:

Videos for each of the main features of the brokers are in these Youtube videos:

The following blog post on IBM's OpenTech web site covers the broker in much details:

Getting Started

Get Latest Executable: go_service_broker

Assuming you have a valid Golang 1.4.2 or later installed for your system, you can quickly build and get the latest go_service_broker executable by running the following go command:

$ go get github.com/cloudfoundry-samples/go_service_broker

This will build and place the go_service_broker executable built for your operating system in your $GOPATH/bin directory.

Building From Source

Clone this repo and build it. Using the following commands on a Linux or Mac OS X system:

$ mkdir -p go_service_broker/src/github.com/cloudfoundry-samples
$ export GOPATH=$(pwd)/go_service_broker:$GOPATH
$ cd go_service_broker/src/github.com/cloudfoundry-samples
$ git clone https://github.com/cloudfoundry-samples/go_service_broker.git
$ cd go_service_broker
$ godep restore
$ ./bin/build

NOTE: you may need to install godep on your system, if you have not already. You can with this one line command: $ go get github.com/tools/godep

NOTE2: if you get any dependency errors, then use go get path/to/dependency to get it, e.g., go get github.com/onsi/ginkgo and go get github.com/onsi/gomega

The executable output should now be located in: out/go_service_broker. Place it wherever you want, e.g., /usr/local/bin on Linux or Mac OS X.

Dependencies

Install godep.

$ go get github.com/tools/godep

Download and install packages with dependencies by using godep.

$ cd -
$ godep get ./...

Save the dependencies by godep.

$ godep save ./...

Build your executable out/go_service_broker.

$ bin/build

Configuring for AWS

Before running the service broker, you need to configure your AWS account's credentials. If you do not have AWS account, then you can get one for free here.

As a best practice, we recommend creating an IAM user that has access keys rather than relying on root access keys. You can login into your AWS account to create a new user 'service_broker' with the option to generate an access key for this user.

Once you get a Access Key ID and Secret Access Key, copy and save it into ~/.aws/credentials file, which might look like:

[default]
aws_access_key_id = YOUR-AWS-ACCESS-KEY-ID
aws_secret_access_key = YOUR-AWS-SECRET-ACCESS-KEY

Configuring for SoftLayer

For SoftLayer the configuration requires you to supply your SL user name and API key. If you do not have an SL account, please get one for free here. The API key can be requested once you login to your account.

You need to setup two environment variables with your SL credentials as follows.

$ export SL_USERNAME=your-softlayer-username@your-company.com
$ export SL_API_KEY=YOUR-SOFTLAYER-API-KEY

These two environment variables must exist where you run your broker. Locally, in a VM or server process, or whithin CloudFoundry. See below on details on how to run broker in CF or locally.

Running Broker

The broker can be ran in one of two modes: locally or as an app in a CF environment.

Locally

Run the executable to start the service broker which will listening on port 8001 by default.

$ out/go_service_broker --cloud AWS

This will run the broker in AWS mode. You can also specify SoftLayer mode with:

$ out/go_service_broker --cloud SoftLayer

If no argument is passed to the --cloud flag then AWS mode is assumed/

In CF

When running the broker in a CF environment (including BOSH lite). You simply need to:

$ git clone https://github.com/cloudfoundry-samples/go_service_broker.git
$ cd go_service_broker
$ cf push

You, of course, need to have the CF CLI installed into your system. Also, you can edit the Procfile if you want to specify a different mode (AWS or SoftLayer) as well as any additional optional parameters to the CF Golang buildpacks.

Using Broker

TODO

License

This is under Apache 2.0 OSS license.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Godeps
_workspace/src/code.google.com/p/go.crypto/ssh
Package ssh implements an SSH client and server.
Package ssh implements an SSH client and server.
_workspace/src/code.google.com/p/go.crypto/ssh/agent
Package agent implements a client to an ssh-agent daemon.
Package agent implements a client to an ssh-agent daemon.
_workspace/src/code.google.com/p/go.crypto/ssh/terminal
Package terminal provides support functions for dealing with terminals, as commonly found on UNIX systems.
Package terminal provides support functions for dealing with terminals, as commonly found on UNIX systems.
_workspace/src/code.google.com/p/go.crypto/ssh/test
This package contains integration tests for the code.google.com/p/go.crypto/ssh package.
This package contains integration tests for the code.google.com/p/go.crypto/ssh package.
_workspace/src/github.com/aws/aws-sdk-go/aws
Package aws provides core functionality for making requests to AWS services.
Package aws provides core functionality for making requests to AWS services.
_workspace/src/github.com/aws/aws-sdk-go/aws/awserr
Package awserr represents API error interface accessors for the SDK.
Package awserr represents API error interface accessors for the SDK.
_workspace/src/github.com/aws/aws-sdk-go/aws/credentials
Package credentials provides credential retrieval and management The Credentials is the primary method of getting access to and managing credentials Values.
Package credentials provides credential retrieval and management The Credentials is the primary method of getting access to and managing credentials Values.
_workspace/src/github.com/aws/aws-sdk-go/aws/credentials/stscreds
Package stscreds are credential Providers to retrieve STS AWS credentials.
Package stscreds are credential Providers to retrieve STS AWS credentials.
_workspace/src/github.com/aws/aws-sdk-go/internal/endpoints
Package endpoints validates regional endpoints for services.
Package endpoints validates regional endpoints for services.
_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/ec2query
Package ec2query provides serialisation of AWS EC2 requests and responses.
Package ec2query provides serialisation of AWS EC2 requests and responses.
_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/rest
Package rest provides RESTful serialization of AWS requests and responses.
Package rest provides RESTful serialization of AWS requests and responses.
_workspace/src/github.com/aws/aws-sdk-go/internal/protocol/xml/xmlutil
Package xmlutil provides XML serialisation of AWS requests and responses.
Package xmlutil provides XML serialisation of AWS requests and responses.
_workspace/src/github.com/aws/aws-sdk-go/internal/signer/v4
Package v4 implements signing for AWS V4 signer
Package v4 implements signing for AWS V4 signer
_workspace/src/github.com/aws/aws-sdk-go/service/ec2
Package ec2 provides a client for Amazon Elastic Compute Cloud.
Package ec2 provides a client for Amazon Elastic Compute Cloud.
_workspace/src/github.com/aws/aws-sdk-go/service/ec2/ec2iface
Package ec2iface provides an interface for the Amazon Elastic Compute Cloud.
Package ec2iface provides an interface for the Amazon Elastic Compute Cloud.
_workspace/src/github.com/gorilla/context
Package context stores values shared during a request lifetime.
Package context stores values shared during a request lifetime.
_workspace/src/github.com/gorilla/mux
Package gorilla/mux implements a request router and dispatcher.
Package gorilla/mux implements a request router and dispatcher.
_workspace/src/github.com/vaughan0/go-ini
Package ini provides functions for parsing INI configuration files.
Package ini provides functions for parsing INI configuration files.

Jump to

Keyboard shortcuts

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