User Tools

This is an old revision of the document!


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

See my Using Containers on Gentoo and create the following link:

and configuration file:

This website uses technical cookies only. No information is shared with anybody or used in any way but provide the website in your browser.

More information