Created
February 12, 2022 10:55
-
-
Save odnanref/0c3aeb0de203ab1a6a1b2ef51a613ca2 to your computer and use it in GitHub Desktop.
PiHole LoadBalance UDP and HTTP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
job "pihole" { | |
datacenters = ["dc1"] | |
type = "service" | |
group "pihole" { | |
count = 1 | |
volume "volume_nomad" { | |
type = "host" | |
read_only = false | |
source = "mysql" | |
} | |
network { | |
port "pihole" { | |
to = 53 | |
} | |
port "http" { | |
to = 80 | |
} | |
} | |
restart { | |
attempts = 10 | |
interval = "5m" | |
delay = "25s" | |
mode = "delay" | |
} | |
task "pihole" { | |
driver = "docker" | |
volume_mount { | |
volume = "volume_nomad" | |
destination = "/etc/pihole/" | |
read_only = false | |
} | |
env { | |
TZ = "Europe/Lisbon" | |
WEBPASSWORD = "strong PASSWORD!!" | |
ADMIN_EMAIL = "webmaster@xxx.com" | |
PIHOLE_DNS_ = "1.1.1.1;8.8.8.8" | |
QUERY_LOGGING = "true" | |
} | |
config { | |
image = "pihole/pihole" | |
ports = [ | |
"pihole", | |
"http" | |
] | |
} | |
resources { | |
cpu = 1000 | |
memory = 128 | |
} | |
service { | |
name = "pihole" | |
port = "pihole" | |
tags = [ | |
"traefik.enable=true", | |
"traefik.tcp.routers.dns.rule=HostSNI(`*`)", | |
"traefik.tcp.routers.dns.entrypoints=pihole", | |
"traefik.tcp.routers.dns.service=pihole", | |
"traefik.tcp.services.pihole.loadbalancer.server.port=53", | |
"traefik.udp.routers.dns_udp.entrypoints=piholeudp", | |
"traefik.udp.routers.dns_udp.service=piholeudp", | |
"traefik.udp.services.piholeudp.loadbalancer.server.port=53" | |
] | |
check { | |
type = "tcp" | |
interval = "10s" | |
timeout = "2s" | |
} | |
} | |
service { | |
name = "piholehttp" | |
port = "http" | |
tags = [ | |
"traefik.enable=true", | |
"traefik.protocol=http", | |
"traefik.http.routers.piholehttp.rule=Host(`pihole.a1.xxx.com`)", | |
"traefik.http.routers.piholehttp.entrypoints=web", | |
"traefik.http.services.piholehttp.loadbalancer.server.scheme=http" | |
] | |
check { | |
type = "tcp" | |
interval = "10s" | |
timeout = "2s" | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment