Go to file
joeduffy d91b04d8f4 Support config maps
This change adds support for configuration maps.

This is a new feature that permits initialization code to come from markup,
after compilation, but before evaluation.  There is nothing special with this
code as it could have been authored by a user.  But it offers a convenient
way to specialize configuration settings per target husk, without needing
to write code to specialize each of those husks (which is needlessly complex).

For example, let's say we want to have two husks, one in AWS's us-west-1
region, and the other in us-east-2.  From the same source package, we can
just create two husks, let's say "prod-west" and "prod-east":

    prod-west.json:
    {
        "husk": "prod-west",
        "config": {
            "aws:config:region": "us-west-1"
        }
    }

    prod-east.json:
    {
        "husk": "prod-east",
        "config": {
            "aws:config:region": "us-east-2"
        }
    }

Now when we evaluate these packages, they will automatically poke the
right configuration variables in the AWS package *before* actually
evaluating the CocoJS package contents.  As a result, the static variable
"region" in the "aws:config" package will have the desired value.

This is obviously fairly general purpose, but will allow us to experiment
with different schemes and patterns.  Also, I need to whip up support
for secrets, but that is a task for another day (perhaps tomorrow).
2017-02-27 19:43:54 -08:00
cmd Support config maps 2017-02-27 19:43:54 -08:00
docs Delete the architecture PNG 2017-02-25 07:40:26 -08:00
examples Add basic targeting capability 2017-02-25 09:24:52 -08:00
lib Add AWS configuration variables 2017-02-27 16:52:06 -08:00
pkg Support config maps 2017-02-27 19:43:54 -08:00
sdk Coconut! 2017-02-25 07:25:33 -08:00
tools/cocojs Add comment about adding cocojs to $PATH 2017-02-26 12:14:49 -08:00
.gitignore Check in a missing test file 2017-02-01 19:41:13 -08:00
.gitmodules Fix an errant Git module 2017-02-25 10:35:51 -08:00
glide.lock Generate Golang Protobuf/gRPC code 2017-02-10 09:08:06 -08:00
glide.yaml Coconut! 2017-02-25 07:25:33 -08:00
main.go Coconut! 2017-02-25 07:25:33 -08:00
Makefile Coconut! 2017-02-25 07:25:33 -08:00
README.md Fix a broken link 2017-02-25 10:57:07 -08:00

Coconut

Coconut is a framework and toolset for creating reusable stacks of services.

If you are learning about Coconut for the first time, please see the overview document.

Installing

To install Coconut from source, simply run:

$ go get -u github.com/pulumi/coconut

A GOPATH must be set. A good default value is ~/go. In fact, this is the default in Go 1.8.

It is common to alias the shorter command coco to the full binary coconut:

alias coco=coconut

At this moment, libraries must be manually installed. See below. Eventually we will have an installer.

Compilers

The Coconut compilers are independent from the core Coconut tools.

Please see the respective pages for details on how to install, build, and test each compiler:

Development

This section is for Coconut developers.

Prerequisites

Coconut is written in Go and uses Glide for dependency management. They must be installed:

If you wish to use the optional lint make target, you'll also need to install Golint:

$ go get -u github.com/golang/lint/golint

Building and Testing

To build Coconut, ensure $GOPATH is set, and clone into a standard Go workspace:

$ git clone git@github.com:pulumi/coconut $GOPATH/src/github.com/pulumi/coconut

At this point you should be able to build and run tests from the root directory:

$ cd $GOPATH/src/github.com/pulumi/coconut
$ glide update
$ make

This installs the coconut binary into $GOPATH/bin, which may now be run provided make exited successfully.

Installing the Runtime Libraries

By default, Coconut looks for its runtime libraries underneath /usr/local/coconut. $COCOPATH overrides this. Please refer to the libraries README for details on additional installation requirements.

Debugging

The Coconut tools have extensive logging built in. In fact, we encourage liberal logging in new code, and addding new logging when debugging problems. This helps to ensure future debugging endeavors benefit from your sleuthing.

All logging is done using Google's Glog library. It is relatively barebones, and adds basic leveled logging, stack dumping, and other capabilities beyond what Go's built-in logging routines offer.

The Coconut command line has two flags that control this logging and that can come in handy when debugging problems. The --logtostderr flag spews directly to stderr, rather than the default of logging to files in your temp directory. And the --verbose=n flag (-v=n for short) sets the logging level to n. Anything greater than 3 is reserved for debug-level logging, greater than 5 is going to be quite verbose, and anything beyond 7 is extremely noisy.

For example, the command

$ coco eval --logtostderr -v=5

is a pretty standard starting point during debugging that will show a fairly comprehensive trace log of a compilation.