Skip to content

Commit

Permalink
update to reflect true final state
Browse files Browse the repository at this point in the history
  • Loading branch information
4141done committed Oct 4, 2023
1 parent 56aa89e commit fe0fdc6
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,30 @@ services:
networks:
- mm_2023

consul-server:
image: hashicorp/consul:1.14.4
container_name: consul-server
restart: always
volumes:
- ./consul/server.json:/consul/config/server.json:ro
ports:
- "8500:8500"
- "8600:8600/tcp"
- "8600:8600/udp"
command: "agent"
networks:
- mm_2023

consul-client:
image: hashicorp/consul:1.14.4
container_name: consul-client
restart: always
volumes:
- ./consul/client.json:/consul/config/client.json:ro
command: "agent"
networks:
- mm_2023

volumes:
rabbit-data:
rabbit-log:
Expand Down
16 changes: 16 additions & 0 deletions load_balancer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FROM nginx:1.23
ARG CONSUL_TEMPLATE_VERSION=0.30.0
# we define an environment variable with the location of our Consul cluster. By default, it will try to resolve to
# consul-client:8500 which would be the behavior if we have Consul running as a container in the same host and we link it to this
# Nginx container (with the alias consul, of course). But this environment variable can also be overridden when we run the
# container if we want to point somewhere else.
ENV CONSUL_URL consul-client:8500

# download the latest version of Consul Template and we put it on /usr/local/bin
ADD https://releases.hashicorp.com/consul-template/${CONSUL_TEMPLATE_VERSION}/consul-template_${CONSUL_TEMPLATE_VERSION}_linux_amd64.zip /usr/bin/
RUN unzip /usr/bin/consul-template_${CONSUL_TEMPLATE_VERSION}_linux_amd64.zip && \
mv consul-template /usr/local/bin/consul-template && \
rm -rf /usr/bin/consul-template_${CONSUL_TEMPLATE_VERSION}_linux_amd64.zip


COPY nginx.conf /etc/nginx/nginx.conf
41 changes: 41 additions & 0 deletions load_balancer/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@

#user nobody;
worker_processes 1;

events {
worker_connections 1024;
}

http {
default_type application/json;

keepalive_timeout 65;

server {
listen 80;

location / {
proxy_pass http://localhost:8080;
}

location /health {
access_log off;
add_header 'Content-Type' 'text/plain';
return 200 "OK";
}
}

server {
listen 8080;

location / {
return 200 "Hello, world";
}

location /health {
access_log off;
add_header 'Content-Type' 'text/plain';
return 200 "OK";
}
}
}

0 comments on commit fe0fdc6

Please sign in to comment.