diff --git a/docker-compose.yml b/docker-compose.yml index 954fa82..a52b5d2 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,20 +1,22 @@ -nginx: - build: nginx/ - ports: - - "80:80" - links: - - consul:consul - restart: always -hello: - build: hello/ - links: - - consul:consul -world: - build: world/ - links: - - consul:consul -consul: - image: consul:latest - restart: always - ports: - - "8500:8500" +version: "3" +services: + nginx: + build: nginx/ + ports: + - "80:80" + links: + - consul:consul + restart: always + hello: + build: hello/ + links: + - consul:consul + world: + build: world/ + links: + - consul:consul + consul: + image: consul:latest + restart: always + ports: + - "8500:8500" \ No newline at end of file diff --git a/nginx/Dockerfile b/nginx/Dockerfile index bea8fa0..93b0f4e 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -5,9 +5,12 @@ RUN apk update && \ apk add nginx curl unzip && \ rm -rf /var/cache/apk/* +ENV CONSUL_VERSION=0.19.0 + # Use consul-template to re-write our Nginx virtualhost config -RUN curl -Lo /tmp/consul_template_0.15.0_linux_amd64.zip https://releases.hashicorp.com/consul-template/0.15.0/consul-template_0.15.0_linux_amd64.zip && \ - unzip /tmp/consul_template_0.15.0_linux_amd64.zip && \ +RUN curl -Lo /tmp/consul_template_${CONSUL_VERSION}_linux_amd64.zip \ + https://releases.hashicorp.com/consul-template/${CONSUL_VERSION}/consul-template_${CONSUL_VERSION}_linux_amd64.zip && \ + unzip /tmp/consul_template_${CONSUL_VERSION}_linux_amd64.zip && \ mv consul-template /bin # Install ContainerPilot diff --git a/nginx/reload-nginx.sh b/nginx/reload-nginx.sh index 1e91d76..8b25c31 100755 --- a/nginx/reload-nginx.sh +++ b/nginx/reload-nginx.sh @@ -5,7 +5,7 @@ preStart() { consul-template \ -once \ - -consul consul:8500 \ + -consul-addr consul:8500 \ -template "/etc/containerpilot/nginx.conf.ctmpl:/etc/nginx/nginx.conf" } @@ -14,7 +14,7 @@ preStart() { onChange() { consul-template \ -once \ - -consul consul:8500 \ + -consul-addr consul:8500 \ -template "/etc/containerpilot/nginx.conf.ctmpl:/etc/nginx/nginx.conf:nginx -s reload" }