一、简介
PhotoPrism® 是一款由人工智能驱动的应用程序,用于浏览、组织和分享您的照片集。它利用最新技术自动标记和查找图片。您可以在家里、私人服务器或云端运行它。

图片[1]-使用Docker搭建PhotoPrism同时挂载外部webdav当存储 – 打造基于AI私有化的个人相册系统-www.88531.cn资享网

PhotoPrism对很多设备提供了支持,包括Mac, Linux, Windows, DigitalOcean, Raspberry Pi, FreeBSD, 以及 NAS devices 。安装方面官方推荐使用Docker Compose进行安装。

二、功能概述
• 浏览你所有的照片和视频而不用担心格式转换,重复或视频格式问题
• 轻松地找到特定的图片查看具备强大的搜索过滤器
• 认识到你的家人和朋友的面孔(面部识别)
• 自动分类基于内容的图片和位置
• 将鼠标悬停在照片上面显示各种照片信息
• 实用好看的的WebUI界面,提供了自适配方案,您可以方便地在所有主流操作系统和移动设备查看你的照片
• 包括四个高分辨率的世界地图,带你回忆你最喜欢的旅行
• 元数据提取和合并Exif,XMP和其他来源,如谷歌照片
• 更多的图像属性颜色,浓度,质量供搜索
• 使用PhotoSync在后台安全地备份,有iOS和Android双端APP
• WebDAV服务,如微软的Windows Explorer和苹果的finder,可以直接连接PhotoPrism,允许您打开、编辑和删除文件,或者直接下载到本地

官网地址:https://docs.photoprism.app/

官方Demo地址:https://demo-zh.photoprism.app/

三、系统要求
根据官方建议CPU选项最少2核,内存选项最少4GB,如果服务器内存的交换空间小于4GB可能导致意外重启。

下图为虚拟机设定参数,设定量可根据宿主机配置灵活分配。

图片[2]-使用Docker搭建PhotoPrism同时挂载外部webdav当存储 – 打造基于AI私有化的个人相册系统-www.88531.cn资享网

由于我的服务器最大为6核,所以我这里设定为6核

图片[3]-使用Docker搭建PhotoPrism同时挂载外部webdav当存储 – 打造基于AI私有化的个人相册系统-www.88531.cn资享网

四、安装环境
系统:CentOS 7
服务器IP:192.168.50.101
域名:www.example.com

五、使用Docker Compose进行安装
借助Docker Compose,您可以使用 YAML 文件 来配置所有应用程序服务,这样您就可以轻松地使用单个命令启动它们。在继续之前,请确保您的系统上安装了Docker (Linux安装Docker教程)。

1、创建工作目录
mkdir -p /mnt/docker-volumes/photopris

 

2、切换到工作目录
cd /mnt/docker-volumes/photoprism

 

3、下载官方docker-compose.yml示例
wget https://dl.photoprism.app/docker/docker-compose.yml

4、配置调整
PhotoPrism环境变量说明
变量 说明
PHOTOPRISM_ADMIN_USER 网页登录用户名
PHOTOPRISM_ADMIN_PASSWORD 网页登录密码
PHOTOPRISM_SITE_URL 网页访问地址
PHOTOPRISM_DATABASE_DRIVER 数据库驱动
PHOTOPRISM_DATABASE_SERVER 数据库主机IP及端口
PHOTOPRISM_DATABASE_NAME 数据库名称
PHOTOPRISM_DATABASE_USER 数据库用户名
PHOTOPRISM_DATABASE_PASSWORD 数据库密码
PhotoPrism卷挂载说明
容器目录 说明
/photoprism/originals 存放照片目录
/photoprism/storage 存放配置
/photoprism/import 导入文件目录
MariaDB环境变量说明
变量 说明
MARIADB_DATABASE 数据库名称
MARIADB_USER 数据库用户名
MARIADB_PASSWORD 数据库密码
MARIADB_ROOT_PASSWORD root密码
MariaDB卷挂载说明
容器目录 说明
/var/lib/mysql 数据库存放目录

 

调整后的docker-compose.yml内容如下:

