sonicrang / utterances

wurang.net comment
0 stars 0 forks source link

自建云相册PhotoPrism - Rang's Note #15

Open utterances-bot opened 2 years ago

utterances-bot commented 2 years ago

自建云相册PhotoPrism - Rang's Note

前言记得我是2016年开始用Office365,家庭版一年229,6个人拼车,人均40。除了可以畅享正版Office外,还有1T的OneDrive空间。从那时候开始,就把存放在电脑里10多年的老照片都放到了OneDrive里。此外使用OneDrive的APP,还可以把手机里面的照片同步到OneDrive上。最重要的是,OneDrive提供了基

https://wurang.net/photoprism/

sonicrang commented 2 years ago

Comment written by xwah on 2021-08-09 12:25:45 感谢博主这么好的解决方案。 这两个地方要用绝对地址,不然一直失败。 ExecStart=rclone --vfs-cache-mode full mount onedrive:/photoprism /mnt/onedrive/originals

ExecStart=rclone --vfs-cache-mode full mount onedrive:/camera /mnt/onedrive/import

更新为 /usr/bin/rclone

sonicrang commented 2 years ago

Comment written by sonicrang on 2021-08-09 12:37:51 哈,因为我有环境变量了。不过是写绝对路径更靠谱。

sonicrang commented 2 years ago

Comment written by xwah on 2021-08-09 14:55:32 再请教您一个小问题。(摸索了三个钟解决不了)。
import文件夹有,但触发不了originals,那个文件夹是空的

sonicrang commented 2 years ago

Comment written by sonicrang on 2021-08-09 23:55:31 没太明白,是说import文件夹没有触发导入么

sonicrang commented 2 years ago

Comment written by xwah on 2021-08-10 15:13:41 是的。originals文件夹里面是空的。 这个服务rclone-originals没触发

sonicrang commented 2 years ago

Comment written by sonicrang on 2021-08-10 23:58:28 可能是有报错,把这个服务停了,直接用execstart后面的命令跑一下,看看能不能挂载成功,touch一个新文件,在onedrive上能看到就可以了。手动挂载成功后再用服务的方式试

sonicrang commented 2 years ago

目前photoprism镜像的photoprism 路径变成了/opt/photoprism/bin/photoprism,所以定时任务应修改为/opt/photoprism/bin/photoprism import

anthonyhan commented 2 years ago

谢谢博主的实践方案!请问你如何解决多用户的问题,我查了一下 PhotoPrism目前不支持多用户,有什么好的方案吗?

sonicrang commented 2 years ago

@anthonyhan 我这边没有多租户的需求,从import、gallery文件目录看上去应该是没办法做多租户,可以考虑多实例部署,虽然真的不优雅

Igloo302 commented 2 years ago

博主的这套方案很不错,补充一个可能的问题: Onedrive不支持Live photo的同步,而PhotoSync目前已经支持直接同步到PhotoPrism,且支持Live Photo,可能是更方便的方案

sihai2933 commented 2 years ago

