PhotoView

PhotoView is a photos gallery written by a photographer for photographers.

Installation

Create user:

useradd -d /data/daemons/pigallery2 -m -g photos pigallery2

Create the docker-compose.yml:

docker-compose.yml
services:
  photoview:
    image: viktorstrate/photoview:2
    hostname: photoview
    container_name: photoview
    ports:
      - "8009:1808" 
    depends_on:
      mariadb:
    environment:
      PHOTOVIEW_DATABASE_DRIVER: mysql
      ## Comment out the next variable in the case PHOTOVIEW_DATABASE_DRIVER is set to `sqlite` or `postgres` in the .env
      PHOTOVIEW_MYSQL_URL: "photoview:<< your random db password here >>@tcp(photoview-mariadb)/photoview"
      PHOTOVIEW_LISTEN_IP: "photoview"
      MAPBOX_TOKEN: "<< generate MapBox Token and put it here >>"
      PHOTOVIEW_LISTEN_PORT: 1808
    volumes:
      - "/etc/localtime:/etc/localtime:ro" 
      - "/etc/timezone:/etc/timezone:ro"   
      - "/data/daemons/photoview/storage:/home/photoview/media-cache"
      - "/data/Photos:/photos:ro" #  here put your photos path!
    networks:
      - photoview-net

  mariadb:
    networks: 
      - photoview-net
    image: mariadb:lts
    hostname: photoview-mariadb
    container_name: photoview-mariadb
    restart: unless-stopped
    stop_grace_period: 5s
    command: mariadbd --innodb-buffer-pool-size=512M --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
    security_opt: ## see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239
      - seccomp:unconfined
      - apparmor:unconfined
    environment:
      MARIADB_AUTO_UPGRADE: "1"
      MARIADB_DATABASE: photoview
      MARIADB_USER: photoview
      MARIADB_PASSWORD: << your random db password here >>
      MARIADB_ROOT_PASSWORD: << another random password here >>
    volumes:
      - "/etc/localtime:/etc/localtime:ro" ## use local time from host
      - "/etc/timezone:/etc/timezone:ro"   ## use timezone from host
      - "/data/daemons/photoview/database/mariadb:/var/lib/mysql" ## DO NOT REMOVE

networks:
  photoview-net: {}

You will need to setup some meaningful passwords for the database, and provide the proper paths.

Also generate your MapBox token (here).

Now pull the images:

su - photoview
podman compose pull

Reverse Proxy

I placed PhotoView on a subdomain, and here is the relevant NGINX config:

photoview.conf
server {
        server_name photos.mydomain.com;
        listen 443 ssl; 
        listen 8443 ssl; 

        access_log /var/log/nginx/photos.mydomain.com_access_log main;
        error_log /var/log/nginx/photos.mydomain.com_error_log info;

        location / {
                proxy_pass http://127.0.0.1:8009;
                proxy_redirect    default;
                proxy_set_header  Host $host;
                proxy_set_header  X-Real-IP $remote_addr;
                proxy_set_header  X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header  X-Forwarded-Host $server_name;
                proxy_set_header  X-Forwarded-Proto $scheme;
        }

        client_max_body_size 100M;
}

See The Reverse Proxy concept for more details

Autostart

To start it, and set it up on boot, as usual follow my indications Using Containers on Gentoo, so link the user-containers init script:

ln -s /etc/init.d/user-containers /etc/init.d/user-containers.photoview

and create the following config file:

/etc/conf.d/user-containers.photoview
USER=photoview
DESCRIPTION="The web gallery"

Add the service to the default runlevel and start it now:

rc-update add user-containers.photoview default
rc-service user-containers.photoview start