From c033eb0e4dd5924472528d6245cf1720d59aacfb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toni=20C=C3=A1rdenas?= Date: Tue, 5 May 2015 13:22:39 +0200 Subject: [PATCH] Add host variable to environment. --- core/dockerfile.go | 1 + core/types.go | 1 + documentation/configuration.md | 3 ++- documentation/creating_your_dockerfiles.md | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/dockerfile.go b/core/dockerfile.go index f52a08a..e60ab96 100644 --- a/core/dockerfile.go +++ b/core/dockerfile.go @@ -40,6 +40,7 @@ func (d *Dockerfile) resolveInfoVariables(result []byte) []byte { "ENV": d.environment.Name, "VCS": string(d.project.Repository), "REV": d.revision.GetShort(), + "HOST": d.environment.Host, } for name, value := range vars { diff --git a/core/types.go b/core/types.go index 4b1949b..6dd7eac 100644 --- a/core/types.go +++ b/core/types.go @@ -209,6 +209,7 @@ type Environment struct { CertPath string `json:"-"` EtcdServers []string `gcfg:"EtcdServer"` Name string + Host string `gcfg:"Host"` } func (e *Environment) String() string { diff --git a/documentation/configuration.md b/documentation/configuration.md index 7846e8a..58a3e1e 100644 --- a/documentation/configuration.md +++ b/documentation/configuration.md @@ -56,11 +56,12 @@ An environment is a logical group of any number of Docker servers. Dockership su * `DockerEndPoint` (mandatory, multiple): [Docker Remote API](https://docs.docker.com/reference/api/docker_remote_api/) address, if dockership and Docker are running in the same host you can use `unix:///var/run/docker.sock` if not you should enable remote access at the docker daemon (with -H parameter) and use a TCP endpoint. (eg.: `tcp://172.17.42.1:4243`) +* `Host` (optional): The hostname that the machine will be exposed at. Reachable thorugh the `DOCKERSHIP_HOST` variable in Dockerfiles. + * `CertPath` (optional): If you are running Docker with TLS support you must provide the path to your keys files, just like the [DOCKER_CERT_PATH](https://docs.docker.com/articles/https/) looks. * `EtcdServer` (multiple, optional): if none is configured the `Global.EtcdServer` will be used - ### Project `Project` section defines the configuration for every project to be deployed in the environments. The relation between repositories is one-to-one, so the repository should contain the `Dockerfile` and all the files needed to build the Docker image. The Project as Environment is defined as a section with subsection: `[Project "disruptive-app"]` diff --git a/documentation/creating_your_dockerfiles.md b/documentation/creating_your_dockerfiles.md index b4c6b86..b8905a1 100644 --- a/documentation/creating_your_dockerfiles.md +++ b/documentation/creating_your_dockerfiles.md @@ -21,6 +21,7 @@ This kind of variables are sourced from the internal process of Dockerfile given * `$DOCKERSHIP_VCS`: Repository URLs, the `Repository` variable from the project. * `$DOCKERSHIP_REV`: Revision identifier * `$DOCKERSHIP_ENV`: Environment name where the Dockerfile is being deployed. +* `$DOCKERSHIP_HOST`: Hostname of the environment. ### etcd support