librechat: add meilisearch
This commit is contained in:
parent
fc83c6652d
commit
7613e6cb6b
1 changed files with 68 additions and 0 deletions
|
|
@ -16,6 +16,14 @@ let
|
||||||
finalImageTag = "v0.8.5";
|
finalImageTag = "v0.8.5";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
meiliImage = pkgs.dockerTools.pullImage {
|
||||||
|
imageName = "getmeili/meilisearch";
|
||||||
|
imageDigest = "sha256:b839a48d008d4e67e57f78dcff5b21d5e8b8fa066bacd11f97824d6307abb0dd";
|
||||||
|
hash = "sha256-+hypvjFDSdnnWAO4tARTnjNd/6HlF6pMg1L6UUffdYM=";
|
||||||
|
finalImageName = "getmeili/meilisearch";
|
||||||
|
finalImageTag = "v1.44.0";
|
||||||
|
};
|
||||||
|
|
||||||
defaultEnv = {
|
defaultEnv = {
|
||||||
HOST = "0.0.0.0";
|
HOST = "0.0.0.0";
|
||||||
PORT = "3080";
|
PORT = "3080";
|
||||||
|
|
@ -45,6 +53,11 @@ in
|
||||||
default = image;
|
default = image;
|
||||||
description = "The Docker image to use (`pkgs.dockerTools.pullImage`).";
|
description = "The Docker image to use (`pkgs.dockerTools.pullImage`).";
|
||||||
};
|
};
|
||||||
|
meiliImage = mkOption {
|
||||||
|
type = types.package;
|
||||||
|
default = meiliImage;
|
||||||
|
description = "The Meilisearch Docker image to use (`pkgs.dockerTools.pullImage`).";
|
||||||
|
};
|
||||||
externalUrl = mkOption {
|
externalUrl = mkOption {
|
||||||
type = types.nullOr types.str;
|
type = types.nullOr types.str;
|
||||||
default = null;
|
default = null;
|
||||||
|
|
@ -56,6 +69,11 @@ in
|
||||||
default = 3080;
|
default = 3080;
|
||||||
description = "Which port the LibreChat server listens to.";
|
description = "Which port the LibreChat server listens to.";
|
||||||
};
|
};
|
||||||
|
meiliPort = mkOption {
|
||||||
|
type = types.port;
|
||||||
|
default = 7700;
|
||||||
|
description = "Which port Meilisearch listens to.";
|
||||||
|
};
|
||||||
environment = mkOption {
|
environment = mkOption {
|
||||||
default = { };
|
default = { };
|
||||||
type = types.attrsOf types.str;
|
type = types.attrsOf types.str;
|
||||||
|
|
@ -105,6 +123,21 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
virtualisation.oci-containers.containers."librechat-meilisearch" = {
|
||||||
|
image = with cfg.meiliImage; imageName + ":" + imageTag;
|
||||||
|
imageFile = cfg.meiliImage;
|
||||||
|
environment = {
|
||||||
|
MEILI_NO_ANALYTICS = "true";
|
||||||
|
};
|
||||||
|
volumes = [
|
||||||
|
"librechat_meili_data:/meili_data:rw"
|
||||||
|
];
|
||||||
|
log-driver = "journald";
|
||||||
|
extraOptions = [
|
||||||
|
"--network=host"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
virtualisation.oci-containers.containers.librechat = {
|
virtualisation.oci-containers.containers.librechat = {
|
||||||
image = with cfg.image; imageName + ":" + imageTag;
|
image = with cfg.image; imageName + ":" + imageTag;
|
||||||
imageFile = cfg.image;
|
imageFile = cfg.image;
|
||||||
|
|
@ -112,8 +145,10 @@ in
|
||||||
defaultEnv
|
defaultEnv
|
||||||
// {
|
// {
|
||||||
MONGO_URI = "mongodb://root:librechat@localhost:27017/LibreChat?authSource=admin";
|
MONGO_URI = "mongodb://root:librechat@localhost:27017/LibreChat?authSource=admin";
|
||||||
|
MEILI_HOST = "http://localhost:${toString cfg.meiliPort}";
|
||||||
}
|
}
|
||||||
// cfg.environment;
|
// cfg.environment;
|
||||||
|
environmentFiles = lib.optional (cfg.environmentFile != null) cfg.environmentFile;
|
||||||
volumes = [
|
volumes = [
|
||||||
"librechat_data:/app/client/data:rw"
|
"librechat_data:/app/client/data:rw"
|
||||||
"librechat_images:/app/client/public/images:rw"
|
"librechat_images:/app/client/public/images:rw"
|
||||||
|
|
@ -147,6 +182,24 @@ in
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.services."podman-librechat-meilisearch" = {
|
||||||
|
serviceConfig = {
|
||||||
|
Restart = mkOverride 90 "always";
|
||||||
|
};
|
||||||
|
after = [
|
||||||
|
"podman-volume-librechat_meili_data.service"
|
||||||
|
];
|
||||||
|
requires = [
|
||||||
|
"podman-volume-librechat_meili_data.service"
|
||||||
|
];
|
||||||
|
partOf = [
|
||||||
|
"podman-compose-librechat-root.target"
|
||||||
|
];
|
||||||
|
wantedBy = [
|
||||||
|
"podman-compose-librechat-root.target"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
systemd.services."podman-librechat" = {
|
systemd.services."podman-librechat" = {
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Restart = mkOverride 90 "always";
|
Restart = mkOverride 90 "always";
|
||||||
|
|
@ -157,6 +210,7 @@ in
|
||||||
"podman-volume-librechat_uploads.service"
|
"podman-volume-librechat_uploads.service"
|
||||||
"podman-volume-librechat_logs.service"
|
"podman-volume-librechat_logs.service"
|
||||||
"podman-librechat-mongodb.service"
|
"podman-librechat-mongodb.service"
|
||||||
|
"podman-librechat-meilisearch.service"
|
||||||
];
|
];
|
||||||
requires = [
|
requires = [
|
||||||
"podman-volume-librechat_data.service"
|
"podman-volume-librechat_data.service"
|
||||||
|
|
@ -164,6 +218,7 @@ in
|
||||||
"podman-volume-librechat_uploads.service"
|
"podman-volume-librechat_uploads.service"
|
||||||
"podman-volume-librechat_logs.service"
|
"podman-volume-librechat_logs.service"
|
||||||
"podman-librechat-mongodb.service"
|
"podman-librechat-mongodb.service"
|
||||||
|
"podman-librechat-meilisearch.service"
|
||||||
];
|
];
|
||||||
partOf = [
|
partOf = [
|
||||||
"podman-compose-librechat-root.target"
|
"podman-compose-librechat-root.target"
|
||||||
|
|
@ -238,6 +293,19 @@ in
|
||||||
wantedBy = [ "podman-compose-librechat-root.target" ];
|
wantedBy = [ "podman-compose-librechat-root.target" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
systemd.services."podman-volume-librechat_meili_data" = {
|
||||||
|
path = [ pkgs.podman ];
|
||||||
|
serviceConfig = {
|
||||||
|
Type = "oneshot";
|
||||||
|
RemainAfterExit = true;
|
||||||
|
};
|
||||||
|
script = ''
|
||||||
|
podman volume inspect librechat_meili_data || podman volume create librechat_meili_data
|
||||||
|
'';
|
||||||
|
partOf = [ "podman-compose-librechat-root.target" ];
|
||||||
|
wantedBy = [ "podman-compose-librechat-root.target" ];
|
||||||
|
};
|
||||||
|
|
||||||
systemd.targets."podman-compose-librechat-root" = {
|
systemd.targets."podman-compose-librechat-root" = {
|
||||||
unitConfig = {
|
unitConfig = {
|
||||||
Description = "Root target generated by compose2nix.";
|
Description = "Root target generated by compose2nix.";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue