lb and health check
This commit is contained in:
parent
2c108f7584
commit
6ae9ad20fc
|
@ -1 +1,3 @@
|
||||||
/data/certbot
|
/data/certbot
|
||||||
|
*.log
|
||||||
|
old
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
upstream kameronkenny_com {
|
||||||
|
server 10.99.22.51:4000;
|
||||||
|
server 10.99.22.52:4000;
|
||||||
|
server 10.99.22.53:4000;
|
||||||
|
}
|
||||||
|
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
server_name kameronkenny.com www.kameronkenny.com blog.kameronkenny.com photos-test.kameronkenny.com;
|
server_name kameronkenny.com www.kameronkenny.com blog.kameronkenny.com photos-test.kameronkenny.com;
|
||||||
|
@ -23,7 +29,7 @@ server {
|
||||||
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
||||||
|
|
||||||
location / {
|
location / {
|
||||||
proxy_pass http://10.99.22.51:4000;
|
proxy_pass http://kameronkenny_com;
|
||||||
proxy_set_header Host $http_host;
|
proxy_set_header Host $http_host;
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
proxy_set_header X-Real-IP $remote_addr;
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
|
|
@ -7,6 +7,10 @@ volumes:
|
||||||
certbot_www:
|
certbot_www:
|
||||||
driver: local
|
driver: local
|
||||||
|
|
||||||
|
networks:
|
||||||
|
pub_lb_net:
|
||||||
|
external: true
|
||||||
|
|
||||||
services:
|
services:
|
||||||
nginx:
|
nginx:
|
||||||
image: nginx:1.15-alpine
|
image: nginx:1.15-alpine
|
||||||
|
@ -15,10 +19,10 @@ services:
|
||||||
- ./data/nginx:/etc/nginx/conf.d
|
- ./data/nginx:/etc/nginx/conf.d
|
||||||
- ./data/certbot/conf:/etc/letsencrypt
|
- ./data/certbot/conf:/etc/letsencrypt
|
||||||
- ./data/certbot/www:/var/www/certbot
|
- ./data/certbot/www:/var/www/certbot
|
||||||
ports:
|
|
||||||
- "80:80"
|
|
||||||
- "443:443"
|
|
||||||
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
|
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
|
||||||
|
networks:
|
||||||
|
pub_lb_net:
|
||||||
|
ipv4_address: 10.99.81.241
|
||||||
certbot:
|
certbot:
|
||||||
image: certbot/certbot
|
image: certbot/certbot
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
TIMEOUT=2
|
||||||
|
|
||||||
|
function no_good {
|
||||||
|
cd /home/kkenny/src/docker/nginx-certbot
|
||||||
|
echo "[$(date)] $1 has failed, restarting." >> health.log
|
||||||
|
docker compose down >> health.log 2>&1
|
||||||
|
docker compose up -d >> health.log 2>&1
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
curl -s --connect-timeout $TIMEOUT https://kameronkenny.com >/dev/null 2>&1 || no_good "kameronkenny.com"
|
||||||
|
curl -s --connect-timeout $TIMEOUT https://thelinux.pro >/dev/null 2>&1 || no_good "thelinux.pro"
|
Loading…
Reference in New Issue