August 08, 2022    Share on: Twitter | Facebook | HackerNews | Reddit

Install Photoprism on QNAP NAS using Docker Compose

Photoprism is a modern, searchable, well organized web gallery of your photos and videos. At the moment of writing, the official documentation, does not contain a dedicated instructions on how to install Photoprism on QNAP NAS. This article is meant to fill that gap. Installation described here was done on TS-251+ (Celeron J1900 4 Cores) but should be applicable to wide variety of other QNAP NAS models.


What is the photoprism

from the photoprism website:

PhotoPrism® is an AI-Powered Photos App for the Decentralized Web. It makes use of the latest technologies to tag and find pictures automatically without getting in your way. You can run it at home, on a private server, or in the cloud.

Screenshot

Feature Overview

NOTE: I haven't found functionality to add other accounts than administrator. But in my case having only single user is perfectly fine.

Installation on QNAP NAS from the CLI

Prerequisites

This instruction assumes that you are familiar with using command line interface (CLI).

  • ensure you have installed Container Station which is providing Docker on QNAP NAS
  • ensure that you have docker in the path

login to your NAS server via SSH

from the terminal or use e.g. putty if working on Windows

Create photoprism directory

mkdir /share/Container/photoprism
cd photoprism

Create docker-compose.yml file

download docker-compose.yml from the link provided in official documentation :

wget https://dl.photoprism.app/docker/docker-compose.yml

Assuming that you keep your original photos in /share/Multimedia/photos modify volume mount for photoprism/originals. To do that, edit volumes part of the docker-compose.yml file you just downloaded and provide proper mapping for the /photoprism/originals.

volumes:
  # "/host/folder:/photoprism/folder"                 # Example
  - "/share/Multimedia/zdjecia:/photoprism/originals" # Original media files 

NOTE: Other things you might want to modify in the docker-compose.yml are: - default password for the user admin (default is: insecure) - number of workers - disable Tensorflow (used for categorization of photos and face detection)

For changing number of workers and disabling TensorFlow see the "Performance tuning" section bellow.

Create directories in /share/Container/photoprism

mkdir /share/Container/photoprism/database
mkdir /share/Container/photoprism/import
mkdir /share/Container/photoprism/originals
mkdir /share/Container/photoprism/storage

Run application in the container

Start the container. Pulling images might take few minutes depending on your Internet connection speed.

docker-compose up -d

after that, Photoprism should be available under:

http://<YOUR-NAS-IP>:2342

You need to login as administrator with default password for the first time, after login remember to change that password in settings. img

Using web-UI

Now, you can trigger indexing your photos and videos using web-UI or from CLI. img

Using CLI

docker exec -ti photoprism photoprism index

Manual upgrading Photoprism to the latests version

cd /share/Container/photoprism/
docker pull photoprism/photoprism:latest
docker stop photoprism
docker-compose up -d

For automated updates check Watchtower

Adding new content

  • use upload via webDAV
  • manually upload new pictures and videos to /share/Multimedia/Import and manually trigger import using CLI:
docker exec photoprism photoprism import

You can also consider automating import by adding import do the cron (e.g. every midnight)

Performance tuning

If you are experiencing performance problems you can reduce number of workers (from documentation):

Try reducing the number of workers by setting PHOTOPRISM_WORKERS to a reasonably small value in docker-compose.yml, depending on the CPU performance and number of cores

or disable TensorFlow:

As a last measure, you can disable the use of TensorFlow for image classification and facial recognition. You ca do it via web-UI settings, cli (--disable-tensorflow option) or set PHOTOPRISM_DISABLE_TENSORFLOW to true in docker-compose.yml and restart container.

Credits: I was able to launch this service thanks to the instructions found on reddit [1] provided by schol4stiker.

References

  1. instruction from reddit
  2. How to Setup PhotoPrism on a Synology NAS in 2022 - WunderTech