-
-
Save Nklya/0149770e0efe1a93cee9f86978baf117 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
front: | |
image: nginx | |
container_name: nginx-proxy | |
restart: always | |
command: consul-template -consul-addr=consul:8500 -template /etc/nginx/upstream.ctmpl:/etc/nginx/upstream.conf -exec "/usr/sbin/nginx -c /etc/nginx/nginx.conf -g 'daemon off;'" | |
networks: | |
- backend | |
- frontend | |
depends_on: | |
- web | |
ports: | |
- "443:443" | |
volumes: | |
- ./config/nginx:/etc/nginx/ | |
- static:/opt/noc | |
- assets:/usr/lib/python2.7/site-packages/django |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM nginx:alpine | |
ENV CONSUL_TEMPLATE_VERSION=0.18.5 | |
RUN apk add --update curl unzip ca-certificates \ | |
&& curl -Ls https://releases.hashicorp.com/consul-template/${CONSUL_TEMPLATE_VERSION}/consul-template_${CONSUL_TEMPLATE_VERSION}_linux_amd64.zip -o consul-template.zip \ | |
&& unzip consul-template.zip -d /bin \ | |
&& rm -f consul-template* \ | |
&& apk del curl unzip \ | |
&& rm -rf /var/cache/apk/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
include upstream.conf; | |
..... | |
server { | |
listen 443; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream grafana { | |
{{range service "grafana"}}server {{.Address}}:{{.Port}} weight={{keyOrDefault (printf "noc/nginx/%s/grafana/weight" .Node) "1"}} max_fails=3 fail_timeout=10; | |
{{else}}server 127.0.0.1:65535; # check consul for grafana service{{end}} | |
} | |
upstream notebook { | |
{{range service "notebook"}}server {{.Address}}:{{.Port}} max_fails=3 fail_timeout=10; | |
{{else}}server 127.0.0.1:65535; # check consul for notebook service{{end}} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment