buchdag / letsencrypt-nginx-proxy-companion-compose Goto Github PK
View Code? Open in Web Editor NEWExample compose files for letsencrypt-nginx-proxy-companion
License: MIT License
Example compose files for letsencrypt-nginx-proxy-companion
License: MIT License
I saw this thread ranting about how it is a bad idea:
https://news.ycombinator.com/item?id=17983623
What is your latest recommendation for using a letsencrypt/nginx companion for a bunch of services in a docker-compose.yaml? The "two container" compose file is about a year older than the 3 container one... What's the latest recommended way?
Thanks!
Hello Buchdag,
I hope you can help me with this problem. I am using the "three containers/compose-v3/labels"-setup you provided. It is a great setup, thanks to you!
It works fine with other kinds of projects, but when i tried to run Pi-hole behind it, Pi-hole crashed with the following output, even though I'am using the DEFAULT_HOST environment variable:
Removing pihole
Recreating d09f715ad0ee_pihole ...
Recreating d09f715ad0ee_pihole ... error
ERROR: for d09f715ad0ee_pihole Cannot start service pihole: driver failed programming external connectivity on endpoint pihole (f99813b9aca1b4dce45dfc05fc7c52ca6685ea7e0d981e2d557786e3e258a529): Bind for 0.0.0.0:443 failed: port is already allocated
ERROR: for pihole Cannot start service pihole: driver failed programming external connectivity on endpoint pihole (f99813b9aca1b4dce45dfc05fc7c52ca6685ea7e0d981e2d557786e3e258a529): Bind for 0.0.0.0:443 failed: port is already allocated
ERROR: Encountered errors while bringing up the project.
After trying many different ways of fixing this error, my last attempt was to use the basic/standard "jwilder/nginx-proxy" and et voilà it worked... :(
So I think I am missing somthing little, but I can't find it.
My ReverseProxy (based on your example) looks like this:
version: '3'
services:
reverseproxy-nginx:
image: nginx
container_name: reverseproxy-nginx
ports:
- "80:80"
- "443:443"
volumes:
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- certs:/etc/nginx/certs:ro
labels:
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy"
environment:
- TZ=Europe/Berlin
restart: always
reverseproxy-dockergen:
image: jwilder/docker-gen
command: -notify-sighup reverseproxy-nginx -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
container_name: reverseproxy-dockergen
depends_on:
- reverseproxy-nginx
volumes:
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- certs:/etc/nginx/certs:ro
- ./nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro
- /var/run/docker.sock:/tmp/docker.sock:ro
labels:
- "com.github.jrcs.letsencrypt_nginx_proxy_companion.docker_gen"
environment:
- TZ=Europe/Berlin
- DEFAULT_HOST=pihole.myadress.com
restart: always
reverseproxy-letsencrypt-companion:
image: jrcs/letsencrypt-nginx-proxy-companion:latest
container_name: reverseproxy-letsencrypt-companion
depends_on:
- reverseproxy-nginx
- reverseproxy-dockergen
volumes:
- vhost:/etc/nginx/vhost.d
- html:/usr/share/nginx/html
- certs:/etc/nginx/certs
- /var/run/docker.sock:/var/run/docker.sock:ro
environment:
- TZ=Europe/Berlin
restart: always
volumes:
conf:
vhost:
html:
certs:
networks:
default:
external:
name: nginx-reverseproxy
My Pi-hole docker-compose.yml looks like this:
version: '3'
# https://github.com/pi-hole/docker-pi-hole/blob/master/README.md
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
# For DHCP it is recommended to remove these ports and instead add: network_mode: "host"
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp"
- "80:80/tcp"
- "443:443/tcp"
environment:
- TZ=Europe/Berlin
- WEBPASSWORD=ReallySecurePasswordForPiHole
- ServerIP=10.10.10.50
- VIRTUAL_HOST=pihole.myadress.com
- VIRTUAL_PORT=80
- LETSENCRYPT_HOST=pihole.myadress.com
- [email protected]
# Volumes store your data between container upgrades
volumes:
- './etc-pihole/:/etc/pihole/'
- './etc-dnsmasq.d/:/etc/dnsmasq.d/'
# run `touch ./var-log/pihole.log` first unless you like errors
# - './var-log/pihole.log:/var/log/pihole.log'
dns:
- 127.0.0.1
- 1.1.1.1
# Recommended but not required (DHCP needs NET_ADMIN)
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
#cap_add:
# - NET_ADMIN
restart: always
networks:
default:
external:
name: nginx-reverseproxy
I would appreciate any hint and/or help.
Thanks in advance!
Hello,
I would host multiple sites.
I used it. (3-containers / compose-v3 / labels)
I want to put my domain.conf file under the vhost.d directory. How can I do it.
I read these. https://github.com/jwilder/nginx-proxy#per-virtual_host
I didn't get a result.
Dear @buchdag,
i would like to come back to our discussion here:
buchdag/multiarch-letsencrypt-nginx-proxy#7 (comment)
I had no time till now thatswhy the late response.
I created now a script which i would like to place as well in the lets encrypt container and execute before the renewal start (to open the port forwarding) and again after the renewal was successfully (to close the port forwarding).
The only thing what i would like to know, is in which file/script and line exactly would you suggest to place in your scripts these explained execution command to run my script?
Thanks and Greetings
Daniel
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.