感谢博主提供的方案,在第4步启动服务后查看服务运行状况systemctl status rclone-originals,出现如下报错: ● rclone-originals.service - Rclone Loaded: loaded (/etc/systemd/system/rclone-originals.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Fri 2022-07-01 18:31:45 CST; 14s ago Process: 1911150 ExecStart=/usr/bin/rclone --vfs-cache-mode full mount /usr/local/onedrive/photoprism /mnt/onedrive/originals # 在OneDrive下新建一个文件> Main PID: 1911150 (code=exited, status=1/FAILURE)

请教是哪里出了问题呢?

sihai2933 commented 2 years ago

同时在操作第6步索引历史数据时,也没有把存在onedrive里对应文件夹下已有的图片索引出来

sonicrang commented 2 years ago

@sihai2933 手动执行下ExecStart里面的命令看看有报错么

sonicrang commented 2 years ago

@Igloo302 感谢告知,我记得onedrive可以上传livephoto吧

sihai2933 commented 2 years ago

在执行第6步索引历史数据时,手动操作点导入后无反应,无图片;命令行操作报如下错误: Error: No such container: photoprism_photoprism_1 请教是什么原因?

sonicrang commented 2 years ago

@sihai2933 docker ps | grep photoprism 看下你容器名叫啥,我这里没指定,默认是photoprism_photoprism_1

sihai2933 commented 2 years ago

5199a3db7d4f photoprism/photoprism:preview "/scripts/entrypoint…" 40 hours ago Up 40 hours 0.0.0.0:2342->2342/tcp, :::2342->2342/tcp photoprism-photoprism-1 98638c866d45 mariadb:10.5 "docker-entrypoint.s…" 2 days ago Up 2 days 3306/tcp photoprism-mariadb-1 dd97ba1d3607 containrrr/watchtower "/watchtower" 2 days ago Up 2 days 8080/tcp photoprism-watchtower-1

sonicrang commented 2 years ago

@sihai2933 photoprism-photoprism-1是中划线

sihai2933 commented 2 years ago

第6步命令行换成中划线后执行,又这个提示: OCI runtime exec failed: exec failed: unable to start container process: exec: "/photoprism/bin/photoprism": stat /photoprism/bin/photoprism: no such file or directory: unknown

sonicrang commented 2 years ago

@sihai2933 进容器看下路径 docker exec -it photoprism-photoprism-1 which photoprism

sihai2933 commented 2 years ago

感谢大佬,搞定了

sihai2933 commented 2 years ago

直接执行挂载命令rclone --vfs-cache-mode full mount onedrive:/camera /mnt/onedrive/import 报如下错误: Fatal error: Directory already mounted, use --allow-non-empty to mount anyway: /mnt/onedrive/import 请教是什么原因呢?

sonicrang commented 2 years ago

@sihai2933 如果你的服务已经挂载了目录,单独执行命令肯定会提示已挂载,可以去/mnt/onedrive/import 目录下看看是否有onedrive上的文件,看看你的服务状态是不是正常: systemctl status rclone-originals systemctl status rclone-import

sihai2933 commented 2 years ago

找到原因了,之前挂载过其他目录,取消了之前的挂载后重新挂载解决了

sihai2933 commented 2 years ago

在另外一台debain11的机子上安装,执行第4步启动服务时,单独执行rclone --vfs-cache-mode full mount onedrive:/camera /mnt/onedrive/import是正常的,并可正常挂载,但启动服务systemctl start rclone-import后查看状态systemctl status rclone-import,却显示失败,如下报错,请问是什么原因呢?

root@arm1:~# systemctl start rclone-import root@arm1:~# systemctl status rclone-import ● rclone-import.service Loaded: loaded (/etc/systemd/system/rclone-import.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Fri 2022-08-12 11:39:19 CST; 3s ago Process: 212935 ExecStart=/usr/bin/rclone --vfs-cache-mode full mount onedrive:/camera /mnt/onedrive/import (code=exited, status=1/FAILURE) Main PID: 212935 (code=exited, status=1/FAILURE) CPU: 53ms

sihai2933 commented 2 years ago

单独执行/usr/bin/rclone --vfs-cache-mode full mount onedrive:/camera /mnt/onedrive/import也正常挂载,好奇怪。

sonicrang commented 2 years ago

@sihai2933 没看到后面的错误原因,你是不是手动执行后没umount

sihai2933 commented 2 years ago

果然是这个原因,搞定了,谢谢

Jacksgong commented 2 years ago

弱弱的说下,既然支持webdav同步,可以考虑实用filerun、cloudreve甚至nextcloud/owncloud等等。。。就不用再考虑oneDrive之类的付费方案了,自己搞个nas或者用轻量服务器也行..

sagcan commented 1 year ago

immich.app,目前最好的方案。手机端备份以及多用户都没问题

VSchicksal commented 9 months ago

十分感谢博主的方案!我想尝试第一个,其中有个很在意的点是“对象存储最好和轻量服务器同一个区域”这具体来讲是什么意思?

sonicrang commented 9 months ago

@VSchicksal 同区域对象存储和服务器可以走内网上传,免去对象存储公网流量费

VSchicksal commented 9 months ago

@sonicrang 嗯我明白 我的意思是怎么做才能确保oss和photoprism的服务器是同一区域的?

sonicrang commented 9 months ago

@VSchicksal 买轻量和对象存储时选同一个区域就行啊

VSchicksal commented 9 months ago

@sonicrang 服务器不在阿里云就没办法对吧