Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 22 additions & 20 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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"
7 changes: 5 additions & 2 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions nginx/reload-nginx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}

Expand All @@ -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"
}

Expand Down