Run PhotoPrism on another computer
Par Alexis Lefebvre le vendredi 17 décembre 2021, 23:54 - Lien permanent
I was able to launch a PhotoPrism container on another computer by following these steps.
Let's say that you have 2 computers, the server is the one that already run PhotoPrism, we'll use our local computer as a client to run PhotoPrism.
⚠️ Prerequisites:
- you have Docker on both computers, you start PhotoPrism with
docker-compose
- the folders mounted in the photoprism container are mounted on your other computer (I use Samba for this):
- the folder(s) with your media content
- the
storage
folder
- the storage folder is writable by the client too
- you understand every step below
On your server:
- Do a backup just in case
- Stop the
photoprism
container (we don't want parallel accesses to the same database) - Open the port for the database by updating
docker-compose.yml
, my local network is on the 192.168.1.X range so I use it to not open the port to Internet:
photoprism-db: # … ports: - 192.168.1.6:13306:3306
Restart the photoprism-db
container: docker-compose up --detach photoprism-db
On your client:
We have to run PhotoPrism and it needs to access to the same paths than when it's running on the server.
- Copy the
docker-compose.yml
file, keep only thephotoprism
service - Remove the network
- Update the
PHOTOPRISM_DATABASE_DSN
variable to use the database on the server - Update the
volumes
:- the part before
:
has to be updated and correspond to the paths that were mounted in the container - the part after
:
is kept as is
- the part before
You should have something like this:
version: '3.7' services: photoprism: # … environment: # … PHOTOPRISM_DATABASE_DSN: "photoprism:photoprism@tcp(192.168.1.6:13306)/photoprism?charset=utf8mb4,utf8&parseTime=true" volumes: - "/mnt/nas/photos/:/photoprism/originals/" - "/mnt/nas/photoprism/storage/:/photoprism/storage" # keep database files
Start the photoprism
container: docker-compose up --detach photoprism
.
Access to the PhotoPrism instance through the port you defined. You should see the same media than before.
I didn't do any benchmark, but the network may be the bottleneck with this setup.