Skip to content
Snippets Groups Projects
Verified Commit f192e433 authored by David Beniamine's avatar David Beniamine
Browse files

Kill maintenance mode after timeout

parent 8c33c101
No related branches found
No related tags found
No related merge requests found
# TIMEOUT in minutes after which the service will automatically stop, 90 minutes if not set
TIMEOUT=
# Hosts to put down ex `dev.tetras-lab.io`,`reporting.tetras-lab.io` # Hosts to put down ex `dev.tetras-lab.io`,`reporting.tetras-lab.io`
HOSTS= HOSTS=
# Hosts to put down ex `127.0.0.1`,`109.190.86.26` # Hosts to put down ex `127.0.0.1`,`109.190.86.26`
......
...@@ -2,7 +2,7 @@ version: '3' ...@@ -2,7 +2,7 @@ version: '3'
services: services:
maintenance: maintenance:
image: nginx build: docker
volumes: volumes:
- "./www:/usr/share/nginx/html:ro" - "./www:/usr/share/nginx/html:ro"
- "./nginx.conf:/etc/nginx/nginx.conf:ro" - "./nginx.conf:/etc/nginx/nginx.conf:ro"
...@@ -16,6 +16,8 @@ services: ...@@ -16,6 +16,8 @@ services:
- "traefik.http.routers.maintenance.entrypoints=web,websecure" - "traefik.http.routers.maintenance.entrypoints=web,websecure"
- "traefik.http.routers.maintenance.middlewares=hardening@docker" - "traefik.http.routers.maintenance.middlewares=hardening@docker"
- "traefik.http.routers.maintenance.priority=99999" - "traefik.http.routers.maintenance.priority=99999"
environment:
TIMEOUT:
networks: networks:
traefik: traefik:
......
FROM nginx:latest
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT '/entrypoint.sh'
#!/bin/bash
if [ -z "$TIMEOUT" ]; then
TIMEOUT=90
fi
/docker-entrypoint.sh $@ &
while [[ $TIMEOUT -gt 0 ]]; do
echo "Maintenance system is up, timeout in $TIMEOUT minutes"
sleep 60
TIMEOUT=$(($TIMEOUT - 1))
done
exit
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment