Skip to content
This repository was archived by the owner on Jun 9, 2024. It is now read-only.

Commit 908219f

Browse files
committed
init
0 parents  commit 908219f

File tree

6 files changed

+737
-0
lines changed

6 files changed

+737
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
certs/
2+
templates/

LICENSE

Lines changed: 675 additions & 0 deletions
Large diffs are not rendered by default.

README.markdown

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# `docker-nginx-gen-letsencrypt`
2+
3+
This is an opinionated improvisation to get a self-encrypting load balancer in front of Docker containers.
4+
5+
* Run with `./run`
6+
* Debug with `docker-compose ps` or `docker-compose logs`
7+
* Remove with `docker-compose stop` and `docker-compose rm`
8+
9+
## License
10+
11+
Licensed by [almereyda](https://almereyda.de/) under the GNU General Public License 3.0. See the LICENSE for its terms.

docker-compose.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
version: '2'
2+
services:
3+
nginx:
4+
image: nginx
5+
container_name: nginx
6+
volumes:
7+
- /etc/nginx/conf.d
8+
- /etc/nginx/vhost.d
9+
- /usr/share/nginx/html
10+
- /srv/nginx/certs:/etc/nginx/certs:ro
11+
ports:
12+
- "80:80"
13+
- "443:443"
14+
restart: always
15+
16+
nginx-gen:
17+
image: jwilder/docker-gen
18+
container_name: nginx-gen
19+
command: "-notify-sighup nginx -watch -only-exposed -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf"
20+
volumes_from: [nginx]
21+
volumes:
22+
- /srv/nginx/templates/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro
23+
- /var/run/docker.sock:/tmp/docker.sock:ro
24+
restart: always
25+
26+
nginx-letsencrypt:
27+
image: jrcs/letsencrypt-nginx-proxy-companion
28+
container_name: nginx-letsencrypt
29+
depends_on: [nginx-gen]
30+
volumes_from: [nginx]
31+
volumes:
32+
- /srv/nginx/certs:/etc/nginx/certs:rw
33+
- /var/run/docker.sock:/var/run/docker.sock:ro
34+
environment:
35+
- NGINX_DOCKER_GEN_CONTAINER=nginx-gen
36+
restart: always

get_default_template

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env bash
2+
if [ ! -f /srv/nginx/templates/nginx.tmpl ]; then
3+
wget https://raw.githubusercontent.com/jwilder/nginx-proxy/master/nginx.tmpl -O /srv/nginx/templates/nginx.tmpl
4+
fi

run

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
if [ ! -d /srv/nginx/certs || ! -d /srv/nginx/templates ]; then
3+
cd /srv
4+
mkdir -p nginx/certs
5+
mkdir -p nginx/templates
6+
fi
7+
cd /srv/nginx
8+
./get_default_template
9+
docker-compose up -d

0 commit comments

Comments
 (0)