update immich

This commit is contained in:
Joakim Repomaa
2024-07-16 10:57:49 +03:00
parent cca6abb196
commit 6cb5322e7b

View File

@@ -6,7 +6,8 @@ let
immich_data_dir = "/mnt/storage/immich"; immich_data_dir = "/mnt/storage/immich";
volumeServices = names: ( volumeServices = names: (
lib.lists.foldl (services: name: lib.lists.foldl
(services: name:
services // { services // {
"podman-volume-immich_${name}" = { "podman-volume-immich_${name}" = {
path = [ pkgs.podman ]; path = [ pkgs.podman ];
@@ -21,11 +22,14 @@ let
wantedBy = [ "podman-compose-immich-root.target" ]; wantedBy = [ "podman-compose-immich-root.target" ];
}; };
} }
) {} names )
{ }
names
); );
containerServices = services: ( containerServices = services: (
lib.lists.foldl (acc: { name, volumes ? [], ... }: lib.lists.foldl
(acc: { name, volumes ? [ ], ... }:
let let
volume_services = map (volume: "podman-volume-immich_${volume}.service") volumes; volume_services = map (volume: "podman-volume-immich_${volume}.service") volumes;
dependent_services = [ "podman-network-immich_default.service" ] ++ volume_services; dependent_services = [ "podman-network-immich_default.service" ] ++ volume_services;
@@ -47,9 +51,11 @@ let
}; };
} }
) )
{} services { }
services
); );
in { in
{
# Containers # Containers
virtualisation.oci-containers.containers = { virtualisation.oci-containers.containers = {
"immich_machine_learning" = { "immich_machine_learning" = {
@@ -67,28 +73,6 @@ in {
]; ];
}; };
"immich_microservices" = {
image = "ghcr.io/immich-app/immich-server:${immich_version}";
environmentFiles = [
"/var/secrets/immich.env"
];
volumes = [
"/etc/localtime:/etc/localtime:ro"
"${immich_data_dir}:/usr/src/app/upload:rw"
"${storage_dir}:${storage_dir}:ro"
];
cmd = [ "start.sh" "microservices" ];
dependsOn = [
"immich_postgres"
"immich_redis"
];
log-driver = "journald";
extraOptions = [
"--network-alias=immich-microservices"
"--network=immich_default"
];
};
"immich_postgres" = { "immich_postgres" = {
image = "registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0"; image = "registry.hub.docker.com/tensorchord/pgvecto-rs:pg14-v0.2.0";
environmentFiles = [ environmentFiles = [
@@ -133,7 +117,6 @@ in {
ports = [ ports = [
"2283:3001/tcp" "2283:3001/tcp"
]; ];
cmd = [ "start.sh" "immich" ];
dependsOn = [ dependsOn = [
"immich_postgres" "immich_postgres"
"immich_redis" "immich_redis"
@@ -151,7 +134,6 @@ in {
{ name = "postgres"; volumes = [ "db_data" ]; } { name = "postgres"; volumes = [ "db_data" ]; }
{ name = "redis"; } { name = "redis"; }
{ name = "server"; } { name = "server"; }
{ name = "microservices"; }
]) // { ]) // {
# Networks # Networks
"podman-network-immich_default" = { "podman-network-immich_default" = {
@@ -191,11 +173,13 @@ in {
fileSystems."${immich_data_dir}" = { fileSystems."${immich_data_dir}" = {
device = "//u407959.your-storagebox.de/backup/immich"; device = "//u407959.your-storagebox.de/backup/immich";
fsType = "cifs"; fsType = "cifs";
options = let options =
let
# this line prevents hanging on network split # this line prevents hanging on network split
automount_opts = "x-systemd.automount,auto,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s"; automount_opts = "x-systemd.automount,auto,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
in ["${automount_opts},credentials=/var/secrets/smb-storage"]; in
[ "${automount_opts},credentials=/var/secrets/smb-storage" ];
}; };
environment.systemPackages = [ pkgs.cifs-utils ]; environment.systemPackages = [ pkgs.cifs-utils ];