静看光阴荏苒
不管不顾不问不说也不念

PhotoPrism:功能强大的开源照片管理程序

photoprism是一个照片管理程序,从本质上说和chevereto这类图床程序相比是有很大区别的。

photoprism更适合用作个人的照片管理程序,如果你喜欢拍照,或者是摄影师,有这方面的需求,那就非常适合。

如果只是单纯的拿来上传一些图片,就有点大材小用了,因为这个程序里面很多功能你可能都用不上。

而且它比较吃配置,官方建议最低的配置是2C4G。如果关闭TensorFlow功能,也许2G内存也能运行。

下面我在甲骨文的arm上部署一下,系统是oraclelinux8。首先装需要用到的软件。

docker:

sudo dnf -y update
sudo dnf -y install dnf-plugins-core
sudo dnf config-manager \
     --add-repo \
     https://download.docker.com/linux/centos/docker-ce.repo
sudo dnf -y install docker-ce docker-ce-cli containerd.io
sudo systemctl enable --now docker
sudo usermod -aG docker opc

docker-compose:

sudo dnf -y install python3-devel
sudo dnf group install "Development Tools"
pip3 install docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose

nginx/certbot:

sudo dnf -y install oracle-epel-release-el8
sudo dnf config-manager --set-enabled ol8_developer_EPEL
sudo dnf -y install python3-certbot-nginx nginx
sudo systemctl enable --now nginx

selinux/防火墙:

sudo setsebool -P httpd_can_network_connect 1
sudo firewall-cmd --set-default-zone=trusted
sudo firewall-cmd --reload

新建一个compose:

nano docker-compose.yml

写入如下配置:

version: '3.5'

services:
  photoprism:
    image: photoprism/photoprism-arm64:latest
    container_name: photoprism
    restart: unless-stopped
    security_opt:
      - seccomp:unconfined
      - apparmor:unconfined
    ports:
      - 127.0.0.1:2342:2342
    environment:
      PHOTOPRISM_ADMIN_PASSWORD: "password"          # PLEASE CHANGE: Your initial admin password (min 4 characters)
      PHOTOPRISM_ORIGINALS_LIMIT: 5000               # File size limit for originals in MB (increase for high-res video)
      PHOTOPRISM_HTTP_COMPRESSION: "gzip"            # Improves transfer speed and bandwidth utilization (none or gzip)
      PHOTOPRISM_WORKERS: 2                          # Limits the number of indexing workers to reduce system load
      PHOTOPRISM_DEBUG: "false"                      # Run in debug mode (shows additional log messages)
      PHOTOPRISM_PUBLIC: "false"                     # No authentication required (disables password protection)
      PHOTOPRISM_READONLY: "false"                   # Don't modify originals directory (reduced functionality)
      PHOTOPRISM_EXPERIMENTAL: "true"                # Enables experimental features
      PHOTOPRISM_DISABLE_WEBDAV: "false"             # Disables built-in WebDAV server
      PHOTOPRISM_DISABLE_SETTINGS: "false"           # Disables Settings in Web UI
      PHOTOPRISM_DISABLE_TENSORFLOW: "false"         # Disables using TensorFlow for image classification
      PHOTOPRISM_DARKTABLE_PRESETS: "true"           # Enables Darktable presets and disables concurrent RAW conversion
      PHOTOPRISM_DETECT_NSFW: "false"                # Flag photos as private that MAY be offensive
      PHOTOPRISM_UPLOAD_NSFW: "true"                 # Allow uploads that MAY be offensive
      PHOTOPRISM_DATABASE_DRIVER: "mysql"            # Use MariaDB (or MySQL) instead of SQLite for improved performance
      PHOTOPRISM_DATABASE_SERVER: "mariadb:3306"     # MariaDB database server (hostname:port)
      PHOTOPRISM_DATABASE_NAME: "photoprism"         # MariaDB database schema name
      PHOTOPRISM_DATABASE_USER: "photoprism"         # MariaDB database user name
      PHOTOPRISM_DATABASE_PASSWORD: "password"       # MariaDB database user password
      PHOTOPRISM_SITE_URL: "https://photoprism.233.fi/"  # Public PhotoPrism URL
      PHOTOPRISM_SITE_TITLE: "PhotoPrism"
      PHOTOPRISM_SITE_CAPTION: "Browse Your Life"
      PHOTOPRISM_SITE_DESCRIPTION: ""
      PHOTOPRISM_SITE_AUTHOR: "imlala"
    volumes:
      - "~/Pictures:/photoprism/originals"
      - "./storage:/photoprism/storage"

  mariadb:
    image: arm64v8/mariadb:10.5
    container_name: mariadb
    restart: unless-stopped
    security_opt:
      - seccomp:unconfined
      - apparmor:unconfined
    command: mysqld --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=50
    volumes:
      - "./database:/var/lib/mysql"
    environment:
      MYSQL_ROOT_PASSWORD: password
      MYSQL_DATABASE: photoprism
      MYSQL_USER: photoprism
      MYSQL_PASSWORD: password

有几个环境变量需要自行更改:

PHOTOPRISM_ADMIN_PASSWORD
PHOTOPRISM_DATABASE_PASSWORD
PHOTOPRISM_SITE_URL
MYSQL_ROOT_PASSWORD
MYSQL_PASSWORD

启动即可:

docker-compose up -d

配置反向代理,新建站点配置文件:

sudo nano /etc/nginx/conf.d/photoprism.conf

写入如下配置:

server {
    listen 80;
    server_name photoprism.233.fi;
    client_max_body_size 0;

    location / {
        proxy_pass http://127.0.0.1:2342;
       	proxy_buffering off;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
       	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

申请ssl证书:

sudo certbot --nginx

以上是针对arm平台的部署过程,compose的文件来自:https://dl.photoprism.org/docker/arm64/docker-compose.yml。我自己根据官方的模板修改了一点配置。

如果是x86可以用这个模板:https://dl.photoprism.org/docker/docker-compose.yml

所有可用的环境变量:https://docs.photoprism.org/getting-started/config-options/

当有新版本需要更新的时候,可以手动更新:

docker-compose pull photoprism
docker-compose stop photoprism
docker-compose up -d photoprism

也可以利用watchtower来实现自动更新,将下面的配置加到compose文件内:

services:
  watchtower:
    image: containrrr/watchtower
    restart: unless-stopped
    environment:
      WATCHTOWER_CLEANUP: "true"
      WATCHTOWER_POLL_INTERVAL: 7200
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"

预览:

赞(2)
未经允许不得转载:荒岛 » PhotoPrism:功能强大的开源照片管理程序
分享到: 更多 (0)

评论 2

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #1

    一直在等拉拉更新 :mrgreen:

    Dmesg3年前 (2021-09-07) Microsoft Edge 93.0.961.38 Microsoft Edge 93.0.961.38 Windows 10 x64 Edition Windows 10 x64 Edition回复

分享创造快乐

广告合作资源投稿