PhotoPrism is a very cool piece of software that you can use to manage your photo collection locally.
Once set up, your photos will be scanned and categorized using AI models. That means you can not only look at the pictures sorted by person (thanks to face recognition). It is also possible to display all beach photos, all photos showing cars, animals or even umbrellas.
Because all photos and user data remain on your own hard drive, you don't have to worry about the usual worries like data protection or the cloud.
What I personally find very useful is that PhotoPrism can also be operated in a read-only mode. If this mode is activated, PhotoPrism only reads your photos. This ensures that no photos can be changed or deleted via the PhotoPrism interface. If you want the latter, you can of course deactivate the write protection. Then photos can not only be deleted and edited. It is also possible to upload new photos via the interface or WebDAV.
If you want to test a live demo in advance. The developers provide a demo under the following link.
- PhotoPrism Live Demo: https://demo.photoprism.app/library/browse
On the left you can see the typical view of the PhotoPrism interface.
Thanks to the prepared Docker image, installation on the RaspberryPi is quick and safe. There is only one small drawback here: PhotoPrism only runs on a 64-bit operating system. You may have to install a 64-bit RaspberryPi OS on the SD card of your RaspberryPi.
As soon as you've done that, you can start. I have described everything you need to know step by step in this article.
Safety instructions
I know the following notes are always kind of annoying and seem unnecessary. Unfortunately, many people who knew "better" have lost eyes, fingers or other things due to carelessness or injured themselves. Data loss is almost negligible in comparison, but even these can be really annoying. Therefore, please take five minutes to read the safety instructions. Because even the coolest project is not worth injury or other trouble.
https://www.nerdiy.de/sicherheitshinweise/
Affiliate links/advertising links
The links to online shops listed here are so-called affiliate links. If you click on such an affiliate link and make a purchase via this link, Nerdiy.de will receive a commission from the relevant online shop or provider. The price does not change for you. If you make your purchases via these links, you support Nerdiy.de in being able to offer other useful projects in the future. 🙂
Requirements
Before you start with this article, you should have prepared the Raspberry Pi so that it can be reached via the network and controlled via SSH.
The following articles describe what needs to be done to prepare your Raspberry Pi:
- RaspberryPi – setup for nerdiys!
- RaspberryPi – The first configuration!
- RaspberryPi – Control the RaspberryPi via SSH
- Raspberry Pi – Build NetworkAttachedStorage / NAS with a Raspberry Pi 4 yourself
- RaspberryPi – Build NetworkAttachedStorage / NAS from a RaspberryPi 4 yourself
- RaspberryPi – Install OpenMediaVault / OMV on the RaspberryPi
In the following lists you will find all the parts you need to implement this article.
Required tool:
Number | Link |
---|---|
1x | Screwdriver set Buy at Amazon |
1x | SD card reader Buy at Amazon |
Required material:
Number | Link |
---|---|
1x | Raspberry Pi Buy at Amazon |
1x | Raspberry Pi power supply Buy at Amazon |
1x | Raspberry Pi case Buy at Amazon |
1x | Micro SD card 64GB Buy at Amazon |
Install Docker
PhotoPrism is installed as a Docker image. For this, Docker and Portainer should already be installed.
If you haven't installed these two tools yet: In the article Raspberry Pi – Using Docker Containers with OpenMediaVault OMV and Portainer I have described the installation.
Create OMV System user to run PhotoPrism
To run PhotoPrism you should create a user.
On the one hand, I have how you do it in the article OpenMediaVault - Create another user described. On the other hand, it is also shown again in the next steps.
To do this, click in the section
- Users
on the entry
- Users
Then click on the blue plus symbol shown and then on “Create”.
You can enter all user information in the form that appears.
In most cases it is sufficient to assign a user name and password. Of course, you can also configure other settings (e.g. group membership) here.
I just have the user here
- photoprism_bot
created.
Then click “Save” to apply the settings.
Now you can accept the change to the configuration by clicking on the tick shown in the upper yellow bar and then confirming this by clicking on "Yes".
Find out the system user ID
Later, during the configuration of the Docker image, you will need, among other things, the user ID of the previously created user. You can access this via SSH access to your Raspberry Pi (or any other Linux machine).
The user ID of the user
- photoprism_bot
you can then retrieve it with the following command:
- id photoprism_bot
Then note the value for "uid". (In this example "1003")
Create folders to store the PhotoPrism files
Various user data such as databases or thumbnails are generated during the operation of PhotoPrism. So that these are not lost even after a restart, you should now create a folder for them on the hard drive connected to your OMV.
Go to the category
- shared folders
Now click on the plus symbol to create a new share.
You will then be redirected to the form shown.
Here you can give the release a name, select on which integrated partition it should be created and also specify the access rights.
I chose “photoprism_files” as the name here. Of course, you can also name the folder something else.
After you have set everything as desired, you can accept the settings by clicking on "Save".
Then you have to confirm the changed configuration again by clicking on the check mark in the yellow area and...
... this confirmed again.
Next you have to configure the user rights for this folder. To do this, mark the entry of the created folder and click on “Priviliges”.
In the list that is then displayed, look for the previously created user (here “photoprism_bot”) and activate the read and write permissions (“Read/Write”).
Then click on “Save” to save the changes.
Now repeat the same again for the ACL settings.
Highlight the folder and click on the "ACL" icon shown.
Enable read and write access here again.
And sets the remaining configurations as shown.
Then click “Save” again to apply the changes.
Then you have to confirm the changed configuration again by clicking on the check mark in the yellow area and...
... this confirmed again.
At this point you should also copy the absolute path to the folder you just created. You will need it later to add it to the Docker Compose configuration file
Set up PhotoPrism Docker Compose configuration using Portainer
After you have prepared all folders you can now set up the PhotoPrism Docker Image using the Docker Compose configuration.
To do this, open the interface of your Portainer instance and click on the "loal" button shown.
Then click on “Stacks”
And then click the "+ Add Stack" button.
On the "Create Stack" overview, you should now first assign a name. For example
- photoprism
Now it's time to adapt the Docker Compose configuration to your needs. To do this, first copy the complete text below and paste it into the large text field of the "Create Stack" interface.
In the following steps, the important points are then adjusted.
version: '3.5' # Example Docker Compose config file for PhotoPrism (Raspberry Pi 3/4 and other ARM64-based devices) # # Note: # - You have to boot your Raspberry Pi 3/4 with the parameter "arm_64bit=1" in config.txt to use our ARM64 (64-bit) image. # An "exec format" error will occur otherwise. # - Try explicitly pulling the ARM64 version if you've booted your device with the "arm_64bit=1" flag and you see # the "no matching manifest" error on Raspberry Pi OS (Raspbian). See documentation for details. # - Use https://dl.photoprism.app/docker/armv7/docker-compose.yml to run PhotoPrism and MariaDB on ARMv7-based devices # as well as Raspberry Pi OS (Raspbian) installations without 64-bit support. # - Hardware transcoding is only available for sponsors due to the high maintenance and support effort. # - Running PhotoPrism on a server with less than 4 GB of swap space or setting a memory/swap limit can cause unexpected # restarts ("crashes"), for example, when the indexer temporarily needs more memory to process large files. # - In case you see Docker errors related to "cgroups", try adding the following parameters to /boot/firmware/cmdline.txt # or /boot/cmdline.txt (file location depends on the OS in use): cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1 # - If you install PhotoPrism on a public server outside your home network, please always run it behind a secure # HTTPS reverse proxy such as Traefik or Caddy. Your files and passwords will otherwise be transmitted # in clear text and can be intercepted by anyone, including your provider, hackers, and governments: # https://docs.photoprism.app/getting-started/proxies/traefik/ # # Setup Guides: # - https://docs.photoprism.app/getting-started/docker-compose/ # - https://docs.photoprism.app/getting-started/raspberry-pi/ # # Troubleshooting Checklists: # - https https://docs.photoprism.app/getting-started/troubleshooting/ # - https://docs.photoprism.app/getting-started/troubleshooting/docker/ # - https://docs.photoprism.app/getting-started /troubleshooting/mariadb/ # # CLI Commands: # - https://docs.photoprism.app/getting-started/docker-compose/#command-line-interface # # All commands may have to be prefixed with "sudo" when not running as root. # This will point the home directory shortcut ~ to /root in volume mounts. services: photoprism: ## Use photoprism/photoprism:preview-arm64 for testing preview builds: image: photoprism/photoprism:arm64 depends_on: - mariadb ## Don't enable automatic restarts until PhotoPrism has been properly configured and tested! ## If the service gets stuck in a restart loop, this points to a memory, filesystem, network, or database issue: ## https://docs.photoprism.app/getting-started/troubleshooting/#fatal-server-errors # restart: unless-stopped security_opt: - seccomp:unconfined - apparmor:unconfined ports: - "2342:2342" # HTTP port (host:container) environment: PHOTOPRISM_ADMIN_USER: "!ENTER_USERNAME_HERE!" # superadmin username PHOTOPRISM_ADMIN_PASSWORD: "!ENTER_PASSWORD_HERE!" # initial superadmin password (minimum 8 characters) PHOTOPRISM_AUTH_MODE: "password" # authentication mode (public, password) PHOTOPRISM_SITE_URL: "http://!ENTER_HOSTNAME_OR_IP_HERE!:2342/" # server URL in the format "http(s):// domain.name(:port)/(path)" PHOTOPRISM_ORIGINALS_LIMIT: 50000 # file size limit for originals in MB (increase for high-res video) PHOTOPRISM_HTTP_COMPRESSION: "gzip" # improves transfer speed and bandwidth utilization (none or gzip) PHOTOPRISM_WORKERS: 2 # limits the number of indexing workers to reduce system load PHOTOPRISM_LOG_LEVEL: "info" # log level: trace, debug, info, warning, error, fatal, or panic PHOTOPRISM_READONLY: "true" # do not modify originals directory (reduced functionality) PHOTOPRISM_EXPERIMENTAL: "false" # enables experimental features PHOTOPRISM_DISABLE_CHOWN: "false" # disables updating storage permissions via chmod and chown on startup PHOTOPRISM_DISABLE_WEBDAV: "false" # disables built-in WebD AV server PHOTOPRISM_DISABLE_SETTINGS: "false" # disables Settings in Web UI PHOTOPRISM_DISABLE_TENSORFLOW: "false" # disables all features depending on TensorFlow PHOTOPRISM_DISABLE_FACES: "false" # disables face detection and recognition (requires TensorFlow) PHOTOPRISM_DISABLE_CLASSIFICATION: "false" # disables image classification ( requires TensorFlow) PHOTOPRISM_DISABLE_RAW: "false" # disables indexing and conversion of RAW files PHOTOPRISM_RAW_PRESETS: "false" # enables applying user presets when converting RAW files (reduces performance) PHOTOPRISM_JPEG_QUALITY: 85 # a higher value increases the quality and file size of JPEG images and thumbnails (25-100) PHOTOPRISM_DETECT_NSFW: "false" # automatically flags photos as private that MAY be offensive (requires TensorFlow) PHOTOPRISM_UPLOAD_NSFW: "true" # allow uploads that MAY be offensive # PHOTOPRISM_DATABASE_DRIVER: "sqlite" # SQLite is an embedded database that doesn't require a serve r PHOTOPRISM_DATABASE_DRIVER: "mysql" # use MariaDB 10.5+ or MySQL 8+ instead of SQLite for improved performance PHOTOPRISM_DATABASE_SERVER: "mariadb:3306" # MariaDB or MySQL database server (hostname:port) PHOTOPRISM_DATABASE_NAME: "photoprism" # MariaDB or MySQL database schema name PHOTOPRISM_DATABASE_USER: "photoprism" # MariaDB or MySQL database user name PHOTOPRISM_DATABASE_PASSWORD: "insecure" # MariaDB or MySQL database user password PHOTOPRISM_SITE_CAPTION: "AI-Powered Photos App" PHOTOPRISM_SITE_DESCRIPTION: "" # meta site description PHOTOPRISM_SITE_AUTHOR: "" # meta site author ## Run/install on first startup (options: update, gpu, tensorflow, davfs, clean): #PHOTOPRISM_INIT: "update clean" ## Hardware Video Transcoding: # PHOTOPRISM_FFMPEG_ENCODER: "raspberry" # FFmpeg encoder ("software", "intel", "nvidia", "apple", "raspberry") # PHOTOPRISM_FFMPEG_BITRATE: "32" # FFmpeg encoding bitrate limit in Mbit/s (default ult: 50) ## Run as a non-root user after initialization (supported: 0, 33, 50-99, 500-600, and 900-1200): PHOTOPRISM_UID: 10XX PHOTOPRISM_GID: 100 # PHOTOPRISM_UMASK: 0000 ## Share hardware devices with FFmpeg and TensorFlow (optional): ## See: https://www.raspberrypi.com/documentation/accessories/camera.html#driver-differences-when-using-libcamera-or-the-legacy-stack # devices: # - "/ dev/video11:/dev/video11" # Video4Linux Video Encode Device (h264_v4l2m2m) working_dir: "/photoprism" # do not change or remove ## Storage Folders: "~" is a shortcut for your home directory, "." for the current directory volumes: # "/host/folder:/photoprism/folder" # Example - "!real_photoLocationFolder1_path!:/photoprism/originals/photoLocation1" # Original media files (DO NOT REMOVE) - "!real_photoLocationFolder2_path!:/photoprism /originals/photoLocation2" # Original media files (DO NOT REMOVE) - "!real_photoLocationFolderX_path!:/photoprism/originals/photoLocationX" # Original media files (DO NOT REMOVE) # - "/example/family:/photoprism/originals/family " # *Additional* media folders can be mounted like this # - "~/Import:/photoprism/import" # *Optional* base folder from which files can be imported to originals - "!real_photoprism_folder_path!/storage:/photoprism/storage " # *Writable* storage folder for cache, database, and sidecar files (DO NOT REMOVE) ## Database Server (recommended) ## see https://docs.photoprism.app/getting-started/faq/#should-i-use- sqlite-mariadb-or-mysql mariadb: ## If MariaDB gets stu ck in a restart loop, this points to a memory or file system issue: ## https://docs.photoprism.app/getting-started/troubleshooting/#fatal-server-errors restart: unless-stopped image: arm64v8/mariadb:10.10 # ARM64 IMAGE ONLY, DOES NOT WORK ON ARMv7, AMD or Intel security_opt: - seccomp:unconfined - apparmor:unconfined command: mysqld --innodb-buffer-pool-size=256M --transaction-isolation=READ-COMMITTED --character- set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci --max-connections=512 --innodb-rollback-on-timeout=OFF --innodb-lock-wait-timeout=120 ## Never store database files on an unreliable device such as a USB flash drive, an SD card, or a shared network folder: volumes: - "!real_photoprism_folder_path!/database:/var/lib/mysql" # DO NOT REMOVE environment: MARIADB_AUTO_UPGRADE: "1" MARIADB_INITDB_SKIP_TZINFO: "1" MARIADB_DATABASE: "photoprism" MARIADB_USER: "photoprism" MARIADB_PASSWORD: "insecure" MARIADB_ROOT_PASSWORD: "insecure" ## Watcht ower upgrades services automatically (optional) ## see https://docs.photoprism.app/getting-started/updates/#watchtower # # watchtower: # restart: unless-stopped # image: containrrr/watchtower # environment: # WATCHTOWER_CLEANUP: "true " # WATCHTOWER_POLL_INTERVAL: 7200 # checks for updates every two hours # volumes: # - "/var/run/docker.sock:/var/run/docker.sock" # - "~/.docker/config.json:/config .json" # optional, for authentication if you have a Docker Hub account
First you should enter a username and password in the areas marked in red. This will be needed later to be able to log into the PhotoPrism web interface.
You must also enter the host name or IP address of your OMV server.
For reference, on my test server, the file looks as shown. (Of course you should use a much more complicated password here.)
Also adjusts the PHOTOPRISM_UID value to match the user id value of the previously created user (ie 1003 in this example).
Then you have to adjust two folder paths. On the one hand the value for "!real_photoLocationFolderX_path!" and for "!real_photoprism_folder_path!"
For "!real_photoprism_folder_path!" you have to use the path of the previously created folder for the user data.
For "!real_photoLocationFolderX_path!" you have to enter the path to your photo collection. For example, if your photo collection is located under "/home/pi/pictures", you use exactly this path here. You can also specify multiple paths here. Then make sure that you adjust the "photolocation1...X" accordingly.
For reference: On my test server, the part of the configuration file looks as shown.
For "!real_photoprism_folder_path!" you have to use the path of the previously created folder for the user data a little further down.
For reference: On my test server, the part of the configuration file looks as shown.
You should use the part shown later...
… change as shown.
This causes the PhotoPrism container to start automatically as soon as the server is started. The developers of PhotoPrism expressly recommend doing this only when PhotoPrism is running stably!
As soon as you have everything configured as desired, you can activate the configuration by clicking on "Deploy the stack".
You can check whether PhotoPrism will start by clicking on the entry shown...
... and checked the status of the two containers.
here both should have the status "running".
In the second column you can also see the port through which the web interface of PhotoPrism can be reached.
Log into the PhotoPrism interface and start indexing the images
After starting the Docker container, you can now call up the PhotoPrism web interface and start indexing the images. Indexing is important for scanning and, if necessary, categorizing the images. Depending on the size of your photo collection, this process can take a long time (e.g. several days).
To open the PhotoPrism interface, simply enter the IP address of your OMV server followed by the configured port.
If the IP address of your OMV server is "192.168.0.3" and you have used the preconfigured port (2342) above, you must enter "192.168.0.3:2342" in the address bar of your browser to open the PhotoPrism interface.
After calling up the PhotoPrism interface, you will be greeted with the view shown.
Enter the previously configured access data here to verify yourself.
Since no indexing has been carried out before, no pictures will be displayed to you now.
So click on “Library”…
... to get to the view shown.
Here you should check “Complete Rescan” and then click on “Start”.
This will start indexing your photo collection.
You can also monitor the indexing progress in the "Logs" tab on the same page.
The indexing process now takes a while depending on the size of the photo collection.
Meanwhile you can look at the first indexed photos in the "Search" area.
More articles related to OpenMediaVault
I have described the many other functions of OpenMediaVault in other articles. These articles are all grouped into the following category.
Have fun with the project
I hope everything worked as described for you. If not or you have questions or suggestions please let me know in the comments. I will then add this to the article if necessary.
Ideas for new projects are always welcome. 🙂
PS Many of these projects - especially the hardware projects - cost a lot of time and money. Of course I do this because I enjoy it, but if you think it's cool that I share the information with you, I would be happy about a small donation to the coffee fund. 🙂
First of all, thank you for the great article with helpful screenshots, which I came across today when I was looking for a photo manager on the Raspi. I am currently running a Raspi 3 with SD card and https://ei23.de/. A Raspi 4 with SSD is already in the drawer and should finally be used, but I do my act. ei23 with the various SmartHome components must first be transferred to the SSD.
My question about the above article concerns multi-user capability. So also provide space for the family members. Is this possible? Your article: https://nerdiy.de/de_de/howto-openmediavault-weiteren-benutzer-erstellen/ sounds like it. But somehow it stops too early for me as a layman. The practical application is missing :(.
Also I saw that there are older articles about OpenMediaVault. It's confusing which ones are (still) valid and which ones aren't. The above article is certainly relevant for (my) new installations. I will report if necessary ;).