Skip to content

Added docker-compose for letsencrypt #1

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

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
41 changes: 41 additions & 0 deletions docker-compose-letsencrypt-ssl.yml
Original file line number Diff line number Diff line change
@@ -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: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"

# 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: nginx-proxy-bridge-network

41 changes: 41 additions & 0 deletions docker-compose-nginx-letencrypt-app-example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
version: "2"

services:
web:
image: 'app-image'
restart: always
environment:
- TERM=xterm
- [email protected]
- 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