Skip to content

Commit

Permalink
immich: 1.119.1 -> 1.120.0
Browse files Browse the repository at this point in the history
  • Loading branch information
dotlambda committed Nov 7, 2024
1 parent 90fcec9 commit 4be70cc
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 21 deletions.
9 changes: 7 additions & 2 deletions nixos/modules/services/web-apps/immich.nix
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ in
description = ''
Configuration for Immich.
See <https://immich.app/docs/install/config-file/> or navigate to
<https://your-immich-domain/admin/system-settings> for
<https://my.immich.app/admin/system-settings> for
options and defaults.
Setting it to `null` allows configuring Immich in the web interface.
'';
Expand Down Expand Up @@ -270,7 +270,7 @@ in
let
postgresEnv =
if isPostgresUnixSocket then
{ DB_URL = "socket://${cfg.database.host}?dbname=${cfg.database.name}"; }
{ DB_URL = "postgresql:///${cfg.database.name}?host=${cfg.database.host}"; }
else
{
DB_HOSTNAME = cfg.database.host;
Expand Down Expand Up @@ -317,6 +317,11 @@ in
after = [ "network.target" ];
wantedBy = [ "multi-user.target" ];
inherit (cfg) environment;
path = [
# gzip and pg_dumpall are used by the backup service
pkgs.gzip
config.services.postgresql.package
];

serviceConfig = commonServiceConfig // {
ExecStart = lib.getExe cfg.package;
Expand Down
28 changes: 19 additions & 9 deletions nixos/tests/web-apps/immich.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import ../make-test-python.nix (
diskSize = 4096;
};

environment.systemPackages = with pkgs; [ immich-cli ];
environment.systemPackages = with pkgs; [ immich-cli jq ];

services.immich = {
enable = true;
Expand All @@ -31,21 +31,31 @@ import ../make-test-python.nix (
machine.succeed("curl --fail http://localhost:2283/")
machine.succeed("""
curl -H 'Content-Type: application/json' --data '{ "email": "[email protected]", "name": "Admin", "password": "admin" }' -X POST http://localhost:2283/api/auth/admin-sign-up
curl -f --json '{ "email": "[email protected]", "name": "Admin", "password": "admin" }' http://localhost:2283/api/auth/admin-sign-up
""")
res = machine.succeed("""
curl -H 'Content-Type: application/json' --data '{ "email": "[email protected]", "password": "admin" }' -X POST http://localhost:2283/api/auth/login
curl -f --json '{ "email": "[email protected]", "password": "admin" }' http://localhost:2283/api/auth/login
""")
token = json.loads(res)['accessToken']
if False:
res = machine.succeed("""
curl -f -H 'Cookie: immich_access_token=%s' --json '{ "name": "API Key", "permissions": ["all"] }' http://localhost:2283/api/api-keys
""" % token)
key = json.loads(res)['secret']
machine.succeed(f"immich login http://localhost:2283/api {key}")
res = machine.succeed("immich server-info")
print(res)
machine.succeed("""
curl -f -X PUT -H 'Cookie: immich_access_token=%s' --json '{ "command": "start" }' http://localhost:2283/api/jobs/backupDatabase
""" % token)
res = machine.succeed("""
curl -H 'Content-Type: application/json' -H 'Cookie: immich_access_token=%s' --data '{ "name": "API Key", "permissions": ["all"] }' -X POST http://localhost:2283/api/api-keys
curl -f -H 'Cookie: immich_access_token=%s' http://localhost:2283/api/jobs
""" % token)
key = json.loads(res)['secret']
machine.succeed(f"immich login http://localhost:2283/api {key}")
res = machine.succeed("immich server-info")
print(res)
assert json.loads(res)["backupDatabase"]["jobCounts"]["active"] == 1
machine.wait_until_succeeds("ls /var/lib/immich/backups/*.sql.gz")
'';
}
)
14 changes: 14 additions & 0 deletions pkgs/by-name/im/immich/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
stdenvNoCC,
buildNpmPackage,
fetchFromGitHub,
fetchpatch2,
python3,
nodejs,
node-gyp,
Expand Down Expand Up @@ -146,6 +147,19 @@ buildNpmPackage' {
src = "${src}/server";
inherit (sources.components.server) npmDepsHash;

patches = [
# https://github.com/immich-app/immich/pull/13970
(fetchpatch2 {
name = "allow-starting-backup-through-API.patch";
url = "https://github.com/immich-app/immich/commit/ce872b047d50e6f67fc9eec50ee5f70c75a58c3b.patch";
hash = "sha256-KXMqs3n6T4+iIooMWVULhn9pyXZ84TAOQlZGDTwgPpQ=";
})
# pg_dumpall fails without database root access
# see https://github.com/immich-app/immich/issues/13971
./use-pg-dump.patch
];
patchFlags = [ "-p2" ];

nativeBuildInputs = [
pkg-config
python3
Expand Down
20 changes: 10 additions & 10 deletions pkgs/by-name/im/immich/sources.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
{
"version": "1.119.1",
"hash": "sha256-T+bIL2LaVNgFT3xBUxiEzhyDiLpw/WU7mxttuJD39SQ=",
"version": "1.120.0",
"hash": "sha256-SpqVjkZfP6Vr/3/QVpWgd4nEbuGXPrjFH8L3kb4Cn/E=",
"components": {
"cli": {
"npmDepsHash": "sha256-kTBlo6eIPswZC0GQG7IoqQZ5b7wPEXFaD/SuuaEQMEg=",
"version": "2.2.28"
"npmDepsHash": "sha256-iXsmICRNEXlwv98gcLhb/7IhOGP9U6dvhg83t7ETyRg=",
"version": "2.2.29"
},
"server": {
"npmDepsHash": "sha256-zgzqh3TyafPKuk5RZ2I/haYFzMVlI4jGnwD5XLqTBdg=",
"version": "1.119.1"
"npmDepsHash": "sha256-Y0OHQ01EKbPToFl3OWIZizvRU2WcGP6XfRZBsnxNur8=",
"version": "1.120.0"
},
"web": {
"npmDepsHash": "sha256-LPtsMzF7yYGrrpDoYoba6OQphKY7AvGbJpPc5pS4eFU=",
"version": "1.119.1"
"npmDepsHash": "sha256-PLW3g/obnYhrIDOCUJM5flnOAb451a2Prw/BEX5AMnY=",
"version": "1.120.0"
},
"open-api/typescript-sdk": {
"npmDepsHash": "sha256-dyKmDez8jO6p+cmSa2KMe9zzhXn4on3aFUMdep+gjzU=",
"version": "1.119.1"
"npmDepsHash": "sha256-DrODeU9xiX0wpO/1rlv48KcAKCRWX5kU46DxjVo6iLw=",
"version": "1.120.0"
}
}
}
13 changes: 13 additions & 0 deletions pkgs/by-name/im/immich/use-pg-dump.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/server/src/services/backup.service.ts b/server/src/services/backup.service.ts
index 3dad4f101..672db564f 100644
--- a/server/src/services/backup.service.ts
+++ b/server/src/services/backup.service.ts
@@ -93,7 +93,7 @@ export class BackupService extends BaseService {

try {
await new Promise<void>((resolve, reject) => {
- const pgdump = this.processRepository.spawn(`pg_dumpall`, [...databaseParams, '--clean', '--if-exists'], {
+ const pgdump = this.processRepository.spawn(`pg_dump`, [...databaseParams, '--clean', '--if-exists'], {
env: { PATH: process.env.PATH, PGPASSWORD: isUrlConnection ? undefined : config.password },
});

0 comments on commit 4be70cc

Please sign in to comment.