change to a config file

This commit is contained in:
admin 2026-01-27 20:49:19 -07:00
parent a6173f5d7c
commit a86f925f08

View file

@ -4,34 +4,19 @@ services:
container_name: keepalived container_name: keepalived
restart: unless-stopped restart: unless-stopped
network_mode: host network_mode: host
# Privileged is often required to manipulate Host Network Interfaces
privileged: true
# capabilities are good, but 'privileged' is safer for network manipulation in LXC
cap_add: cap_add:
- NET_ADMIN - NET_ADMIN
- NET_BROADCAST - NET_BROADCAST
- NET_RAW - NET_RAW
volumes: volumes:
# Inject the check script # 1. Mount the Check Script Folder
- /docker/keepalived/checks:/checks - /docker/keepalived/checks:/checks
# 2. Mount the Config File (The Nuclear Option)
- /docker/keepalived/config:/config
environment: environment:
- KEEPALIVED_INTERFACE=eth0 # We still need this to tell the container where to look
- KEEPALIVED_ROUTER_ID=51 - KEEPALIVED_CONFIG=/config/keepalived.conf
- KEEPALIVED_VIRTUAL_IPS=172.16.201.250 # Your VIP # We can remove all the other KEEPALIVED_* variables now!
- KEEPALIVED_PASSWORD=${DNS_ADMIN_PASSWORD} # (They are handled inside the file)
# MASTER/BACKUP Logic (Using Variables)
# On PVE2: Set KEEPALIVED_STATE=MASTER, PRIORITY=101
# On PVE1: Set KEEPALIVED_STATE=BACKUP, PRIORITY=100
- KEEPALIVED_STATE=${KEEPALIVED_STATE}
- KEEPALIVED_PRIORITY=${KEEPALIVED_PRIORITY}
- KEEPALIVED_UNICAST_PEERS=${KEEPALIVED_UNICAST_PEERS}
# The Magic Check: Monitors Komodo!
- KEEPALIVED_CHECK_SCRIPT=/checks/check_komodo.sh
- KEEPALIVED_CHECK_INTERVAL=2
- KEEPALIVED_CHECK_RISE=1
- KEEPALIVED_CHECK_FALL=2
- KEEPALIVED_CHECK_WEIGHT=-5