blob: f2e33d2213cde81f0632e66edd5d696ad607ade6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
|
# Maintainer: aliu <aaronliu 0 1 3 0 gmail com>
# Contributor: wabi <aschrafl@jetnet.ch>
# Contributor: pikl <me@pikl.uk>
# Contributor: caoticofanegas
# Contributor: AlD <daniel@lbe.rs>
# Contributor: Terrence
pkgbase=immich
pkgname=('immich-server' 'immich-cli')
pkgrel=1
pkgver=2.7.5
pkgdesc='Self-hosted photos and videos backup tool'
url='https://github.com/immich-app/immich'
license=('AGPL-3.0-only')
arch=(x86_64 aarch64)
# ts-node required for CLI
makedepends=('git' 'pnpm' 'ts-node' 'mise')
# combination of server/CLI deps, see split package functions
# for individual deps and commentary
# dependencies generated from base-images repository
# https://github.com/immich-app/base-images/blob/main/server/Dockerfile
# 1.101.0-2: liborc dep found to be not required
depends=('valkey' 'postgresql>=14' 'nodejs>=20'
'vectorchord>=0.3' 'vectorchord<2' # server/src/constants.ts
'zlib'
'glib2'
'expat'
'librsvg'
'libexif'
'libwebp'
'libjpeg-turbo'
'libgsf'
'libpng'
'libheif'
'lcms2'
'mimalloc'
'openjpeg2'
'openexr>=3.4.0' # sharp refuses to start rn w/ lower version; not sure where this version's from
'liblqr'
'libtool'
'jellyfin-ffmpeg' # maintainer advice 28/10/24
# need to ensure this matches sharp depend version
# because otherwise a local copy will be built
# breaking heif conversion
'libvips>=8.17.3'
'openslide'
'poppler-glib'
'imagemagick'
'libraw'
# added v1.108
'libde265'
'dav1d'
# added v1.118
'brotli'
'perl-io-compress-brotli'
# added v1.120.2
'highway'
)
source=("${pkgbase}-${pkgver}.tar.gz::https://github.com/immich-app/immich/archive/refs/tags/v${pkgver}.tar.gz"
'postgres-path.patch' # replace Debian's location of postgres with Arch's
'sh-serverhome.patch' # tell start.sh server home's /usr/lib/immich/app/server
'sharp.patch' # patch sharp to use pnpm instead of npm in install script
"${pkgbase}-server.service"
"${pkgbase}.sysusers"
"${pkgbase}.tmpfiles"
'immich.conf'
'nginx.immich.conf'
# TODO at the moment, the latest version at install will be taken
# mirroring approach in docker base-image, however should we implement
# a simple service to keep these up-to-date since they appear to be
# generated daily?
'https://download.geonames.org/export/dump/cities500.zip'
'https://download.geonames.org/export/dump/admin1CodesASCII.txt'
'https://download.geonames.org/export/dump/admin2Codes.txt'
'https://raw.githubusercontent.com/nvkelso/natural-earth-vector/v5.1.2/geojson/ne_10m_admin_0_countries.geojson')
sha256sums=('1b6f680ba816a7085adb29b5141212eacccc02659545db2fb59452c470fad546'
'cc061fc006d2e60ace2b3b4844c8e3d7ffda0164a0579dae2beb479d86dce7f0'
'd1297cc2e222b4679dda9e972d39a9e8d3e65cd9b2f9fb762e27dc5781d5a65f'
'e56fe5f8abb55f93117cd8b5e1214d06a21a9f8e0458607040c5c5e364b0a164'
'2ca8f6776aef27c455142edbe9120b7c38ee354dca5336ce89c16f71dd633a28'
'01707746e8718fe169b729b7b3d9e26e870bf2dbc4d1f6cdc7ed7d3839e92c0e'
'4ae8a73ccbef568b7841dbdfe9b9d8a76fa78db00051317b6313a6a50a66c900'
'077b85d692df4625300a785eed1efdc7af8fbb8e05dfa8c7d8b4053c1eb76a58'
'614b56dba38f9201d8a391d0f3d2cdf5571935a1ea6c5d19a74a942f18411763'
'SKIP'
'SKIP'
'SKIP'
'239eec57ac17f100a11e2536cffc56752c318b50ae765b0918ff7aab4ce8f255')
prepare() {
cd "${srcdir}/${pkgbase}-${pkgver}"
patch -p1 < "${srcdir}/postgres-path.patch"
patch -p1 < "${srcdir}/sh-serverhome.patch"
rm cli/LICENSE # deploy would've picked this up, duplicating standard /usr/share/licenses/spdx/AGPL-3.0-only
# Patches to avoid calling npm in package scripts
pnpm fetch --ignore-scripts # First, get node_modules folder to patch into
pnpm install --filter immich --frozen-lockfile --offline # sometimes pnpm fetch doesn't give us the node_modules folder
sharp_dir="$(pnpm patch sharp | sed -n '3p' | sed 's/^[[:space:]]*//')"
cd "$sharp_dir"
patch -p1 < "${srcdir}/sharp.patch"
cd "$srcdir/${pkgbase}-${pkgver}"
pnpm patch-commit "$sharp_dir" # Second, this runs the scripts
cd server
rm ../mise.toml # otherwise asks to trust in mise build steps, interrupting unattended builds
}
# instructions adapted from relevant Dockerfile-s
build() {
cd "${srcdir}/${pkgbase}-${pkgver}"
# build server
## add a flag to pnpm --filter immich build to make swagger plugin work
## see https://docs.nestjs.com/openapi/cli-plugin#swc-builder
## (immich itself is a monorepo but immich-server isn't)
cd server
pnpm exec nest build --type-check
cd ../
SHARP_IGNORE_GLOBAL_LIBVIPS=true pnpm --filter immich build
pnpm --filter immich --prod --no-optional deploy output/server-pruned
# build sdk and web
export NODE_OPTIONS=--max-old-space-size=4096 # prevent OOM
pnpm --filter @immich/sdk --filter immich-web --frozen-lockfile install
pnpm --filter @immich/sdk --filter immich-web build
# build CLI
pnpm install --filter @immich/cli --frozen-lockfile
pnpm --filter @immich/cli build
pnpm --filter @immich/cli --prod --no-optional deploy output/cli-pruned
# build plugins
cd plugins
export MISE_TRUSTED_CONFIG_PATHS="${srcdir}/${pkgbase}-${pkgver}/plugins/mise.toml"
mise install # --cd plugins just does the cd for you
mise run build
}
package_immich-server() {
replaces=('immich')
conflicts=('immich')
backup=("etc/immich.conf")
install=${pkgname}.install
changelog='BREAKING CHANGELOG.md'
optdepends=(
'nginx: Reverse proxy'
'immich-machine-learning: Required for features such as smart search, duplicate detection, and facial recognition'
)
cd "${srcdir}/${pkgbase}-${pkgver}"
# install server
# from: server/Dockerfile COPY commands after build
# * start*.sh not required
# * setting NODE_ENV=production picked up in systemd service file
install -dm755 "${pkgdir}/usr/lib/immich/app/server"
cp -rT output/server-pruned "${pkgdir}/usr/lib/immich/app/server"
# install web
install -dm755 "${pkgdir}/usr/lib/immich/build"
cp -r web/build "${pkgdir}/usr/lib/immich/build/www"
# install plugins
install -dm755 "${pkgdir}/usr/lib/immich/build/corePlugin"
cp -r plugins/dist "${pkgdir}/usr/lib/immich/build/corePlugin/dist"
install -Dm644 plugins/manifest.json "${pkgdir}/usr/lib/immich/build/corePlugin/manifest.json"
cd "${srcdir}"
# install reverse-geocoding data
# https://github.com/immich-app/base-images/blob/main/server/Dockerfile
install -dm755 "${pkgdir}/usr/lib/immich/build/geodata"
install -Dm644 cities500.txt "${pkgdir}/usr/lib/immich/build/geodata/cities500.txt"
install -Dm644 admin1CodesASCII.txt "${pkgdir}/usr/lib/immich/build/geodata/admin1CodesASCII.txt"
install -Dm644 admin2Codes.txt "${pkgdir}/usr/lib/immich/build/geodata/admin2Codes.txt"
install -Dm644 ne_10m_admin_0_countries.geojson "${pkgdir}/usr/lib/immich/build/geodata/ne_10m_admin_0_countries.geojson"
date --iso-8601=seconds | tr -d "\n" > "${pkgdir}/usr/lib/immich/build/geodata/geodata-date.txt"
# install systemd service files
install -Dm644 immich-server.service "${pkgdir}/usr/lib/systemd/system/immich-server.service"
# install configuration files
install -Dm644 immich.sysusers "${pkgdir}/usr/lib/sysusers.d/immich.conf"
install -Dm644 immich.tmpfiles "${pkgdir}/usr/lib/tmpfiles.d/immich.conf"
install -Dm644 immich.conf "${pkgdir}/etc/immich.conf"
install -Dm644 nginx.immich.conf "${pkgdir}/usr/share/doc/immich/examples/nginx.conf"
# we don't create a build-lock.json because if the file is empty
# it just detects the right versions from the environment
# see server/src/repositories/server-info.repository.ts
# symlink to server management scripts
install -dm755 "${pkgdir}/usr/bin"
ln -s ../lib/immich/app/server/bin/immich-healthcheck "${pkgdir}/usr/bin/immich-healthcheck"
ln -s ../lib/immich/app/server/bin/start.sh "${pkgdir}/usr/bin/immich-admin" # only difference is a few more logs
}
package_immich-cli() {
arch=('any')
depends=('nodejs>=20')
cd "${srcdir}/${pkgbase}-${pkgver}/"
install -dm755 "${pkgdir}/usr/lib/immich/cli"
cp -rT output/cli-pruned "${pkgdir}/usr/lib/immich/cli"
# setup symlink to allow immich command to be run from shell
install -dm755 "${pkgdir}/usr/bin"
ln -s ../lib/immich/cli/bin/immich "${pkgdir}/usr/bin/immich"
}
|