photoprism初体验
背景
photoprism是一个AI驱动的照片管理工具。其基于go和TensorFlow开发,支持人脸识别、元数据提取和强大的搜索。[1]
photoprism保证不会分享个人隐私信息给Google, Amazon, Microsoft or Apple公司。[2]
docker compose初体验
官方推荐使用docker compose的方式,部署在自己私有的服务器上,支持Mac、Linux和Windows环境。[3]
系统要求
硬件:2核,3GB物理内存,64位操作系统。推荐使用SSD硬盘。
数据库:MariaDB 10.5.12+ (推荐), SQLite 3。
浏览器:支持PWA的浏览器,如Chrome、Safari、Firefox和Edge。
docker compose安装
wget https://dl.photoprism.app/docker/docker-compose.yml
数据库配置
默认配置了MariaDB数据库。如果把MariaDB配置去掉了,则会使用SQLite配置。
存储配置
volumes:
# "/host/folder:/photoprism/folder" # example
- "~/Pictures:/photoprism/originals"
表示将宿主机上的/photoprism/originals
目录,映射到容器内的~/Pictures
目录下。
也可以使用多个存储位置,示例如下:
volumes:
- "/home/username/Pictures:/photoprism/originals"
- "/home/note/Pictures:/photoprism/originals/note"
下面三个位置,保存了全部的数据。
- storage目录:配置文件
- originals目录:原始图片
- 数据库:
配置文件
/photoprism/storage
中,默认会保存SQLite、config、cache、thumbnail和sidecar文件。
启动服务
docker compose up -d
watchtower可以自动更新正在运行的docker容器,是一个可选项。尝试时遇到点问题,先注释掉。
访问服务
http://local:2342
默认用户名:admin
默认密码:PHOTOPRISM_ADMIN_PASSWORD
的值,默认为insecure
设置中文界面:Settings -> Language -> English 转为 简体中文。
照片导入
将照片导入宿主机目录中:/home/username/Pictures
。
更多用法见 [4]。
其它
- 进入容器中
docker compose exec photoprism bash
- 重新索引全部照片
docker compose exec photoprism photoprism index -f
其它命令:
Action | Command |
---|---|
Start Services | docker compose up -d |
Stop Services | docker compose stop |
Download Updates | docker compose pull |
Uninstall | docker compose rm -s -v |
View Logs | docker compose logs --tail=100 -f |
Display Config Values | docker compose exec photoprism photoprism show config |
Show Migration Status | docker compose exec photoprism photoprism migrations ls |
Repeat Failed Migrations | docker compose exec photoprism photoprism migrations run -f |
Reset Database | docker compose exec photoprism photoprism reset -y |
Backup Database | docker compose exec photoprism photoprism backup -a -i |
Restore Database | docker compose exec photoprism photoprism restore -a -i |
Change Admin Password | docker compose exec photoprism photoprism passwd [username] |
Show User Management Commands | docker compose exec photoprism photoprism users help |
Reset Users | docker compose exec photoprism photoprism users reset -y |
Show Face Recognition Commands | docker compose exec photoprism photoprism faces help |
Index Faces | docker compose exec photoprism photoprism faces index |
Reset People & Faces | docker compose exec photoprism photoprism faces reset -f |
Transcode Videos to AVC | docker compose exec photoprism photoprism convert |
Regenerate Thumbnails | docker compose exec photoprism photoprism thumbs -f |
Update Index | docker compose exec photoprism photoprism index --cleanup |
Import Files | docker compose exec photoprism photoprism import [path] |
源码安装(跳过)
下载 photoprism 的最新release版本
wget https://github.com/photoprism/photoprism/archive/refs/tags/221118-e58fee0fb.zip
制作镜像
准备 docker-compose
sudo apt-get install docker-compose
制作镜像
docker compose pull
docker compose stop
docker compose up -d
结果
docker-compose pull
Pulling mariadb ... done
Pulling traefik ... done
Pulling keycloak ... done
Pulling dummy-oidc ... done
Pulling dummy-webdav ... done
Pulling photoprism ... done
WARNING: Some service image(s) must be built from source by running:
docker-compose build photoprism
其会下载依赖的mariadb,traefik,keycloak,dummy-oidc和dummy-webdav镜像。
$ docker-compose build photoprism
Building photoprism
…………
=> => naming to docker.io/photoprism/photoprism:develop 0.0s
Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them