various fixes - autoconf process order, multisite config and examples

This commit is contained in:
bunkerity 2020-12-30 16:22:10 +01:00
parent 0026328f25
commit dc382c3e04
No known key found for this signature in database
GPG Key ID: 654FFF51CEF7CC47
6 changed files with 24 additions and 5 deletions

View File

@ -72,11 +72,20 @@ try :
except docker.errors.APIError as e :
utils.log("[!] Docker API error " + str(e))
sys.exit(3)
# Process instances first
for instance in before :
if "bunkerized-nginx.AUTOCONF" in instance.labels :
if instance.status in ("restarting", "running", "created", "exited") :
process(instance, "create")
if instance.status == "running" :
process(instance, "start")
# Containers after
for container in before :
if container.status in ("restarting", "running", "created", "exited") :
process(container, "create")
if container.status == "running" :
process(container, "start")
if "bunkerized-nginx.SERVER_NAME" in container.labels :
if container.status in ("restarting", "running", "created", "exited") :
process(container, "create")
if container.status == "running" :
process(container, "start")
# Process events received from Docker
try :

View File

@ -14,6 +14,9 @@ find /etc/nginx -type d -exec chmod 750 {} \;
if [ "$MULTISITE" = "yes" ] ; then
servers=$(find /etc/nginx -name "server.conf" | cut -d '/' -f 4)
for server in $servers ; do
if [ "$server" = "server.conf" ] ; then
continue
fi
SERVER_PREFIX="/etc/nginx/${server}/"
if grep "/etc/letsencrypt/live" ${SERVER_PREFIX}https.conf > /dev/null && [ ! -f /etc/letsencrypt/live/${server}/fullchain.pem ] ; then
/opt/scripts/certbot-new.sh "$server" "$(cat ${SERVER_PREFIX}email-lets-encrypt.txt)"

View File

@ -30,6 +30,8 @@ services:
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- autoconf:/etc/nginx
depends_on:
- mywww
myapp1:
image: php:fpm

View File

@ -21,6 +21,8 @@ services:
- USE_GZIP=yes
- USE_BROTLI=yes
- USE_REVERSE_PROXY=yes
labels:
- "bunkerized-nginx.AUTOCONF"
myautoconf:
image: bunkerity/bunkerized-nginx-autoconf
@ -28,6 +30,8 @@ services:
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- autoconf:/etc/nginx
depends_on:
- mywww
myapp1:
build: js-app

View File

@ -3,7 +3,7 @@ version: '3'
services:
myreverse:
image: bunkerity/bunkerized-nginx:dev
image: bunkerity/bunkerized-nginx
restart: always
ports:
- 80:8080

View File

@ -2,6 +2,7 @@
bantime = %FAIL2BAN_BANTIME%
findtime = %FAIL2BAN_FINDTIME%
maxretry = %FAIL2BAN_MAXRETRY%
ignoreip = %FAIL2BAN_IGNOREIP%
enabled = true
action = nginx-action
logpath = /var/log/access.log