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

immich:自托管照片和视频管理程序

immich虽然开源又好用,但如果你的照片和视频文件很珍贵,在使用immich时请做好备份。原因就如官方项目页面所说:

The project is under very active development.
Expect bugs and breaking changes.
Do not use the app as the only way to store your photos and videos.

这是immich目前最大的问题,除了这个真没啥毛病可挑了。。。

之前immich还有个小瓜,大概就是开发人员想恰米,搞什么收费模式,结果被红迪的用户硬生生给怼回去了,然后就不提这事了,取而代之的是搞了个类似“捐赠”的购买界面,你虽然花钱买了immich但是没有任何额外的功能和好处,哈哈

要是当时开发人员刚一点,估计现在的immich就分家了,绝对有人fork开个分支出来继续维护= =

安装需要用到的包:

apt -y update
apt -y install curl wget nginx python3-certbot-nginx
curl -fsSL https://get.docker.com -o get-docker.sh
sh get-docker.sh

创建目录、下载compose文件以及环境变量配置文件:

mkdir -p /opt/immich && cd /opt/immich
wget -O docker-compose.yml https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
wget -O .env https://github.com/immich-app/immich/releases/latest/download/example.env

编辑环境变量配置文件:

nano .env

只需修改下面的内容:

TZ=Asia/Shanghai
DB_PASSWORD=pgpassword

启动immich:

docker compose up -d

配置NGINX反向代理:

nano /etc/nginx/sites-available/immich

写入如下内容:

server {
    listen 80;
    server_name immich.example.com;

    # allow large file uploads
    client_max_body_size 50000M;

    # Set headers
    proxy_set_header Host              $http_host;
    proxy_set_header X-Real-IP         $remote_addr;
    proxy_set_header X-Forwarded-For   $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;

    # enable websockets: http://nginx.org/en/docs/http/websocket.html
    proxy_http_version 1.1;
    proxy_set_header   Upgrade    $http_upgrade;
    proxy_set_header   Connection "upgrade";
    proxy_redirect     off;

    # set timeout
    proxy_read_timeout 600s;
    proxy_send_timeout 600s;
    send_timeout       600s;

    location / {
        proxy_pass http://127.0.0.1:2283;
    }
}

启用站点:

ln -s /etc/nginx/sites-available/immich /etc/nginx/sites-enabled/immich

签发SSL证书:

certbot --nginx

优化中文以文搜图,使用nllb-clip-large-siglip__v1模型:

也可以用nllb-clip-base-siglip__v1模型,这个模型执行时间短一些,但效果差一点。

导入外部图库(图片)如果你有的话。编辑compose文件:

nano docker-compose.yml

先使用bind mount挂载你的外部图库到容器内:

...
services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:${IMMICH_VERSION:-release}
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /home/debian/photo:/mnt/photo:ro # 在这里挂载你的外部图库,你还可以添加更多
      - /your/photo/path:/mnt/photo2:ro # 第二个外部图库
      - /etc/localtime:/etc/localtime:ro
...

然后重启immich:

docker compose up -d

在immich系统管理界面->外部图库->创建图库,填写容器内的路径:

别忘记保存:

最后执行一次扫描就导入成功了:

需要注意的是在挂载的时候添加了:ro标志,这表示即便你在immich内删除了外部图库的照片,但照片文件本身是不会被删除的,依旧保留在磁盘上。如果你想要immich能够直接删除文件可以去掉:ro标志。

赞(0)
未经允许不得转载:荒岛 » immich:自托管照片和视频管理程序
分享到: 更多 (0)

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

分享创造快乐

广告合作资源投稿