# Example Docker Compose config file for PhotoPrism (Linux / AMD64)
#
# Note:
# - Running PhotoPrism on a server with less than 4 GB of swap space or setting a memory/swap limit can cause unexpected
#   restarts ("crashes"), for example, when the indexer temporarily needs more memory to process large files.
# - If you install PhotoPrism on a public server outside your home network, please always run it behind a secure
#   HTTPS reverse proxy such as Traefik or Caddy. Your files and passwords will otherwise be transmitted
#   in clear text and can be intercepted by anyone, including your provider, hackers, and governments:
#   https://docs.photoprism.app/getting-started/proxies/traefik/
#
# Setup Guides:
# - https://docs.photoprism.app/getting-started/docker-compose/
# - https://docs.photoprism.app/getting-started/raspberry-pi/
# - https://www.photoprism.app/kb/activation
#
# Troubleshooting Checklists:
# - https://docs.photoprism.app/getting-started/troubleshooting/
# - https://docs.photoprism.app/getting-started/troubleshooting/docker/
# - https://docs.photoprism.app/getting-started/troubleshooting/mariadb/
#
# CLI Commands:
# - https://docs.photoprism.app/getting-started/docker-compose/#command-line-interface
#
# All commands may have to be prefixed with "sudo" when not running as root.
# This will point the home directory shortcut ~ to /root in volume mounts.

