feat: preferably bind to 0.0.0.0 in vms to remove issues with wireguard

coming up late; also increase default vm memory to 2G
This commit is contained in:
oddlama 2023-08-17 17:10:14 +02:00
parent af066925b4
commit f29318a5ac
No known key found for this signature in database
GPG key ID: 14EFE510775FE39A
9 changed files with 30 additions and 52 deletions

View file

@ -3,7 +3,6 @@
lib,
nodes,
pkgs,
utils,
...
}: let
sentinelCfg = nodes.sentinel.config;
@ -16,7 +15,7 @@ in {
services.nginx = {
upstreams.adguardhome = {
servers."${config.services.adguardhome.settings.bind_host}:${toString config.services.adguardhome.settings.bind_port}" = {};
servers."${config.meta.wireguard.proxy-sentinel.ipv4}:${toString config.services.adguardhome.settings.bind_port}" = {};
extraConfig = ''
zone adguardhome 64k;
keepalive 2;
@ -46,7 +45,7 @@ in {
# simpler sed dns.host_addr logic.
mutableSettings = false;
settings = {
bind_host = config.meta.wireguard.proxy-sentinel.ipv4;
bind_host = "0.0.0.0";
bind_port = 3000;
dns = {
bind_hosts = [
@ -76,7 +75,6 @@ in {
};
systemd.services.adguardhome = {
after = ["sys-subsystem-net-devices-${utils.escapeSystemdPath "wan"}.device"];
preStart = lib.mkAfter ''
INTERFACE_ADDR=$(${pkgs.iproute2}/bin/ip -family inet -brief addr show wan | grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+")
sed -i -e "s/123.123.123.123/$INTERFACE_ADDR/" "$STATE_DIRECTORY/AdGuardHome.yaml"