From df19004ecd7b756bc23da28974e2c44cd5211b02 Mon Sep 17 00:00:00 2001 From: Dante Briones Date: Wed, 19 Jul 2017 15:25:42 -0700 Subject: [PATCH 1/3] Update Consul to 0.19.0 to fix incorrect DNS resolution --- nginx/Dockerfile | 4 ++-- nginx/reload-nginx.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nginx/Dockerfile b/nginx/Dockerfile index bea8fa0..ce99901 100644 --- a/nginx/Dockerfile +++ b/nginx/Dockerfile @@ -6,8 +6,8 @@ RUN apk update && \ rm -rf /var/cache/apk/* # 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_0.19.0_linux_amd64.zip https://releases.hashicorp.com/consul-template/0.19.0/consul-template_0.19.0_linux_amd64.zip && \ + unzip /tmp/consul_template_0.19.0_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" } From 4e4c168b5e6b56dd28480866db5b1644a4db7bd6 Mon Sep 17 00:00:00 2001 From: Dante Briones Date: Wed, 19 Jul 2017 15:31:04 -0700 Subject: [PATCH 2/3] Extract Consul version to an environment var --- nginx/Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/nginx/Dockerfile b/nginx/Dockerfile index ce99901..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.19.0_linux_amd64.zip https://releases.hashicorp.com/consul-template/0.19.0/consul-template_0.19.0_linux_amd64.zip && \ - unzip /tmp/consul_template_0.19.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 From 72ea91932829c1afcc3f7fcd0fc5bffcc121de18 Mon Sep 17 00:00:00 2001 From: Dante Briones Date: Wed, 19 Jul 2017 15:31:34 -0700 Subject: [PATCH 3/3] Include @satvidh's fix from https://github.com/autopilotpattern/hello-world/pull/23 --- docker-compose.yml | 42 ++++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 20 deletions(-) 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