services:
  photoprism:
    ## Use photoprism/photoprism:preview for testing preview builds:
    image: photoprism/photoprism:latest
    ## Don't enable automatic restarts until PhotoPrism has been properly configured and tested!
    ## If the service gets stuck in a restart loop, this points to a memory, filesystem, network, or database issue:
    ## https://docs.photoprism.app/getting-started/troubleshooting/#fatal-server-errors
    # restart: unless-stopped
    stop_grace_period: 10s
    depends_on:
      - mariadb
    security_opt:
      - seccomp:unconfined
      - apparmor:unconfined
    ## Server port mapping in the format "Host:Container". To use a different port, change the host port on
    ## the left-hand side and keep the container port, e.g. "80:2342" (for HTTP) or "443:2342 (for HTTPS):
    ports:
      - "2342:2342"
    ## Before you start the service, please check the following config options (and change them as needed):
    ## https://docs.photoprism.app/getting-started/config-options/
    environment:
      PHOTOPRISM_ADMIN_USER: "admin"                 # admin login username
      PHOTOPRISM_ADMIN_PASSWORD: "*********"          # initial admin password (8-72 characters)  登录密码
      PHOTOPRISM_AUTH_MODE: "password"               # authentication mode (public, password)
      PHOTOPRISM_SITE_URL: "http://192.168.2.25:2342/"  # server URL in the format "http(s)://domain.name(:port)/(path)"    访问地址+端口
      PHOTOPRISM_DISABLE_TLS: "false"                # disables HTTPS/TLS even if the site URL starts with https:// and a certificate is available
      PHOTOPRISM_DEFAULT_TLS: "true"                 # defaults to a self-signed HTTPS/TLS certificate if no other certificate is available
      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_LOG_LEVEL: "info"                   # log level: trace, debug, info, warning, error, fatal, or panic
      PHOTOPRISM_READONLY: "false"                   # do not modify originals directory (reduced functionality)
      PHOTOPRISM_EXPERIMENTAL: "false"               # enables experimental features
      PHOTOPRISM_DISABLE_CHOWN: "false"              # disables updating storage permissions via chmod and chown on startup
      PHOTOPRISM_DISABLE_WEBDAV: "false"             # disables built-in WebDAV server
      PHOTOPRISM_DISABLE_SETTINGS: "false"           # disables settings UI and API
      PHOTOPRISM_DISABLE_TENSORFLOW: "false"         # disables all features depending on TensorFlow
      PHOTOPRISM_DISABLE_FACES: "false"              # disables face detection and recognition (requires TensorFlow)
      PHOTOPRISM_DISABLE_CLASSIFICATION: "false"     # disables image classification (requires TensorFlow)
      PHOTOPRISM_DISABLE_VECTORS: "false"            # disables vector graphics support
      PHOTOPRISM_DISABLE_RAW: "false"                # disables indexing and conversion of RAW images
      PHOTOPRISM_RAW_PRESETS: "false"                # enables applying user presets when converting RAW images (reduces performance)
      PHOTOPRISM_JPEG_QUALITY: 85                    # a higher value increases the quality and file size of JPEG images and thumbnails (25-100)
      PHOTOPRISM_DETECT_NSFW: "false"                # automatically flags photos as private that MAY be offensive (requires TensorFlow)
      PHOTOPRISM_UPLOAD_NSFW: "true"                 # allows uploads that MAY be offensive (no effect without TensorFlow)
      # PHOTOPRISM_DATABASE_DRIVER: "sqlite"         # SQLite is an embedded database that doesn't require a server
      PHOTOPRISM_DATABASE_DRIVER: "mysql"            # use MariaDB 10.5+ or MySQL 8+ instead of SQLite for improved performance
      PHOTOPRISM_DATABASE_SERVER: "mariadb:3306"     # MariaDB or MySQL database server (hostname:port)
      PHOTOPRISM_DATABASE_NAME: "photoprism"         # MariaDB or MySQL database schema name
      PHOTOPRISM_DATABASE_USER: "photoprism"         # MariaDB or MySQL database user name
      PHOTOPRISM_DATABASE_PASSWORD: "insecure"       # MariaDB or MySQL database user password
      PHOTOPRISM_SITE_CAPTION: "AI-Powered Photos App"
      PHOTOPRISM_SITE_DESCRIPTION: ""                # meta site description
      PHOTOPRISM_SITE_AUTHOR: ""                     # meta site author
      ## Video Transcoding (https://docs.photoprism.app/getting-started/advanced/transcoding/):
      # PHOTOPRISM_FFMPEG_ENCODER: "software"        # H.264/AVC encoder (software, intel, nvidia, apple, raspberry, or vaapi)
      # PHOTOPRISM_FFMPEG_SIZE: "1920"               # video size limit in pixels (720-7680) (default: 3840)
      # PHOTOPRISM_FFMPEG_BITRATE: "32"              # video bitrate limit in Mbit/s (default: 50)
      ## Run/install on first startup (options: update https gpu tensorflow davfs clitools clean):
      # PHOTOPRISM_INIT: "https gpu tensorflow"
      ## Run as a non-root user after initialization (supported: 0, 33, 50-99, 500-600, and 900-1200):
      # PHOTOPRISM_UID: 1000
      # PHOTOPRISM_GID: 1000
      # PHOTOPRISM_UMASK: 0000
    ## Start as non-root user before initialization (supported: 0, 33, 50-99, 500-600, and 900-1200):
    # user: "1000:1000"
    ## Share hardware devices with FFmpeg and TensorFlow (optional):
    # devices:
    #  - "/dev/dri:/dev/dri"                         # Intel QSV
    #  - "/dev/nvidia0:/dev/nvidia0"                 # Nvidia CUDA
    #  - "/dev/nvidiactl:/dev/nvidiactl"
    #  - "/dev/nvidia-modeset:/dev/nvidia-modeset"
    #  - "/dev/nvidia-nvswitchctl:/dev/nvidia-nvswitchctl"
    #  - "/dev/nvidia-uvm:/dev/nvidia-uvm"
    #  - "/dev/nvidia-uvm-tools:/dev/nvidia-uvm-tools"
    #  - "/dev/video11:/dev/video11"                 # Video4Linux Video Encode Device (h264_v4l2m2m)
    working_dir: "/photoprism" # do not change or remove
    ## Storage Folders: "~" is a shortcut for your home directory, "." for the current directory
    volumes:
      # "/host/folder:/photoprism/folder"                # Example
      - "/j2900_alist:/photoprism/originals"               # /j2900_alist   是挂载的存储
      # - "/example/family:/photoprism/originals/family" # *Additional* media folders can be mounted like this
      # - "~/Import:/photoprism/import"                  # *Optional* base folder from which files can be imported to originals
      - "./storage:/photoprism/storage"                  # *Writable* storage folder for cache, database, and sidecar files (DO NOT REMOVE)

  ## Database Server (recommended)
  ## see https://docs.photoprism.app/getting-started/faq/#should-i-use-sqlite-mariadb-or-mysql
  mariadb:
    image: mariadb:11
    ## If MariaDB gets stuck in a restart loop, this points to a memory or filesystem issue:
    ## https://docs.photoprism.app/getting-started/troubleshooting/#fatal-server-errors
    restart: unless-stopped
    stop_grace_period: 5s
    security_opt: # see https://github.com/MariaDB/mariadb-docker/issues/434#issuecomment-1136151239
      - seccomp:unconfined
      - apparmor:unconfined
    command: --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
    ## Never store database files on an unreliable device such as a USB flash drive, an SD card, or a shared network folder:
    volumes:
      - "./database:/var/lib/mysql" # DO NOT REMOVE
    environment:
      MARIADB_AUTO_UPGRADE: "1"
      MARIADB_INITDB_SKIP_TZINFO: "1"
      MARIADB_DATABASE: "photoprism"
      MARIADB_USER: "photoprism"
      MARIADB_PASSWORD: "insecure"
      MARIADB_ROOT_PASSWORD: "insecure"

  ## Watchtower upgrades services automatically (optional)
  ## see https://docs.photoprism.app/getting-started/updates/#watchtower
  ## activate via "COMPOSE_PROFILES=update docker compose up -d"
  watchtower:
    restart: unless-stopped
    image: containrrr/watchtower
    profiles: ["update"]
    environment:
      WATCHTOWER_CLEANUP: "true"
      WATCHTOWER_POLL_INTERVAL: 7200 # checks for updates every two hours
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock"
      - "~/.docker/config.json:/config.json" # optional, for authentication if you have a Docker Hub account

 

 

