-
Notifications
You must be signed in to change notification settings - Fork 824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Docker Compose support #203
Conversation
ekkis
commented
Apr 26, 2017
- added docker-compose.yml file
- included jwilder’s generator template for sharing with docker-gen
- added docker-compose.yml file - included jwilder’s generator template for sharing with docker-gen
as per https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion/issues/ 201 I had the reference to the nginx container wrong for notifications
Hi @ekkis, I tested your PR, I think there is a small bug. |
yes, you're correct. I had already fixed that (in fact, it needs |
One more note: I think that using docker compose might still be not that straight forward, since there seems to be a bug in the custom vhost management: #193 |
@giordy, that issue is using version 2 of the docker-compose. I guess the first question to ask would be whether it breaks with v3 (which I'm using) |
ok, I've made all the changes and the PR is ready to be accepted. please let me know if there's anything else I need to do |
incidentally, the PR includes the changes to the Dockerfile discussed here: #201 which make it unnecessary to download the template |
@ekkis I confirm I experienced it with version 3 of the docker compose file |
Hi @ekkis, thanks for your PR but i don't want to add files specific to the manner that the container are start (in this PR docker-compose). |
one more change: I've added name support for the real interfaces as per #200 |
@JrCs: yes, I can understand your point. someone else I was discussing this with is using saltstack to start the containers. so this really belongs as a separate project. I will create one and get back to you with it. as a matter of fact, I'll reach out to that person to perhaps do the same for saltstack |
@JrCs: I've created a separate project for the docker-compose file but realised that the changes to your Dockerfile actually belong in your project (my project won't have a container). can I modify this PR then for that functionality? it allows a user not to have any extra steps (I wasted a lot of time figuring out I was missing that stuff) |
here's the new project: https://github.com/ekkis/nginx-proxy-LE-docker-compose I've modified your README to point to this and I've reached out to the other guy about SaltStack (hopefully he'll put it together). so this PR is ready for acceptance |
incidentally, I've added a warning to my package (https://github.com/ekkis/nginx-proxy-LE-docker-compose#warning) that depending on whether this PR is approved, there may be some manual work involved for the user. I will remove that if you merge this PR |
Hmm, I realize that I added a duplicate request #208. Mine appears to be much shorter. What am I missing? |
@ekkis, thanks, this was a great lifesaver. I wanted to say that I modified your docker-compose slightly and was able to get it working without the added changes to the container: I just needed to mount the nginx.tmpl directly (well, in this case the path to the nginx.tmpl) version: "3"
services:
nginx-proxy:
image: nginx
container_name: nginx-proxy
ports:
- "80:80"
- "443:443"
volumes:
- nginx-conf:/etc/nginx/conf.d
- nginx-vhost:/etc/nginx/vhost.d
- nginx-html:/usr/share/nginx/html
- nginx-ssl:/etc/nginx/certs:ro
labels:
com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true"
networks:
- nginx-proxy
nginx-gen:
image: jwilder/docker-gen
container_name: nginx-gen
command: -notify-sighup nginx-proxy -wait 5s:30s -watch /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- nginx-conf:/etc/nginx/conf.d
- nginx-vhost:/etc/nginx/vhost.d
- nginx-html:/usr/share/nginx/html
- ./nginx:/etc/docker-gen/templates:rw
- nginx-ssl:/etc/nginx/certs:ro
links:
- nginx-proxy
networks:
- nginx-proxy
nginx-ssl:
image: jrcs/letsencrypt-nginx-proxy-companion
container_name: nginx-ssl
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- nginx-conf:/etc/nginx/conf.d
- nginx-vhost:/etc/nginx/vhost.d
- nginx-html:/usr/share/nginx/html
- ./nginx:/etc/docker-gen/templates:ro
- nginx-ssl:/etc/nginx/certs:rw
environment:
- ACME_CA_URI
- "NGINX_DOCKER_GEN_CONTAINER=nginx-gen"
links:
- nginx-proxy
- nginx-gen
networks:
- nginx-proxy
api:
restart: always
image: $IMAGE_NAME:$VERSION
restart: always
env_file:
- ./.env
- ./version.env
environment:
- API_PORT=7000
- VIRTUAL_HOST=<my-host-name>
- VIRTUAL_NETWORK=nginx-proxy
- VIRTUAL_PORT=7000
- LETSENCRYPT_HOST=<my-host-name>
- LETSENCRYPT_EMAIL=<my-email>
networks:
- nginx-proxy
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
volumes:
nginx-conf:
nginx-vhost:
nginx-html:
nginx-ssl:
networks:
nginx-proxy:
external: true Please let me know if this works for you as well. |
@Azuka, I can see that you're anchoring the volume to your file system, presumably so you can download the template and make it available to the system. that part will work automatically if @JrCs approves this PR. as for the api target, what is it? why do I need it? I don't understand what problem it solves |
@ekkis, that's my own service that needs the nginx proxy with letsencrypt. I have them as separate files, but I combined them above just as an example. |