首页 > 其他分享 >photoprism+rclone搭建

photoprism+rclone搭建

时间:2023-06-04 15:24:48浏览次数:49  
标签:rclone PHOTOPRISM dev https photoprism docker 搭建

vps空间小,所以使用onedrive为例作为存储来搭建 photoprism

主要分为以下几步:

  1. 使用rclone挂载onedrive
  2. 部署photoprism

获得rclone.conf

首先在本地电脑上安装rclone

然后运行 rclone config

参照 https://rclone.org/onedrive/ 进行远程配置

然后配置完成后,~/.config/rclone/rclone.conf 内容类似

[onedrive]
type = myonedrive
token = {"access_token":"EwCAA8l6BA1","token_type":"Bearer","refresh_token":"M.C106eExJ7edYrxNdb3","expiry":"2023-06-03T16:20:11.7705715+08:00"}
drive_id = 19fe142286d457
drive_type = personal

docker plugin rclone配置

可按照下面,或者参见 https://rclone.org/docker/

首先创建两个文件夹

sudo mkdir -p /var/lib/docker-plugins/rclone/config
sudo mkdir -p /var/lib/docker-plugins/rclone/cache

然后安装 docker 插件 rclone

docker plugin install rclone/docker-volume-rclone:latest args="-v" --alias rclone --grant-all-permissions

然后将上面在本地电脑上生成的 rclone.conf 内容拷贝到 vps 的 /var/lib/docker-plugins/rclone/config/rclone.conf 文件中

部署 photoprism

docker-compose.yml

version: '3.5'

# 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:preview
    container_name: photoprism
    ## 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
    security_opt:
      - seccomp:unconfined
      - apparmor:unconfined
    ports:
      - "12342:2342" # HTTP port (host:container)
    environment:
      PHOTOPRISM_ADMIN_USER: "admin"                 # 管理员登陆用户名
      PHOTOPRISM_ADMIN_PASSWORD: "密码"              # 管理员密码
      PHOTOPRISM_AUTH_MODE: "password"               # authentication mode (public, password)
      PHOTOPRISM_SITE_URL: "http://photoprism.me:12342/"  # 服务器url,格式: "http(s)://domain.name(:port)/(path)"
      PHOTOPRISM_ORIGINALS_LIMIT: 5000               # 文件大小限制 MB (increase for high-res video)
      PHOTOPRISM_HTTP_COMPRESSION: "gzip"            # improves transfer speed and bandwidth utilization (none or gzip)
      PHOTOPRISM_LOG_LEVEL: "info"                   # 日志等级: trace, debug, info, warning, error, fatal, or panic
      PHOTOPRISM_READONLY: "false"                   # do not modify originals directory (reduced functionality)
      PHOTOPRISM_EXPERIMENTAL: "true"               # 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_SITE_CAPTION: ""
      PHOTOPRISM_SITE_DESCRIPTION: ""                # meta site description
      PHOTOPRISM_SITE_AUTHOR: ""                     # meta site author
      ## Run/install on first startup (options: update https gpu tensorflow davfs clitools clean):
      # PHOTOPRISM_INIT: "https gpu tensorflow"
      ## Hardware Video Transcoding:
      # PHOTOPRISM_FFMPEG_ENCODER: "software"        # FFmpeg encoder ("software", "intel", "nvidia", "apple", "raspberry")
      # PHOTOPRISM_FFMPEG_BITRATE: "32"              # FFmpeg encoding bitrate limit in Mbit/s (default: 50)
      ## 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
      - "onedrive_photos:/photoprism/originals"               # Original media files (DO NOT REMOVE)
      # - "/example/family:/photoprism/originals/family" # *Additional* media folders can be mounted like this
      # - "photoprism_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)

  ## 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

volumes:                               #储存卷配置:
  onedrive_photos:                     #卷名 onedrive_photos
    driver: rclone                     #磁盘名 rclone
    driver_opts:                       #磁盘配置
      remote: onedrive:/图片/本机照片   #同步 onedrive 下 /图片/本机照片 文件
      allow_other: 'true'              #类似rclone mount配置
      vfs_cache_mode: full             #类似rclone mount配置

如果你不需要自动更新photoprism版本,你可以去除 watchtower 的容器

一般onedrive默认情况下备份相册照片到 /图片/本机照片 ,如果你有更改过,可以换成你更改的文件夹路径

然后使用 docker compose up -d 启动

访问在 docker-compose.yml 中定义的服务器url即可

上传图片的话,可以使用 photosync(官方推荐) 或者使用 syncthing,或者直接使用 onedrive 的同步功能

photosync是通过webdav功能来同步,photoprism只有当使用webdav同步时才会触发索引,所以syncthing或onedrive的同步都没法自动索引

所以需要手动使用命令进行触发,可以使用 crontab 来定时同步

