all: Bump Go to 1.4

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
Merge pull request #586 from flynn/go1.4

all: Bump to Go 1.4
Godeps: Bump Go subrepos to latest git versions

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
Godeps: Bump Docker for security fixes

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
Merge pull request #588 from flynn/bump-godeps

Bump Docker packages
host: combined the AddJob and SetInternalIP functions, since they both cause persistence for the host state to be fired and are presently never used in isolation anyway.

Signed-off-by: Eric Myhre <eric@flynn.io>
host: Transforming host state persistence to use boltdb for persistence instead of flat files.

Components:
 - Only initialize persistence db filehandle once.
 - Move persistence path to host state setup time, and ensure it has a default when starting the host executable.  (This is mostly clarifying behavior because previously persistence would do some rather odd things if restore hadn't previously been called.)
 - Bring go-check into the host state tests, because these tests are touching the filesystem and crave tmpdirs.
 - Change filenames for host state.  (Attempting to open one of the old json files will cause boltdb to report an error; this makes that migration forgetful, but survivable.  And json is no longer an accurate description.)
 - When persisting host state changes, limit the serialization and disk changes to the job that is being changed.
 - Remove stateFileMtx from host state.  Use of boltdb has its own internal locking mechanisms which obviate the need for this mutex.
 - Place persistence back into the same control flow as the state changes that trigger it, so persistence is complete by the time the mutation returns.  (This is more feasible than before since the amount of changes flushed to disk by ever persist call is now limited in scope, and doing so makes testing and other behavior less complicated.)
 - Split the interface backends use to declare their persistence needs into two parts, one for per-job state and one for global state.  Neither is necessary.
 - Libvirt backend actually has no use for global state, so since that interface is now separate, we'll drop it.

Signed-off-by: Eric Myhre <eric@flynn.io>
host: During host backend revivification, dispatch container connection attempts in bulk, and gather them later.  This prevents their timeouts from occurring serially, which could cause host service launch to time out in the case of many dead containers.

Signed-off-by: Eric Myhre <eric@flynn.io>
Merge pull request #581 from flynn/host-state-database

Host state database
all: Update etcd to v0.5.0-alpha.4

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
all: Use IANA-assigned ports for etcd

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
appliance/etcd: Add CA certificates to container image

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
host: Update configuration file format

Configuration files are now JSON describing the arguments and
environment variables to add when running the daemon.

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
host: Fix panic converting error in log

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
host: Add expose_env field to service manifest

Environment variables listed in this field are copied from the daemon
environment into the job.

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
host: Configure etcd clustering via environment variables directly

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
pkg: Add etcdcluster package

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
host/cli: Add init command for configuring the cluster

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
host: Default to 1-node etcd configuration if none is specified

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>
host: Lookup default external IP

Signed-off-by: Jonathan Rudenberg <jonathan@titanous.com>