PKGBUILD, example config, and example systemd service
See the following for a PKGBUILD that works with the current state of the master, so long as you use the dim binary from the releases https://github.com/Dusk-Labs/dim/releases/download/v0.3.0-rc6/release.zip .
Some of this may be useful for #569
# Maintainer: Your Name <[email protected]>
pkgname=dim-git
pkgver=1991.712b368c
pkgrel=1
pkgdesc="Dim Media Manager"
arch=('x86_64')
url="https://github.com/Dusk-Labs/dim"
license=('AGPLv3')
provides=('dim')
depends=('ffmpeg' 'rust' 'sqlite' 'nodejs>=16')
makedepends=('git' 'cargo' 'yarn')
optdepends=(
'libva-intel-driver: for Intel GPU video acceleration support'
'libva-vdpau-driver: for NVIDIA GPU video acceleration support'
'libva-mesa-driver: for AMD GPU video acceleration support'
)
source=("${pkgname}::git+https://github.com/Dusk-Labs/dim.git")
sha256sums=('SKIP')
pkgver() {
cd "${srcdir}/${pkgname}"
echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}
build() {
cd "${srcdir}/${pkgname}"
yarn --cwd ui/
yarn --cwd ui/ build
cd "${srcdir}/${pkgname}"
cargo build --features vaapi --release
}
package() {
install -Dm755 "${srcdir}/${pkgname}/target/release/dim" "${pkgdir}/usr/bin/dim"
install -dm755 "${pkgdir}/usr/bin/utils"
ln -nfs "$(which ffmpeg)" "${pkgdir}/usr/bin/utils/ffmpeg"
ln -nfs "$(which ffprobe)" "${pkgdir}/usr/bin/utils/ffprobe"
install -Dm644 "${srcdir}/${pkgname}/target/dim_dev.db" "${pkgdir}/var/lib/dim/dim_dev.db"
install -dm755 "${pkgdir}/etc/dim"
install -dm755 "${pkgdir}/usr/share/dim"
install -dm755 "${pkgdir}/var/cache/dim"
install -dm755 "${pkgdir}/var/lib/dim"
install -dm755 "${pkgdir}/var/lib/dim/metadata"
install -Dm644 /dev/stdin "$pkgdir/etc/dim/dim.conf" <<EOF1
enable_ssl = false
port = 8000
cache_dir = '/var/cache/dim'
metadata_dir = '/var/lib/dim/metadata'
quiet_boot = false
disable_auth = false
verbose = false
EOF1
# Create the systemd service file
install -Dm644 /dev/stdin "$pkgdir/usr/lib/systemd/system/dim.service" <<EOF2
[Unit]
Description=Dim Media Manager
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/dim -c /etc/dim/dim.conf
WorkingDirectory=/var/lib/dim
Restart=on-failure
Environment=RUST_BACKTRACE=full
Environment=RUST_LOG=info
[Install]
WantedBy=multi-user.target
EOF2
}
You can create the systemd service separately if you like as well
$ sudo nano /usr/lib/systemd/system/dim.service
[Unit]
Description=Dim Media Manager
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/dim -c /etc/dim/dim.conf
WorkingDirectory=/var/lib/dim
Restart=on-failure
Environment=RUST_BACKTRACE=full
Environment=RUST_LOG=info
[Install]
WantedBy=multi-user.target
And an example config:
$ sudo nano /etc/dim/dim.conf
enable_ssl = false
port = 8000
cache_dir = '/var/cache/dim'
metadata_dir = '/var/lib/dim/metadata'
quiet_boot = false
disable_auth = false
verbose = false
Having issues with a master version, I keep getting this error, which doesn't make sense:
Failed to run migrations (maybe you need to delete the old database?): VersionMismatch(20210619211347)
thank you for the great work!
The problem with the database is probably, that it is created relative to the path of the dim-binary
I extended your PKGBUILD and created a seperate user for the service.
enable_hwaccel = true is also neccesary. otherwise the config-file is overwritten.
I'm open for improvements.
if you run this on aarch64, you should use ffmpeg 5 in /usr/share/dim/utils as recommended in https://github.com/Dusk-Labs/dim/issues/554 or wait for the commit
Nice, just had to chown a few things and it worked just fine. I think for a proper deployment we'll need some post install and uninstall actions.
I think my original db issue was actually due to an issue that has since been fixed in the master.