db setup immich
This commit is contained in:
@@ -43,4 +43,12 @@ in {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setup = {
|
||||||
|
trigger = "server";
|
||||||
|
script = pkgs.writeShellScript "setup" ''
|
||||||
|
PSQL="${pkgs.postgresql}/bin/psql"
|
||||||
|
$PSQL -d "immich_db" -tAc "CREATE EXTENSION IF NOT EXISTS vector;"
|
||||||
|
$PSQL -d "immich_db" -tAc "CREATE EXTENSION IF NOT EXISTS earthdistance;"
|
||||||
|
'';
|
||||||
|
};
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,6 @@ in {
|
|||||||
PSQL="${pkgs.postgresql}/bin/psql"
|
PSQL="${pkgs.postgresql}/bin/psql"
|
||||||
${lib.concatMapStringsSep "\n" (name: ''
|
${lib.concatMapStringsSep "\n" (name: ''
|
||||||
$PSQL -tAc "ALTER DATABASE ${name}_db OWNER TO ${name}_user;"
|
$PSQL -tAc "ALTER DATABASE ${name}_db OWNER TO ${name}_user;"
|
||||||
$PSQL -d "${name}_db" -tAc "CREATE EXTENSION IF NOT EXISTS vector;"
|
|
||||||
|
|
||||||
if [ -f "${config.sops.secrets."${lib.toUpper name}".path}" ]; then
|
if [ -f "${config.sops.secrets."${lib.toUpper name}".path}" ]; then
|
||||||
PASS=$(grep "^DB_PASSWORD=" "${config.sops.secrets."${lib.toUpper name}".path}" | cut -d'=' -f2-)
|
PASS=$(grep "^DB_PASSWORD=" "${config.sops.secrets."${lib.toUpper name}".path}" | cut -d'=' -f2-)
|
||||||
|
|||||||
Reference in New Issue
Block a user