You are going to run the containers in user mode with podman
. You would need to set up a (new) user. We assume the username is photoprism (otherwise you have to adjust a few files and commands), and that this user is dedicated for the task at hand: running the service and hosting the image files. So we are going to put all directories and files inside this user's home directory.
- A linux system
- using systemd as their init system
- having podman installed
- having git installed
You are going to create the new user photoprism and afterwards assign a password:
sudo useradd -m photoprism && sudo passwd photoprism
All the next steps are done as the newly created user photoprism.
su - photoprism
You are going to need 4 directories, 1 for the database container (database
) and 3 for the webserver container (originals
, import
, storage
).
(In case you want to create any of these directories elsewhere or want to name them differently, you'll have to adjust the config; detailed instructions below)
mkdir ~/{database,originals,import,storage}
You need to tell the system that this user is allowed to keep processes running even after the user logged out:
loginctl enable-linger $(whoami)
We are going to store the unit files for systemd in ~/.config/systemd/user/. As this directory might not exist, we are going to create it:
mkdir -p ~/.config/systemd/user/
In order to execute some commands related to systemd as a user, we need to set an environment variable (find out which shell you are using via echo $0
):
echo "export XDG_RUNTIME_DIR=/run/user/\$(id -u)" >> ~/.bashrc && source ~/.bashrc
echo "export XDG_RUNTIME_DIR=/run/user/\$(id -u)" >> ~/.zshrc && source ~/.zshrc
git clone https://github.com/photoprism/photoprism-contrib.git
navigate into the repository
cd photoprism-contrib/config/podman-systemd/
All relevant files are located in podman-systemd
cp ./container-photoprism-database-user.template ./container-photoprism-database-user.env
cp ./container-photoprism-webserver-user.template ./container-photoprism-webserver-user.env
By default, a schema called photoprism as well as a user called photoprism are created in the database (the DBMS mariadb). The user's default password is insecure.
You can change this by editing the two files container-photoprism-database-user.env
and container-photoprism-webserver-user.env
:
- schema
- MARIADB_DATABASE=photoprism in
container-photoprism-database-user.env
- PHOTOPRISM_DATABASE_NAME=photoprism in
container-photoprism-webserver-user.env
- MARIADB_DATABASE=photoprism in
- user
- MARIADB_USER=photoprism in
container-photoprism-database-user.env
- PHOTOPRISM_DATABASE_USER=photoprism in
ccontainer-photoprism-webserver-user.env
- MARIADB_USER=photoprism in
- password
- MARIADB_PASSWORD=insecure in
container-photoprism-database-user.env
- PHOTOPRISM_DATABASE_PASSWORD=insecure in
container-photoprism-webserver-user.env
- MARIADB_PASSWORD=insecure in
In case you decided to persist your data in non-standard directories or you are running photoprism as another user, you would need to create a new .env
file and adjust it accordingly:
cp ./volumes-photoprism-user.template ./volumes-photoprism-user.env
You might want to change the admin password in container-photoprism-webserver-user.env
:
- PHOTOPRISM_ADMIN_PASSWORD=please-change-me
All config option described here are still available. just add the corresponding options to container-photoprism-webserver-user.env
ln -s \
$(pwd)/*.service \
$(pwd)/*.env \
~/.config/systemd/user/
Next we are going to tell systemd about the new units
systemctl --user daemon-reload
(you would need to run this after the unit files changed, i.e. after you ran git pull
)
Now we can start the pod and both containers
systemctl --user enable --now pod-photoprism.service
let's try to access the webserver on the command line
curl http://localhost:2342
systemctl --user restart pod-photoprism.service
Next you are going to enable automatic updates of our images. The containers are being created with this flag: --label "io.containers.autoupdate=image"
(in the .service
files). Containers with this label which are controlled via systemd can be automatically updated regularly. To do so, we enable a systemd timer:
systemctl --user enable --now podman-auto-update.timer
- proxy, e.g. nginx
- allow writing to
import
e.g. via smb
- Fedora Server 36+
- as described
- Ubuntu Server 22.04+
- works with the following changes:
sudo apt install podman -y
- you might start with
bash
after logging into the newly created user (if your prompt looks minimal orecho $0
says-sh
)
- works with the following changes:
- tested with
Fedora Server 36
andpodman 4.1.1
- tested with
Ubuntu Server 22.04
andpodman 3.4.4