5、启动容器
docker-compose up -d

 

6、访问服务
http://www.example.com:2342

7、挂载外部webdav当存储

linux宝塔面板利用davfs2自动挂载alist的 webdav做本地存储 无需输入密码充当网站附件盘

账号为 admin,密码就是我们在 PHOTOPRISM_ADMIN_PASSWORD 中设置的值

图片[4]-使用Docker搭建PhotoPrism同时挂载外部webdav当存储 – 打造基于AI私有化的个人相册系统-www.88531.cn资享网

登录成功后进入主界面,此时还未上传图片,所以主界面是空的

图片[5]-使用Docker搭建PhotoPrism同时挂载外部webdav当存储 – 打造基于AI私有化的个人相册系统-www.88531.cn资享网

设置中文

左侧菜单 settings –> GENERAL –> Language 中下拉找到 简体中文

图片[6]-使用Docker搭建PhotoPrism同时挂载外部webdav当存储 – 打造基于AI私有化的个人相册系统-www.88531.cn资享网

界面会自动刷新

图片[7]-使用Docker搭建PhotoPrism同时挂载外部webdav当存储 – 打造基于AI私有化的个人相册系统-www.88531.cn资享网

六、备份与同步
使用 PhotoSync 在后台安全地备份 iOS 和 Android 手机。Microsoft 的 Windows Explorer 和 Apple 的 Finder 等 WebDAV 客户端可以直接连接到 PhotoPrism,让您可以像在本地一样打开、编辑和删除计算机中的文件。

1、下载手机应用PhotoSync

图片[8]-使用Docker搭建PhotoPrism同时挂载外部webdav当存储 – 打造基于AI私有化的个人相册系统-www.88531.cn资享网

2、配置PhotoPrism

图片[9]-使用Docker搭建PhotoPrism同时挂载外部webdav当存储 – 打造基于AI私有化的个人相册系统-www.88531.cn资享网

3、输入服务器信息

图片[10]-使用Docker搭建PhotoPrism同时挂载外部webdav当存储 – 打造基于AI私有化的个人相册系统-www.88531.cn资享网

配置完成后在APP首页点击右上角 “同步” 按钮,即可开始同步手机照片到服务器。

图片[11]-使用Docker搭建PhotoPrism同时挂载外部webdav当存储 – 打造基于AI私有化的个人相册系统-www.88531.cn资享网

来源地址:使用Docker搭建PhotoPrism同时挂载外部webdav当存储 - 打造基于AI私有化的个人相册系统

转载声明:本站文章若无特别说明,皆为原创,转载请注明来源:www.88531.cn资享网,谢谢!^^

© 版权声明