crontab -e
# 设置每天晚上1点自动导入
0 1 * * * /usr/bin/docker exec photoprism photoprism index

或者你可以使用 syncthing + https://github.com/signalkraft/photoprism-syncthing-indexer 来自动索引

参考

自建云相册PhotoPrism

Docker Volume Plugin

在Docker中使用Rclone作为储存卷

Microsoft OneDrive

Syncthing and photoprism

标签:rclone,PHOTOPRISM,dev,https,photoprism,docker,搭建
From: https://www.cnblogs.com/Akkuman/p/17455704.html

相关文章

  • 2. 搭建Mybatis
    确认开发环境​MySQL不同版本的注意事项1、驱动类driver-class-nameMySQL5版本使用jdbc5驱动,驱动类使用:com.mysql.jdbc.DriverMySQL8版本使用jdbc8驱动,驱动类使用:com.mysql.cj.jdbc.Driver2、连接地址urlMySQL5版本的url:jdbc:mysql://localhost:3306/ssmMySQL8版......
  • 使用Apache Archiva搭建Maven Repository Server
    经过这两天的研究,对比SonatypeNexus和ApacheArchiva,觉得ApacheArchiva还不错,配置简单,好用。以下是配置ApacheArchiva的具体步骤ApacheArchiva有两种模式,独立的RepositoryServer和依附于AppServer的war文件。下面分别介绍1.Standalone安装模式(WindowXP,其他操作系统......
  • 搭建Hibernate日志-log4jdbc
    官方:[url]https://code.google.com/p/log4jdbc/[/url]log4jdbc分析sql性能[url]http://hongliangpan.iteye.com/blog/1088398[/url]xml配置方法:log4jdbc日志框架介绍[url]http://blog.sina.com.cn/s/blog_57769b7b0101m1il.html[/url][url]http://xia......
  • C语言gcc编译环境搭建
     第一步,根据以下链接下载gcc工具包;gcc工具包下载地址:链接:https://pan.baidu.com/s/1JqEjakTcWLPv7p6zkah6sA提取码:k4d2第二步,将下载好的工具包解压到本地;第三步,找到gcc工具包目录下的bin文件夹所在的目录,将该路径添加到系统的环境变量中; 第四步,打开CMD,输入gcc,,验证......
  • 设置和使用DragGAN:搭建非官方的演示版
    DragGAN的官方版还没有发布,但是已经有非官方版的实现了,我们看看如何使用。DragGAN不仅让GAN重新回到竞争轨道上,而且为GAN图像处理开辟了新的可能性。正式版本将于本月发布。但是现在已经可以在一个非官方的演示中试用这个新工具了完整文章https://avoid.overfit.cn/post/27e2fa......
  • stm32环境搭建及驱动安装
    1.安装MDK江协科技提供的资料(KeilMDK)解压后目录2.一路next(注:如果以前安装过c51,可直接选择keil文件目录)3.MDK安装完成后提示安装调试器4.离线安装stm32支持包,文件在支持包目录下6.激活MDK软件6.1以管理员身份运行keil56.2File->License目录下复制ComputerID6.3......
  • 搭建一个属于自己的springboot项目
    一、确定环境最近公司要上个新系统,指定由我来带两个人进行开发,既然是新项目,那么项目搭建的事就落到我的头上了。现在都是使用springboot进行开发,为此我搭环境使用的是springboot,具体java环境如下,使用springboot的版本是2.3.3.RELEASE。使用maven进行项目管理,总结下,我使用到的......
  • 从0搭建Vue3组件库(十三):引入Husky规范git提交
    为什么要引入husky?虽然我们项目中引入了prettier和eslint对代码格式进行了校验,但是多人开发的时候难免依然会有人提交不符合规范的代码到仓库中,如果我们拉取到这种代码还得慢慢对其进行修改,这是一件很麻烦的事情,同时也为了避免团队成员提交五花八门message,因此我们可以引......
  • vbox和vmware靶机搭建
    靶机:vmbox  kali:vmware首先在VMware上虚拟网络编辑器中选中一个虚拟网络选择桥接模式,桥接到virtualbox的虚拟网卡上。打开kali的虚拟机设置,自定义网络里面,选中网络适配器选择刚刚桥接到virtualbox的网络,注意最好再加一块网卡选择NAT模式的网络连接外网。virtualbox(我是6.1版......
  • 开发环境搭建/练习环境搭建
    安装jdk和mvn首先看下是否安装:mvn\java用命令:mvn-v回车查看maven是否安装(我这是已经装了)没装的话是这样式儿的用命令java查看jdk是否安装(我这还是已经装了)没装是这样式儿的没装的话,去安装,首先双击jdk,点下一步进行操作即可安装之后,打开环境变量配置文档右键此电脑-属性点击高级系......