Skip to content

Commit

Permalink
Merge pull request #147 from matlockx/master
Browse files Browse the repository at this point in the history
new consul version 0.7.0
  • Loading branch information
josegonzalez committed Jan 25, 2017
2 parents dca4414 + d787f76 commit 032b3e1
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 1 deletion.
6 changes: 6 additions & 0 deletions 0.7/consul-agent/Dockerfile
@@ -0,0 +1,6 @@
FROM gliderlabs/consul:0.7
ADD ./config /config/
EXPOSE 8300 8301 8301/udp 8302 8302/udp 8400 8500 8600 8600/udp
ENV DNS_RESOLVES consul
ENV DNS_PORT 8600
ENTRYPOINT ["/bin/consul", "agent", "-config-dir=/config"]
3 changes: 3 additions & 0 deletions 0.7/consul-agent/Makefile
@@ -0,0 +1,3 @@

build:
docker build -t gliderlabs/consul-agent:$(VERSION) .
9 changes: 9 additions & 0 deletions 0.7/consul-agent/config/agent.json
@@ -0,0 +1,9 @@
{
"client_addr": "0.0.0.0",
"data_dir": "/data",
"leave_on_terminate": true,
"dns_config": {
"allow_stale": true,
"max_stale": "1s"
}
}
3 changes: 3 additions & 0 deletions 0.7/consul-server/Dockerfile
@@ -0,0 +1,3 @@
FROM gliderlabs/consul-agent:0.7
ADD ./config /config/
ENTRYPOINT ["/bin/consul", "agent", "-server", "-config-dir=/config"]
3 changes: 3 additions & 0 deletions 0.7/consul-server/Makefile
@@ -0,0 +1,3 @@

build:
docker build -t gliderlabs/consul-server:$(VERSION) .
6 changes: 6 additions & 0 deletions 0.7/consul-server/config/server.json
@@ -0,0 +1,6 @@
{
"ui": true,
"dns_config": {
"allow_stale": false
}
}
15 changes: 15 additions & 0 deletions 0.7/consul/Dockerfile
@@ -0,0 +1,15 @@
FROM alpine:3.4

ENV CONSUL_VERSION 0.7.0
ENV CONSUL_SHA256 b350591af10d7d23514ebaa0565638539900cdb3aaa048f077217c4c46653dd8

RUN apk --no-cache add curl ca-certificates \
&& curl -sSL https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip -o /tmp/consul.zip \
&& echo "${CONSUL_SHA256} /tmp/consul.zip" > /tmp/consul.sha256 \
&& sha256sum -c /tmp/consul.sha256 \
&& cd /bin \
&& unzip /tmp/consul.zip \
&& chmod +x /bin/consul \
&& rm /tmp/consul.zip

ENTRYPOINT ["/bin/consul"]
3 changes: 3 additions & 0 deletions 0.7/consul/Makefile
@@ -0,0 +1,3 @@

build:
docker build -t gliderlabs/consul:$(VERSION) .
40 changes: 40 additions & 0 deletions 0.7/consul/update_version.sh
@@ -0,0 +1,40 @@
#!/bin/bash

set -eo pipefail
[[ "$TRACE" ]] && set -x || :

debug() {
[[ "$DEBUG" ]] && echo "-----> $*" 1>&2
}

consul_version() {
sed -n "s/ENV CONSUL_VERSION //p" Dockerfile
}

next_version() {
debug "new version will be calculated ..."
local oldVersion=$(consul_version)
debug "oldVersion: $oldVersion"
echo ${oldVersion%.*}.$((${oldVersion##*.} + 1))
}

update_dockerfile() {
declare ver=${1:? required}

local sha=$(curl -Ls https://releases.hashicorp.com/consul/${ver}/consul_${ver}_SHA256SUMS | sed -n "s/ .*linux_amd64.*//p")
debug "sha=$sha"

sed -i "s/\(ENV CONSUL_VERSION\) .*/\1 $newVersion/;s/\(ENV CONSUL_SHA256\) .*/\1 $sha/" Dockerfile
}

main() {
declare desc="Updates Dockerfile url/sha for the provided version, or calculates next patch version if called without params"
declare newVersion=${1:-$(next_version)}

debug "newVersion=$newVersion"
update_dockerfile $newVersion
git diff
echo "=====> Now you can run: git commit -am 'Upgrade Consul to $newVersion'"
}

[[ "$0" == "$BASH_SOURCE" ]] && main "$@" || :
2 changes: 1 addition & 1 deletion Makefile
@@ -1,4 +1,4 @@
VERSION=0.6
VERSION=0.7

build:
VERSION=$(VERSION) make -C $(VERSION)/consul
Expand Down

0 comments on commit 032b3e1

Please sign in to comment.