-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tweak: Switched to docker-compose v3 syntax
Tweak: Now using latest versions of docker-gen and companion Tweak: Now using nginx image with mozilla's boilerplate config Add: Readme
- Loading branch information
Showing
7 changed files
with
222 additions
and
240 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Pixelcloud nginx-proxy | ||
|
||
This docker-based service uses [nginx-proxy](https://github.com/jwilder/nginx-proxy), [docker-gen](https://github.com/jwilder/docker-gen) and [docker-letsencrypt-nginx-proxy-companion](https://github.com/JrCs/docker-letsencrypt-nginx-proxy-companion). | ||
|
||
## Description | ||
|
||
Based on nginx-proxy, this service uses nginx (modified with config inspired from mozilla's boilerplate) and monitors other docker services having ``VIRTUAL_HOST`` environment variable to automatically proxy them. | ||
|
||
Moreover, if said services also have ``LETSENCRYPT_HOST`` variable, it will automatically generate a Let's Encrypt SSL certificate, provided the requirements are met. | ||
|
||
## Usage | ||
|
||
### Environment Variables | ||
|
||
|
||
#### Ports | ||
|
||
You should create a ``.env`` file, located in nginx-proxy's directory root and declare the necessary variables needed in ``docker-compose.yml`` | ||
|
||
Production example: | ||
|
||
``` | ||
HTTP_PORT=80 | ||
HTTPS_PORT=443 | ||
``` | ||
|
||
Development example: | ||
|
||
``` | ||
HTTP_PORT=8080:80 | ||
HTTPS_PORT=8443:443 | ||
``` | ||
|
||
#### no-www | ||
|
||
If the variable ``WWW`` is set to ``no-www`` inside your proxied service, nginx-proxy will automatically create a www.domain.com to domain.com redirection. You should add www.domain.com to ``LETSENCRYPT_HOST`` variable to get an SSL certificate as well. | ||
|
||
#### ACME CA | ||
|
||
By default, this spin of nginx-proxy ships with the staging version of Let's Encrypt service enabled. | ||
|
||
To switch to production certificates, remove or comment this line in ``docker-compose.yml`` | ||
|
||
``` | ||
ACME_CA_URI: https://acme-staging.api.letsencrypt.org/directory | ||
``` |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,54 +1,69 @@ | ||
version: "2" | ||
version: '3' | ||
|
||
services: | ||
nginx: | ||
image: pixelfordinner/nginx | ||
container_name: pixelcloud-nginx_proxy-nginx | ||
nginx-web: | ||
image: pixelfordinner/nginx:test | ||
labels: | ||
com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy: "true" | ||
container_name: app-pixelcloud-nginx_proxy-nginx | ||
restart: unless-stopped | ||
ports: | ||
- "80:80" | ||
- "443:443" | ||
- '${HTTP_PORT}' | ||
- '${HTTPS_PORT}' | ||
volumes: | ||
- "./volumes/conf.d:/etc/nginx/conf.d:ro" | ||
- "./volumes/vhost.d:/etc/nginx/vhost.d:ro" | ||
- "./volumes/certs:/etc/nginx/certs:ro" | ||
- "/usr/share/nginx/html" | ||
- ./volumes/nginx/conf.d:/etc/nginx/conf.d:ro | ||
- ./volumes/nginx/vhost.d:/etc/nginx/vhost.d:ro | ||
- ./volumes/nginx/certs:/etc/nginx/certs:ro | ||
- ./volumes/nginx/htpasswd:/etc/nginx/htpasswd:ro | ||
- ./volumes/nginx/html:/usr/share/nginx/html:ro | ||
networks: | ||
- proxy-tier | ||
docker-gen: | ||
image: jwilder/docker-gen:0.7.3 | ||
container_name: pixelcloud-nginx_proxy-docker_gen | ||
logging: | ||
options: | ||
max-size: '4m' | ||
max-file: '10' | ||
|
||
nginx-gen: | ||
image: jwilder/docker-gen | ||
command: -notify-sighup app-pixelcloud-nginx_proxy-nginx -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf | ||
container_name: app-pixelcloud-nginx_proxy-nginx_gen | ||
restart: unless-stopped | ||
depends_on: | ||
- nginx | ||
volumes_from: | ||
- nginx | ||
volumes: | ||
- "/var/run/docker.sock:/tmp/docker.sock:ro" | ||
- "./data/templates:/etc/docker-gen/templates:ro" | ||
- "./volumes/conf.d:/etc/nginx/conf.d:rw" | ||
- ./volumes/nginx/conf.d:/etc/nginx/conf.d | ||
- ./volumes/nginx/vhost.d:/etc/nginx/vhost.d | ||
- ./volumes/nginx/certs:/etc/nginx/certs:ro | ||
- ./volumes/nginx/htpasswd:/etc/nginx/htpasswd:ro | ||
- /var/run/docker.sock:/tmp/docker.sock:ro | ||
- ./volumes/docker-gen/templates/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro | ||
networks: | ||
- proxy-tier | ||
entrypoint: /usr/local/bin/docker-gen -notify-sighup pixelcloud-nginx_proxy-nginx -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf | ||
lets-encrypt-companion: | ||
image: jrcs/letsencrypt-nginx-proxy-companion:v1.6 | ||
container_name: pixelcloud-nginx_proxy-lets_encrypt | ||
logging: | ||
options: | ||
max-size: '4m' | ||
max-file: '10' | ||
|
||
nginx-letsencrypt: | ||
image: jrcs/letsencrypt-nginx-proxy-companion | ||
container_name: app-pixelcloud-nginx_proxy-letsencrypt | ||
restart: unless-stopped | ||
depends_on: | ||
- nginx | ||
- docker-gen | ||
volumes_from: | ||
- nginx | ||
volumes: | ||
- "/var/run/docker.sock:/var/run/docker.sock:ro" | ||
- "./volumes/vhost.d:/etc/nginx/vhost.d:rw" | ||
- "./volumes/certs:/etc/nginx/certs:rw" | ||
- ./volumes/nginx/conf.d:/etc/nginx/conf.d | ||
- ./volumes/nginx/vhost.d:/etc/nginx/vhost.d | ||
- ./volumes/nginx/html:/usr/share/nginx/html | ||
- ./volumes/nginx/certs:/etc/nginx/certs:rw | ||
- /var/run/docker.sock:/var/run/docker.sock:ro | ||
environment: | ||
- "NGINX_DOCKER_GEN_CONTAINER=pixelcloud-nginx_proxy-docker_gen" | ||
# - "ACME_CA_URI=https://acme-staging.api.letsencrypt.org/directory" | ||
# - "DEBUG=true" | ||
NGINX_DOCKER_GEN_CONTAINER: app-pixelcloud-nginx_proxy-nginx_gen | ||
NGINX_PROXY_CONTAINER: app-pixelcloud-nginx_proxy-nginx | ||
ACME_CA_URI: https://acme-staging.api.letsencrypt.org/directory | ||
networks: | ||
- proxy-tier | ||
logging: | ||
options: | ||
max-size: '4m' | ||
max-file: '10' | ||
|
||
networks: | ||
proxy-tier: | ||
external: | ||
name: "nginx-proxy" | ||
name: nginx-proxy |
Oops, something went wrong.