From b15c10d38f048587b3c586a79f59863687e9fe6b Mon Sep 17 00:00:00 2001 From: mrunal4 Date: Wed, 31 Jan 2018 19:47:15 +0530 Subject: [PATCH 1/4] 'docker-compose-letsencrypt-ssl.yml' - Added letsencrypt containers with nginx proxy. 'docker-compose-nginx-letencrypt-app-example.yml' - Also added example showing how to add your application file look like. --- docker-compose-letsencrypt-ssl.yml | 41 +++++++++++++++++++ ...r-compose-nginx-letencrypt-app-example.yml | 41 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 docker-compose-letsencrypt-ssl.yml create mode 100644 docker-compose-nginx-letencrypt-app-example.yml diff --git a/docker-compose-letsencrypt-ssl.yml b/docker-compose-letsencrypt-ssl.yml new file mode 100644 index 000000000..a94c28803 --- /dev/null +++ b/docker-compose-letsencrypt-ssl.yml @@ -0,0 +1,41 @@ +version: '2' +services: + nginx-proxy: + image: jwilder/nginx-proxy + container_name: nginx-proxy + ports: + - "80:80" + - "443:443" + volumes: + - /home/core/data/nginx-proxy/certs:/etc/nginx/certs:ro + - /home/core/data/nginx-proxy/vhost.d:/etc/nginx/vhost.d + - /etc/nginx/vhost.d + - /usr/share/nginx/html + - /home/core/data/nginx-proxy/html:/usr/share/nginx/html + - /var/run/docker.sock:/tmp/docker.sock:ro + labels: + - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true" + +# in case of any issues comment "/home/core/data/nginx-proxy/vhost.d:/etc/nginx/vhost.d" and "/home/core/data/nginx-proxy/html:/usr/share/nginx/html" from above volumes block + + + letsencrypt-nginx-proxy-companion: + image: jrcs/letsencrypt-nginx-proxy-companion + container_name: letsencrypt-nginx-proxy-companion + volumes: + - /home/core/data/nginx-proxy/certs:/etc/nginx/certs:rw + - /var/run/docker.sock:/var/run/docker.sock:ro + volumes_from: + - nginx-proxy + + +# whoami: +# image: jwilder/whoami +# environment: +# - VIRTUAL_HOST=whoami.local + +networks: + default: + external: + name: assessments-bridge-network + diff --git a/docker-compose-nginx-letencrypt-app-example.yml b/docker-compose-nginx-letencrypt-app-example.yml new file mode 100644 index 000000000..a5b30d40f --- /dev/null +++ b/docker-compose-nginx-letencrypt-app-example.yml @@ -0,0 +1,41 @@ +version: "2" + +services: + web: + image: 'app-image' + restart: always + environment: + - TERM=xterm + - LETSENCRYPT_EMAIL=admin@example.com + - LETSENCRYPT_HOST=example.com + - VIRTUAL_HOST=example.com + - VIRTUAL_PROTO=https + - VIRTUAL_PORT=8080 + hostname: 'example.com' + expose: + - "8080" + build: . + volumes: + - /data/nginx-proxy/certs/:/etc/ssl/example.com + - /data/qbank-lite/webapps:/qbank/webapps + - .:/qbank + command: > + /bin/bash -c 'python myapp.py' + ports: + - "8010:8080" + links: + - mongo:mongodb + depends_on: + - mongo + mongo: + image: 'mongo:latest' + restart: always + environment: + - ALLOW_EMPTY_PASSWORD=yes + volumes: + - /data/myapp/db:/data/db + +networks: + default: + external: + name: example-bridge-network From 853461004d32dc6e78a5dbe66245d64405cae554 Mon Sep 17 00:00:00 2001 From: mrunal4 Date: Wed, 7 Mar 2018 00:12:04 +0530 Subject: [PATCH 2/4] commented 2 duplicate entries /etc/nginx/vhost.d and /usr/share/nginx/html --- docker-compose-letsencrypt-ssl.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docker-compose-letsencrypt-ssl.yml b/docker-compose-letsencrypt-ssl.yml index a94c28803..164c41a0a 100644 --- a/docker-compose-letsencrypt-ssl.yml +++ b/docker-compose-letsencrypt-ssl.yml @@ -8,10 +8,10 @@ services: - "443:443" volumes: - /home/core/data/nginx-proxy/certs:/etc/nginx/certs:ro - - /home/core/data/nginx-proxy/vhost.d:/etc/nginx/vhost.d - - /etc/nginx/vhost.d - - /usr/share/nginx/html - - /home/core/data/nginx-proxy/html:/usr/share/nginx/html + - /home/core/data/nginx-proxy/vhost.d:/etc/nginx/vhost.d:rw +# - /etc/nginx/vhost.d +# - /usr/share/nginx/html + - /home/core/data/nginx-proxy/html:/usr/share/nginx/html:rw - /var/run/docker.sock:/tmp/docker.sock:ro labels: - "com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true" From 8c926ee83b0e3aa40986269ecd31cf4d8ec2bb61 Mon Sep 17 00:00:00 2001 From: mrunal4 Date: Wed, 7 Mar 2018 00:25:25 +0530 Subject: [PATCH 3/4] Updated README.md for letsencrypt related instructions Added following in README.md #### docker-compose for nginx-proxy and letsencrypt - use "docker-compose-letsencrypt-ssl.yml" to run nginx-proxy and letsencrypt containers - refer "docker-compose-nginx-letencrypt-app-example.yml" to configure necessary variables --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index 53e8d5d03..bc34087cd 100644 --- a/README.md +++ b/README.md @@ -273,6 +273,11 @@ If you are using multiple hostnames for a single container (e.g. `VIRTUAL_HOST=e If you want most of your virtual hosts to use a default single `location` block configuration and then override on a few specific ones, add those settings to the `/etc/nginx/vhost.d/default_location` file. This file will be used on any virtual host which does not have a `/etc/nginx/vhost.d/{VIRTUAL_HOST}` file associated with it. +#### docker-compose for nginx-proxy and letsencrypt + +- use "docker-compose-letsencrypt-ssl.yml" to run nginx-proxy and letsencrypt containers +- refer "docker-compose-nginx-letencrypt-app-example.yml" to configure necessary variables + ### Contributing Before submitting pull requests or issues, please check github to make sure an existing issue or pull request is not already open. From 816e5cb2a828041cbb4674b478e702b8500f1b97 Mon Sep 17 00:00:00 2001 From: mrunal4 Date: Wed, 7 Mar 2018 00:29:42 +0530 Subject: [PATCH 4/4] docker-compose-letsencrypt-ssl.yml - changed network name (nginx-proxy-bridge-network) --- docker-compose-letsencrypt-ssl.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker-compose-letsencrypt-ssl.yml b/docker-compose-letsencrypt-ssl.yml index 164c41a0a..1c80b9e51 100644 --- a/docker-compose-letsencrypt-ssl.yml +++ b/docker-compose-letsencrypt-ssl.yml @@ -37,5 +37,5 @@ services: networks: default: external: - name: assessments-bridge-network + name: nginx-proxy-bridge-network