+ portUtils +metabase

This commit is contained in:
m3tam3re
2025-09-29 15:44:25 +02:00
parent 7cf5f7d06f
commit c11847206f
18 changed files with 317 additions and 109 deletions

View File

@@ -1,8 +1,13 @@
{
config,
lib,
pkgs,
...
}: let
serviceName = "librechat";
portUtils = import ../../../../lib/port-utils.nix {inherit lib;};
servicePort = portUtils.getPort serviceName "AZ-CLD-1";
ragApiPort = portUtils.getPort "rag-api" "AZ-CLD-1";
envFile = config.age.secrets.librechat-env.path;
in {
virtualisation.oci-containers = {
@@ -29,7 +34,7 @@ in {
environmentFiles = [envFile];
dependsOn = ["meilisearch"];
extraOptions = ["--add-host=postgres:10.89.0.1" "--ip=10.89.0.21" "--network=web"];
ports = ["127.0.0.1:8000:8000"]; # optional: expose to host for debugging
ports = ["127.0.0.1:${toString ragApiPort}:8000"];
};
containers.mongodb = {
@@ -44,10 +49,10 @@ in {
extraOptions = ["--ip=10.89.0.22" "--network=web"];
};
containers.librechat = {
containers.${serviceName} = {
image = "ghcr.io/danny-avila/librechat-dev-api:latest";
autoStart = true;
ports = ["127.0.0.1:3040:3080"];
ports = ["127.0.0.1:${toString servicePort}:3080"];
dependsOn = ["mongodb" "rag_api" "meilisearch"];
environment = {
HOST = "0.0.0.0";
@@ -93,12 +98,20 @@ in {
timerConfig.RandomizedDelaySec = "15m";
};
# Traefik configuration
services.traefik.dynamicConfigOptions.http = {
services.librechat.loadBalancer.servers = [{url = "http://localhost:3040/";}];
routers.librechat = {
services.${serviceName}.loadBalancer.servers = [
{
url = "http://localhost:${toString servicePort}/";
}
];
routers.${serviceName} = {
rule = "Host(`chat.az-gruppe.com`)";
tls.certResolver = "ionos";
service = "librechat";
tls = {
certResolver = "ionos";
};
service = serviceName;
entrypoints = "websecure";
};
};