Getting Photoview to work properly on my Synology NAS was a bit of a hassle, so I’m documenting it here for posterity.
I won’t go into detail here about how to set up docker on a Synology NAS. Also, I’m using sqlite as the database, because everything else seemed like overkill for my use-case.
The problem: No matter how I mounted my photos, they were always mounted with rwx permissions only for the user. This didn’t work for me because the photos weren’t all owned by the same user. I’m not sure what’s at play here, but if I change the user ID of the photoview user to any of the user IDs on the host system, they were suddenly mounted with rwx permissions for the groups as well:
FROM photoview/photoview:2
USER root
RUN usermod -u 1026 photoview
USER photoview
After that, the compose.yml looks mostly like the default one from the Photoview devs:
services:
photoview-prepare:
build: .
user: root
entrypoint: []
command: /bin/bash -c "sleep 1 && chown -R photoview /home/photoview/media-cache /home/photoview/database"
cap_add:
- CHOWN
volumes:
- "/etc/localtime:/etc/localtime:ro" ## use local time from host
- "/etc/TZ:/etc/timezone:ro" ## use timezone from host
- "${HOST_PHOTOVIEW_LOCATION}/storage:/home/photoview/media-cache"
- "${HOST_PHOTOVIEW_LOCATION}/database:/home/photoview/database"
photoview:
build: .
restart: unless-stopped
stop_grace_period: 10s
ports:
- "127.0.0.1:40001:8000" ## HTTP port (host:container)
depends_on:
photoview-prepare:
condition: service_completed_successfully
security_opt:
- seccomp:unconfined
- apparmor:unconfined
environment:
PHOTOVIEW_DATABASE_DRIVER: ${PHOTOVIEW_DATABASE_DRIVER}
PHOTOVIEW_SQLITE_PATH: ${PHOTOVIEW_SQLITE_PATH}
PHOTOVIEW_LISTEN_IP: "0.0.0.0"
PHOTOVIEW_LISTEN_PORT: 8000
volumes:
- "/etc/localtime:/etc/localtime:ro" ## use local time from host
- "/etc/TZ:/etc/timezone:ro" ## use timezone from host
- "${HOST_PHOTOVIEW_LOCATION}/database:/home/photoview/database"
- "${HOST_PHOTOVIEW_LOCATION}/storage:/home/photoview/media-cache"
- "${HOST_PHOTOVIEW_MEDIA_ROOT}/foo:/photos/foo:ro"
For completeness, here’s also my .env file:
HOST_PHOTOVIEW_LOCATION=/volume1/docker/photoview
HOST_PHOTOVIEW_MEDIA_ROOT=/volume1/SecurePhotos
PHOTOVIEW_DATABASE_DRIVER=sqlite
PHOTOVIEW_SQLITE_PATH=/home/photoview/database/photoview.db
WATCHTOWER_POLL_INTERVAL=86400
WATCHTOWER_TIMEOUT=30s
WATCHTOWER_CLEANUP=true