[dm-companion] Routes the API through the same host as the frontend

This commit is contained in:
2025-06-01 11:54:51 -07:00
parent 1ae798e30c
commit e5861f8e6b
3 changed files with 39 additions and 1 deletions

View File

@@ -3,6 +3,7 @@
{
# Additional configuration
imports = [
./containers/dm-companion.nix
./containers/freshrss.nix
./containers/gitea.nix
./containers/grafana.nix

View File

@@ -0,0 +1,35 @@
{ config, ... }:
let
inherit (import ./lib.nix config) mkContainer localHostRule havenisms;
in
{
virtualisation.oci-containers.containers = {
dm-companion-pocketbase =
let
hostName = "dm-pocketbase";
in
mkContainer {
inherit hostName;
image = "docker.havenisms.com/lazy-dm/pocketbase";
port = 8080;
volumes = [
"dm-companion:/pb/pb_data"
];
environment = { };
extraLabels = {
"traefik.http.routers.${hostName}-api.rule" =
"PathPrefix(`/api`) && ${localHostRule "dm" havenisms}";
"traefik.http.routers.${hostName}-api.service" = "${hostName}";
};
};
dm-companion = mkContainer {
hostName = "dm";
image = "docker.havenisms.com/lazy-dm/app";
port = 80;
dependsOn = [
"dm-companion-pocketbase"
];
volumes = [ ];
};
};
}

View File

@@ -40,6 +40,7 @@ in
user ? null,
extraOptions ? [ ],
oauthProxy ? false,
extraLabels ? { },
}:
let
routerRule = if public then hostRule hostName domain else localHostRule hostName domain;
@@ -76,7 +77,8 @@ in
"traefik.http.services.${hostName}.loadbalancer.server.port" = "${toString port}";
}
// oauthLabels
// homepageLabels;
// homepageLabels
// extraLabels;
};
# Creates a MariaDB container for a specific app. It should be safe to give