2024-07-24 15:49:31 -04:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
pkgs,
|
|
|
|
...
|
|
|
|
}: let
|
2024-02-23 00:43:16 -05:00
|
|
|
inherit (config.sops) secrets;
|
2024-07-24 15:49:31 -04:00
|
|
|
inherit (config.khepri) rwDataDir;
|
2024-02-19 12:42:02 -05:00
|
|
|
|
|
|
|
rwPath = rwDataDir + "/immich";
|
|
|
|
|
|
|
|
UPLOAD_LOCATION = "${rwPath}/data";
|
|
|
|
in {
|
2024-07-24 20:52:32 -04:00
|
|
|
khepri.compositions."immich" = {
|
|
|
|
networks.proxy_net = {external = true;};
|
2024-02-19 12:42:02 -05:00
|
|
|
|
2024-07-24 20:52:32 -04:00
|
|
|
services = {
|
|
|
|
"immich_server" = {
|
|
|
|
image = import ./images/server.nix pkgs;
|
|
|
|
environmentFiles = [
|
|
|
|
"${./env}"
|
|
|
|
secrets.immich.path
|
|
|
|
];
|
2024-02-19 12:42:02 -05:00
|
|
|
|
2024-07-24 20:52:32 -04:00
|
|
|
volumes = [
|
|
|
|
"${UPLOAD_LOCATION}:/usr/src/app/upload:rw"
|
|
|
|
];
|
|
|
|
ports = [
|
|
|
|
"2283:3001"
|
|
|
|
];
|
|
|
|
networks = ["proxy_net"];
|
2024-02-19 12:42:02 -05:00
|
|
|
|
2024-07-24 20:52:32 -04:00
|
|
|
dependsOn = ["immich_redis" "immich_postgres"];
|
|
|
|
restart = "always";
|
2024-02-19 12:42:02 -05:00
|
|
|
|
2024-07-24 20:52:32 -04:00
|
|
|
environment.NODE_ENV = "production";
|
|
|
|
};
|
2024-02-19 12:42:02 -05:00
|
|
|
|
2024-07-24 20:52:32 -04:00
|
|
|
"immich_machine_learning" = {
|
|
|
|
image = import ./images/machine-learning.nix pkgs;
|
|
|
|
restart = "always";
|
|
|
|
environmentFiles = [
|
|
|
|
"${./env}"
|
|
|
|
secrets.immich.path
|
|
|
|
];
|
|
|
|
networks = ["proxy_net"];
|
2024-02-19 12:42:02 -05:00
|
|
|
|
2024-07-24 20:52:32 -04:00
|
|
|
volumes = [
|
|
|
|
"${rwPath}/cache:/cache"
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
"immich_redis" = {
|
|
|
|
image = import ./images/redis.nix pkgs;
|
|
|
|
restart = "always";
|
|
|
|
tmpfs = ["/data"];
|
|
|
|
environmentFiles = [
|
|
|
|
"${./env}"
|
|
|
|
secrets.immich.path
|
|
|
|
];
|
|
|
|
networks = ["proxy_net"];
|
|
|
|
};
|
2024-02-19 12:42:02 -05:00
|
|
|
|
2024-07-24 20:52:32 -04:00
|
|
|
"immich_postgres" = {
|
|
|
|
image = import ./images/postgres.nix pkgs;
|
|
|
|
restart = "always";
|
|
|
|
environmentFiles = [
|
|
|
|
"${./env}"
|
|
|
|
secrets.immich.path
|
|
|
|
];
|
|
|
|
networks = ["proxy_net"];
|
2024-02-19 12:42:02 -05:00
|
|
|
|
2024-07-24 20:52:32 -04:00
|
|
|
volumes = [
|
|
|
|
"${rwPath}/db:/var/lib/postgresql/data"
|
|
|
|
];
|
2024-02-19 12:42:02 -05:00
|
|
|
|
2024-07-24 20:52:32 -04:00
|
|
|
environment = {
|
|
|
|
POSTGRES_PASSWORD = "\${DB_PASSWORD}";
|
|
|
|
POSTGRES_USER = "\${DB_USERNAME}";
|
|
|
|
POSTGRES_DB = "\${DB_DATABASE_NAME}";
|
|
|
|
};
|
2024-02-19 12:42:02 -05:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|