Redid networking
This commit is contained in:
@@ -43,7 +43,7 @@ let
|
||||
authentication_backend:
|
||||
ldap:
|
||||
implementation: "custom"
|
||||
url: "ldap://127.0.0.1:389"
|
||||
url: "ldap://openldap:389"
|
||||
timeout: "5s"
|
||||
start_tls: false
|
||||
base_dn: "${ldapBaseDN}"
|
||||
@@ -162,7 +162,7 @@ in
|
||||
virtualisation.oci-containers.containers.authelia = {
|
||||
image = cfg.image;
|
||||
|
||||
# No ports mapping — --network=host shares the host network stack directly.
|
||||
ports = [ "127.0.0.1:${toString cfg.port}:9091" ];
|
||||
|
||||
environment = {
|
||||
TZ = homeyConfig.timezone;
|
||||
@@ -184,7 +184,7 @@ in
|
||||
];
|
||||
|
||||
extraOptions = [
|
||||
"--network=host"
|
||||
"--network=homey"
|
||||
"--hostname=authelia"
|
||||
];
|
||||
};
|
||||
@@ -193,8 +193,8 @@ in
|
||||
# Systemd — wait for openldap and external HD
|
||||
# -----------------------------------------------------------------------
|
||||
systemd.services."podman-authelia" = {
|
||||
after = lib.mkAfter [ "mnt-data.mount" "podman-openldap.service" ];
|
||||
requires = lib.mkAfter [ "mnt-data.mount" "podman-openldap.service" ];
|
||||
after = lib.mkAfter [ "mnt-data.mount" "podman-openldap.service" "podman-homey-network.service" ];
|
||||
requires = lib.mkAfter [ "mnt-data.mount" "podman-openldap.service" "podman-homey-network.service" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -60,8 +60,7 @@ in
|
||||
# -----------------------------------------------------------------------
|
||||
virtualisation.oci-containers.containers.gitea = {
|
||||
image = cfg.image;
|
||||
# No ports mapping — --network=host means the container shares the host
|
||||
# network stack directly. Gitea binds to 0.0.0.0:3000 on the host.
|
||||
ports = [ "127.0.0.1:${toString cfg.port}:3000" ];
|
||||
|
||||
# All non-secret settings via GITEA__<SECTION>__<KEY> env vars.
|
||||
# These are safe to store in the Nix store.
|
||||
@@ -153,7 +152,7 @@ in
|
||||
"${dataDir}/gitea/data:/data"
|
||||
];
|
||||
|
||||
extraOptions = [ "--network=host" ];
|
||||
extraOptions = [ "--network=homey" ];
|
||||
};
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
@@ -182,8 +181,8 @@ in
|
||||
'')
|
||||
];
|
||||
};
|
||||
after = lib.mkAfter [ "mnt-data.mount" "podman-openldap.service" ];
|
||||
requires = lib.mkAfter [ "mnt-data.mount" ];
|
||||
after = lib.mkAfter [ "mnt-data.mount" "podman-openldap.service" "podman-homey-network.service" ];
|
||||
requires = lib.mkAfter [ "mnt-data.mount" "podman-homey-network.service" ];
|
||||
};
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
@@ -30,7 +30,7 @@ in
|
||||
config = lib.mkIf cfg.enable {
|
||||
virtualisation.oci-containers.containers.jellyfin = {
|
||||
image = cfg.image;
|
||||
# No ports mapping — --network=host shares the host network stack directly.
|
||||
ports = [ "127.0.0.1:${toString cfg.port}:8096" ];
|
||||
|
||||
environment = {
|
||||
JELLYFIN_PublishedServerUrl = "https://jellyfin.${domain}";
|
||||
@@ -44,12 +44,12 @@ in
|
||||
"${dataDir}/media/tvshows:/data/tvshows:ro"
|
||||
];
|
||||
|
||||
extraOptions = [ "--network=host" ];
|
||||
extraOptions = [ "--network=homey" ];
|
||||
};
|
||||
|
||||
systemd.services."podman-jellyfin" = {
|
||||
after = lib.mkAfter [ "mnt-data.mount" ];
|
||||
requires = lib.mkAfter [ "mnt-data.mount" ];
|
||||
after = lib.mkAfter [ "mnt-data.mount" "podman-homey-network.service" ];
|
||||
requires = lib.mkAfter [ "mnt-data.mount" "podman-homey-network.service" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -58,7 +58,9 @@ in
|
||||
# -----------------------------------------------------------------------
|
||||
virtualisation.oci-containers.containers.nextcloud-postgres = {
|
||||
image = cfg.postgresImage;
|
||||
# No ports mapping — --network=host shares the host network stack directly.
|
||||
# Exposed on localhost for debugging; nextcloud reaches it via the
|
||||
# container name "nextcloud-postgres" on the homey network.
|
||||
ports = [ "127.0.0.1:${toString cfg.postgresPort}:5432" ];
|
||||
|
||||
environment = {
|
||||
POSTGRES_DB = "nextcloud_db";
|
||||
@@ -71,7 +73,7 @@ in
|
||||
];
|
||||
|
||||
extraOptions = [
|
||||
"--network=host"
|
||||
"--network=homey"
|
||||
"--env-file=/run/nc-postgres-secrets.env"
|
||||
];
|
||||
};
|
||||
@@ -91,8 +93,8 @@ in
|
||||
];
|
||||
};
|
||||
postStop = "rm -f /run/nc-postgres-secrets.env";
|
||||
after = lib.mkAfter [ "mnt-data.mount" ];
|
||||
requires = lib.mkAfter [ "mnt-data.mount" ];
|
||||
after = lib.mkAfter [ "mnt-data.mount" "podman-homey-network.service" ];
|
||||
requires = lib.mkAfter [ "mnt-data.mount" "podman-homey-network.service" ];
|
||||
};
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
@@ -100,20 +102,22 @@ in
|
||||
# -----------------------------------------------------------------------
|
||||
virtualisation.oci-containers.containers.nextcloud = {
|
||||
image = cfg.image;
|
||||
# No ports mapping — --network=host shares the host network stack directly.
|
||||
# Apache inside the container listens on port 80; map it to cfg.port on
|
||||
# the host so Caddy can reach it. Postgres is reachable by container name.
|
||||
ports = [ "127.0.0.1:${toString cfg.port}:80" ];
|
||||
|
||||
environment = {
|
||||
POSTGRES_HOST = "127.0.0.1";
|
||||
POSTGRES_HOST = "nextcloud-postgres";
|
||||
POSTGRES_DB = "nextcloud_db";
|
||||
POSTGRES_USER = "postgres";
|
||||
NEXTCLOUD_ADMIN_USER = "admin";
|
||||
NEXTCLOUD_TRUSTED_DOMAINS = "nextcloud.${domain}";
|
||||
OVERWRITEPROTOCOL = "https";
|
||||
OVERWRITECLIURL = "https://nextcloud.${domain}";
|
||||
# With --network=host, port mappings are ignored and the container's
|
||||
# Apache binds directly on the host. Force it onto port 8080 so Caddy
|
||||
# can own 80/443.
|
||||
APACHE_HTTP_PORT_NUMBER = toString cfg.port;
|
||||
OVERWRITEHOST = "nextcloud.${domain}";
|
||||
# Trust the reverse proxy (Caddy on the host reaches the container
|
||||
# via the podman bridge; cover all RFC-1918 ranges to be robust).
|
||||
TRUSTED_PROXIES = "10.0.0.0/8 172.16.0.0/12 192.168.0.0/16 127.0.0.1 ::1";
|
||||
# Passwords injected via env file
|
||||
};
|
||||
|
||||
@@ -122,7 +126,7 @@ in
|
||||
];
|
||||
|
||||
extraOptions = [
|
||||
"--network=host"
|
||||
"--network=homey"
|
||||
"--env-file=/run/nc-secrets.env"
|
||||
];
|
||||
};
|
||||
@@ -143,8 +147,8 @@ in
|
||||
];
|
||||
};
|
||||
postStop = "rm -f /run/nc-secrets.env";
|
||||
after = lib.mkAfter [ "mnt-data.mount" "podman-nextcloud-postgres.service" ];
|
||||
requires = lib.mkAfter [ "mnt-data.mount" "podman-nextcloud-postgres.service" ];
|
||||
after = lib.mkAfter [ "mnt-data.mount" "podman-nextcloud-postgres.service" "podman-homey-network.service" ];
|
||||
requires = lib.mkAfter [ "mnt-data.mount" "podman-nextcloud-postgres.service" "podman-homey-network.service" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -50,10 +50,7 @@ in
|
||||
virtualisation.oci-containers.containers.openldap = {
|
||||
image = cfg.image;
|
||||
|
||||
# No ports mapping — --network=host means the container shares the host
|
||||
# network stack. OpenLDAP binds to 0.0.0.0:389, but the firewall
|
||||
# (common.nix) only opens 22/80/443, so port 389 is unreachable from
|
||||
# the LAN or internet.
|
||||
ports = [ "127.0.0.1:${toString cfg.port}:389" ];
|
||||
|
||||
environment = {
|
||||
LDAP_ORGANISATION = homeyConfig.organization;
|
||||
@@ -78,7 +75,7 @@ in
|
||||
];
|
||||
|
||||
extraOptions = [
|
||||
"--network=host"
|
||||
"--network=homey"
|
||||
"--env-file=/run/openldap-secrets.env"
|
||||
];
|
||||
};
|
||||
@@ -113,8 +110,8 @@ in
|
||||
# Clean up the env file on stop
|
||||
postStop = "rm -f /run/openldap-secrets.env";
|
||||
# Wait for the external HD to be mounted before starting
|
||||
after = lib.mkAfter [ "mnt-data.mount" ];
|
||||
requires = lib.mkAfter [ "mnt-data.mount" ];
|
||||
after = lib.mkAfter [ "mnt-data.mount" "podman-homey-network.service" ];
|
||||
requires = lib.mkAfter [ "mnt-data.mount" "podman-homey-network.service" ];
|
||||
};
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
|
||||
@@ -36,19 +36,18 @@ in
|
||||
|
||||
environment = {
|
||||
PHPLDAPADMIN_HTTPS = "false";
|
||||
# host.containers.internal resolves to the host from inside a podman
|
||||
# bridge container — reaches openldap which is on --network=host at :389
|
||||
PHPLDAPADMIN_LDAP_HOSTS = "host.containers.internal";
|
||||
# "openldap" resolves to the OpenLDAP container via homey network DNS.
|
||||
PHPLDAPADMIN_LDAP_HOSTS = "openldap";
|
||||
};
|
||||
|
||||
# Bridge network (default) + port mapping: Apache binds inside the
|
||||
# container on :80, podman maps it to 127.0.0.1:8081 on the host.
|
||||
ports = [ "127.0.0.1:${toString cfg.port}:80" ];
|
||||
|
||||
extraOptions = [ "--network=homey" ];
|
||||
};
|
||||
|
||||
systemd.services."podman-phpldapadmin" = {
|
||||
after = lib.mkAfter [ "podman-openldap.service" ];
|
||||
wants = lib.mkAfter [ "podman-openldap.service" ];
|
||||
after = lib.mkAfter [ "podman-openldap.service" "podman-homey-network.service" ];
|
||||
wants = lib.mkAfter [ "podman-openldap.service" "podman-homey-network.service" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -35,16 +35,14 @@ in
|
||||
config = lib.mkIf cfg.enable {
|
||||
virtualisation.oci-containers.containers.transmission = {
|
||||
image = cfg.image;
|
||||
# No ports mapping — --network=host shares the host network stack directly.
|
||||
# Map host cfg.port (9092) → container 9091 so Caddy can reach it
|
||||
# without conflicting with Authelia's host port (also 9091).
|
||||
ports = [ "127.0.0.1:${toString cfg.port}:9091" ];
|
||||
|
||||
environment = {
|
||||
PUID = "1000";
|
||||
PGID = "1000";
|
||||
# With --network=host, port mappings are ignored; transmission binds
|
||||
# directly on the host. Force it to cfg.port (9092) to avoid
|
||||
# conflicting with Authelia on 9091.
|
||||
TRANSMISSION_WEB_HOME = "/usr/share/transmission/web";
|
||||
WEBUI_PORT = toString cfg.port;
|
||||
};
|
||||
|
||||
volumes = [
|
||||
@@ -55,12 +53,12 @@ in
|
||||
"${dataDir}/media/complete:/downloads/complete"
|
||||
];
|
||||
|
||||
extraOptions = [ "--network=host" ];
|
||||
extraOptions = [ "--network=homey" ];
|
||||
};
|
||||
|
||||
systemd.services."podman-transmission" = {
|
||||
after = lib.mkAfter [ "mnt-data.mount" ];
|
||||
requires = lib.mkAfter [ "mnt-data.mount" ];
|
||||
after = lib.mkAfter [ "mnt-data.mount" "podman-homey-network.service" ];
|
||||
requires = lib.mkAfter [ "mnt-data.mount" "podman-homey-network.service" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user