You are not logged in.

#1 2022-10-23 21:36:55

wabi
Member
Registered: 2005-04-04
Posts: 72

immich (first draft included [broken])

Trying to make a pkg for immich https://gitlab.com/immich-app/immich
Webfrontend and Machine-Learning parts build but the server parts can't complete the build.
This PKGBUILD is based on https://github.com/immich-app/immich/issues/734
Any help in fixing this is welcome, thanks

pkgname=immich
pkgver=1
pkgrel=0
pkgdesc='Self-hosted photos and videos backup tool'
url='https://gitlab.com/immich-app/immich'
license=('MIT')
arch=(x86_64)
makedepends=('npm' 'python')
depends=('redis' 'postgres' 'npm')
source=("${pkgname%%-git}::git+https://github.com/immich-app/immich.git"
    "${pkgname}-server.service"
    "${pkgname}-microservices.service"
    "${pkgname}-machine-learning.service"
    "${pkgname}-web.service"
)
backup=("")

build() {
    #Build web frontend
    cd "${srcdir}/${pkgname}/web"   
    npm ci
    npm run build

    #Build machine-learning
    cd "${srcdir}/${pkgname}/machine-learning"   
    npm ci
    npm rebuild @tensorflow/tfjs-node --build-from-source
    npm run build
    npm prune --production
    mkdir app
    cp -a package.json package-lock.json node_modules dist app

    #Build Server
    cd "${srcdir}/${pkgname}/server"
    npm ci
    npm run build
    npm prune --production
    mkdir app
    cp -a package.json package-lock.json node_modules dist app
}

package() {
    cd "${srcdir}/${pkgname}"
    install -Dm755 "${pkgname}/server/app" "${pkgdir}/var/lib/immich/app/server"
    install -Dm755 "${pkgname}/web" "${pkgdir}/var/lib/immich/app/web"
    install -Dm755 "${pkgname}/machine-learning/app" "${pkgdir}/var/lib/immich/app/machine-learning"
   
    mkdir "${pkgdir}/var/lib/immich/upload"
    ln -s "${pkgdir}/var/lib/immich/upload" "${pkgdir}/var/lib/immich/app/server/upload"
    ln -s "${pkgdir}/var/lib/immich/upload" "${pkgdir}/var/lib/immich/app/machine-learning/upload"
}

Last edited by wabi (2022-10-23 23:15:37)

Offline

#2 2022-10-23 21:58:29

loqs
Member
Registered: 2014-03-06
Posts: 17,323

Re: immich (first draft included [broken])

Please use code tags for the PKGBUILD.
Missing makedepends git.  Missing checksums array.  Is the dependency postgres meant to be postgresql?  On line 37 should it be npm prune --production?  Try moving npm to makedepends and switching to nodejs-lts-gallium i.e.:

....
makedepends=('nodejs-lts-gallium' 'python' 'git' 'npm')
depends=('nodejs-lts-gallium' 'redis' 'postgresql')
....

Offline

#3 2022-12-19 21:53:41

wabi
Member
Registered: 2005-04-04
Posts: 72

Re: immich (first draft included [broken])

Updated PKGBUILD:

pkgname=immich
pkgrel=0
pkgver=1.38.2_60
pkgdesc='Self-hosted photos and videos backup tool'
url='https://gitlab.com/immich-app/immich'
license=('MIT')
arch=(x86_64)
makedepends=('npm' 'nodejs-lts-hydrogen')
depends=('redis' 'postgresql' 'nodejs')
source=("https://github.com/immich-app/immich/archive/refs/tags/v${pkgver}-dev.tar.gz"
	"${pkgname}-server.service"
	"${pkgname}-microservices.service"
	"${pkgname}-machine-learning.service"
	"${pkgname}-web.service"
	"${pkgname}.sysusers"
	"immich.conf"
)

sha256sums=('ac5650b003c401dbfc0ace745efcd890d0c596d0fd0fa1469e17e20fa2580cbb'
            '4610abec7e1d14eb4b9c33dcbf1362537281e46c96eb79c9a0cef72ad03bd0e2'
            '7390b1e186ea8841f0f22636a32003ef8f4e7d4c34e319b800c3703add815c2a'
            '9ca54531c5671e9a1eb3e26bb41fee24f1ba9a4bd5ba95cf45377a2ee803cd1f'
            '64fd6dcbe66ffb47805221a4122da3defe421bcb636a4ce0fdaa64bd2c7e8bc0'
            'c7db0e5e2eb50bd48892a7e669a2ced65988af43fb82ad67d8e2cc607a6aeb47'
            '45350c8b032783360eec0619d4cccb30c26f590c771561026f78e02d9b12ebc5')

