immich是一个开源、高性能的自托管备份解决方案,用于在手机上备份视频和照片。支持多端通用,非常小巧。
An open source, high performance self-hosted backup solution for videos and photos on your mobile phone。
页面展示
经过几天的使用,我感觉这个软件要是能做出来,还是相当的厉害的,但是目前的问题也很多,如果不是大佬或者不能给这个项目提pr的能力,建议不要深度使用,不是很稳定,而且有不少问题。
- 已经存在的历史图片必须一张一张上传,上传过程中cpu会被占满,我的i3-10105,100%使用持续大概12个小时。
- 手机备份经常把照片来回备份,即已经备份过的照片再上传一次,实际上服务器没有保存。
- docker子服务经常崩溃。
下载docker-compose
以下内容只有一个地方可能需要修改,就是暴露端口号。
1version: "3.8"2
3services:4 immich-server:5 image: altran1502/immich-server:latest6 entrypoint: ["/bin/sh", "./start-server.sh"]7 volumes:8 - ${UPLOAD_LOCATION}:/usr/src/app/upload9 env_file:10 - .env11 environment:12 - NODE_ENV=production13 depends_on:14 - redis15 - database68 collapsed lines
16 restart: always17
18 immich-microservices:19 image: altran1502/immich-server:latest20 entrypoint: ["/bin/sh", "./start-microservices.sh"]21 volumes:22 - ${UPLOAD_LOCATION}:/usr/src/app/upload23 env_file:24 - .env25 environment:26 - NODE_ENV=production27 depends_on:28 - redis29 - database30 restart: always31
32 immich-machine-learning:33 image: altran1502/immich-machine-learning:latest34 entrypoint: ["/bin/sh", "./entrypoint.sh"]35 volumes:36 - ${UPLOAD_LOCATION}:/usr/src/app/upload37 env_file:38 - .env39 environment:40 - NODE_ENV=production41 depends_on:42 - database43 restart: always44
45 immich-web:46 image: altran1502/immich-web:latest47 entrypoint: ["/bin/sh", "./entrypoint.sh"]48 env_file:49 - .env50 restart: always51
52 redis:53 container_name: immich_redis54 image: redis:6.255 restart: always56
57 database:58 container_name: immich_postgres59 image: postgres:1460 env_file:61 - .env62 environment:63 POSTGRES_PASSWORD: ${DB_PASSWORD}64 POSTGRES_USER: ${DB_USERNAME}65 POSTGRES_DB: ${DB_DATABASE_NAME}66 PG_DATA: /var/lib/postgresql/data67 volumes:68 - pgdata:/var/lib/postgresql/data69 restart: always70
71 immich-proxy:72 container_name: immich_proxy73 image: altran1502/immich-proxy:latest74 ports:75 - 2283:8080 # 默认是2280端口,根据需要修改76 logging:77 driver: none78 depends_on:79 - immich-server80 restart: always81
82volumes:83 pgdata:
我本来是跟官网同步下载的release版本,但是发现有bug,改成了lastest版本了。
下载env文件
1###################################################################################2# Database3###################################################################################4
5DB_HOSTNAME=immich_postgres # 可以修改为自己的postgres数据库6DB_USERNAME=postgres7DB_PASSWORD=postgres8DB_DATABASE_NAME=immich9
10# Optional Database settings:11# DB_PORT=543212
13###################################################################################14# Redis15###################################################################################54 collapsed lines
16
17REDIS_HOSTNAME=immich_redis18
19# Optional Redis settings:20# REDIS_PORT=637921# REDIS_DBINDEX=022# REDIS_PASSWORD=23# REDIS_SOCKET=24
25###################################################################################26# Upload File Config27###################################################################################28
29## 这一行必须修改,改为你的相片存放目录,必须是绝对路径30UPLOAD_LOCATION=absolute_location_on_your_machine_where_you_want_to_store_the_backup31
32###################################################################################33# Log message level - [simple|verbose]34###################################################################################35
36LOG_LEVEL=simple37
38###################################################################################39# JWT SECRET40###################################################################################41
42## 这一行必须修改43## linux 环境下,可以使用命令: openssl rand -base64 128 生成44JWT_SECRET=randomstringthatissolongandpowerfulthatnoonecanguess45
46###################################################################################47# Reverse Geocoding48####################################################################################49
50# DISABLE_REVERSE_GEOCODING=false51
52# Reverse geocoding is done locally which has a small impact on memory usage53# This memory usage can be altered by changing the REVERSE_GEOCODING_PRECISION variable54# This ranges from 0-3 with 3 being the most precise55# 3 - Cities > 500 population: ~200MB RAM56# 2 - Cities > 1000 population: ~150MB RAM57# 1 - Cities > 5000 population: ~80MB RAM58# 0 - Cities > 15000 population: ~40MB RAM59
60# REVERSE_GEOCODING_PRECISION=361
62####################################################################################63# WEB - Optional64####################################################################################65
66# Custom message on the login page, should be written in HTML form.67# For example PUBLIC_LOGIN_PAGE_MESSAGE="This is a demo instance of Immich.<br><br>Email: <i>demo@demo.de</i><br>Password: <i>demo</i>"68
69PUBLIC_LOGIN_PAGE_MESSAGE=
使用技巧
这个软件的全平台通用非常好用,苹果特有的heic格式也支持。
现在有一个使用场景如下:
曾经用过其他的图片管理工具,或者电脑上已经有很多图片了,现在需要转移到immich中。如果我们直接把以前的图片文件复制到immich中会发现在网页端不会显示,因为immich要给每一个图片和视频进行解码和生成缩略图,你直接复制进去,他就没办法生成了,也就没办法展示了,在github中曾经有人提过这个问题,最后开发者说因为要生成记录到数据库,必须每个图片都上传一下才行。如果一个人有很多张图片,这样传太废时间,而且我发现网页端的上传功能有两个问题,一是会自动忽略文件夹中的heic文件上传,二是不能一下上传50张以上的图片,会给个提示让用命令行上传。我就去找了下命令行的文档,发现命令行的文档里还明确写了支持heic格式,经过测试也确实支持,这也解决了ios端的一个大问题,但是我还是建议ios关闭这个heic格式。
使用命令行安装immichCLI工具:
1npm i immich -g
批量上传文件夹:
1immich upload --email testuser@email.com --password password --server http://192.168.1.216:2283/api -d your/target/directory