Sign inSign up

apox0/drcon

By apox0

•Updated almost 11 years ago

Use drcon aside with Consul and Register, you can easily refer any service by name like pdq.

Image
1

360

apox0/drcon repository overview

Modified from: http://www.maori.geek.nz/scalable_architecture_dr_con_docker_registrator_consul_nginx/⁠

Dockerfile

FROM nginx:1.7

#Install Curl RUN apt-get update -qq && apt-get -y install curl

#Download and Install Consul Template ENV CT_URL http://bit.ly/15uhv24⁠
RUN curl -L $CT_URL | \
tar -C /usr/local/bin --strip-components 1 -zxf -

#Setup Consul Template Files RUN mkdir /etc/consul-templates
ENV CT_FILE /etc/consul-templates/nginx.conf

#Setup Nginx File ENV NX_FILE /etc/nginx/conf.d/app.conf

#Default Variables ENV CONSUL consul:8500
ENV SERVICE consul-8500

#Command will #Write Consul Template File #Start Nginx #Start Consul Template

CMD echo "upstream app { \n\
least_conn; \n
{{range service "$SERVICE"}} \n
server {{.Address}}:{{.Port}}; \n
{{else}}server 127.0.0.1:65535;{{end}} \n
} \n
server { \n\
listen 80 default_server; \n
location / { \n
proxy_pass http://app⁠; \n
} \n
}" > $CT_FILE;
/usr/sbin/nginx -c /etc/nginx/nginx.conf
& CONSUL_TEMPLATE_LOG=debug consul-template
-consul=$CONSUL
-template "$CT_FILE:$NX_FILE:/usr/sbin/nginx -s reload";

⁠

dd uild -t drcon . dd ps -l dd commit ID(from dd ps -l) apox0/drcon dd push apox0/drcon

dd run -it -e "CONSUL=192.168.0.71:8500" -e "SERVICE=pdq" -p 192.168.0.71:port:80 apox0/drcon dd run --rm --name 9001 -h 9001 -e "SERVICE_NAME=pdq" -p 192.168.0.71:9001:80 apox0/hello while true; do curl $DOCKER_IP:80; sleep 1; done

Tag summary

Content type

Image

Digest

sha256:79f6a81b3…

Size

53.8 MB

Last updated

almost 11 years ago

docker pull apox0/drcon