backup=("etc/immich.conf")

build() {
	#Build web frontend
	cd "${srcdir}/${pkgname}-${pkgver}-dev/web"	
	npm ci
	npm run build
	#npm prune --production

	#Build machine-learning
	cd "${srcdir}/${pkgname}-${pkgver}-dev/machine-learning"	
	npm ci
	npm rebuild @tensorflow/tfjs-node --build-from-source
	npm run build
	npm prune --production

	#Build Server
	cd "${srcdir}/${pkgname}-${pkgver}-dev/server"
	npm ci
	npm run build
	npm prune --production


}

package() {
	#install server
	install -Dm755 "${srcdir}/${pkgname}-${pkgver}-dev/server/package.json" "${pkgdir}/var/lib/immich/app/server/package.json"
	install -Dm755 "${srcdir}/${pkgname}-${pkgver}-dev/server/package-lock.json" "${pkgdir}/var/lib/immich/app/server/package-lock.json"
	cp -r "${srcdir}/${pkgname}-${pkgver}-dev/server/node_modules" "${pkgdir}/var/lib/immich/app/server/node_modules"
	cp -r "${srcdir}/${pkgname}-${pkgver}-dev/server/dist" "${pkgdir}/var/lib/immich/app/server/dist"

	#install web frontend
	cp -r "${srcdir}/${pkgname}-${pkgver}-dev/web" "${pkgdir}/var/lib/immich/app/web"

	#install macheine-learning
	install -Dm755 "${srcdir}/${pkgname}-${pkgver}-dev/machine-learning/package.json" "${pkgdir}/var/lib/immich/app/machine-learning/package.json"
	install -Dm755 "${srcdir}/${pkgname}-${pkgver}-dev/machine-learning/package-lock.json" "${pkgdir}/var/lib/immich/app/machine-learning/package-lock.json"
	cp -r "${srcdir}/${pkgname}-${pkgver}-dev/machine-learning/node_modules" "${pkgdir}/var/lib/immich/app/machine-learning/node_modules"
	cp -r "${srcdir}/${pkgname}-${pkgver}-dev/machine-learning/dist" "${pkgdir}/var/lib/immich/app/machine-learning/dist"
	
	ln -s /var/lib/immich/upload "${pkgdir}/var/lib/immich/app/server/upload"
	ln -s /var/lib/immich/upload "${pkgdir}/var/lib/immich/app/machine-learning/upload"

	install -Dm644 "${srcdir}/immich-server.service" "${pkgdir}/usr/lib/systemd/system/immich-server.service"
	install -Dm644 "${srcdir}/immich-machine-learning.service" "${pkgdir}/usr/lib/systemd/system/immich-machine-learning.service"
	install -Dm644 "${srcdir}/immich-web.service" "${pkgdir}/usr/lib/systemd/system/immich-web.service"
	install -Dm644 "${srcdir}/immich-microservices.service" "${pkgdir}/usr/lib/systemd/system/immich-microservices.service"

	install -Dm644 "${srcdir}/immich.sysusers" "${pkgdir}/usr/lib/sysusers.d/immich.conf"
	install -Dm644 "${srcdir}/immich.conf" "${pkgdir}/etc/immich.conf"
}

This version builds successfully and the individual components acutally start. There is still some issues with them not communicating properly with each other. My guess is this is related to some standardized naming convention of the containers used that I've not yet figured out.

Last edited by wabi (2022-12-23 17:05:25)

Offline

#4 2022-12-19 22:21:04

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: immich (first draft included [broken])

loqs wrote:

Please use code tags for the PKGBUILD.


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2022-12-23 17:28:37

wabi
Member
Registered: 2005-04-04
Posts: 72

Re: immich (first draft included [broken])

it works! you need to configure nginx based on the nginx.conf file from immich in the github repo.

Offline

Board footer

Powered by FluxBB