Self-Hosting a Photo Library with Immich and Twingate Remote Access
The source video’s title points to building a self-hosted photo library as an alternative to Google Photos, and its description names two services: Immich and Twingate. Immich is an open-source, self-hosted photo and video backup service. Its server runs as Docker containers and offers iOS and Android clients plus a web interface. Twingate provides access to the Immich server from a home network that has no public IP, and the description calls it a free option. YouTube blocked the video’s subtitles on the server (LOGIN_REQUIRED), so the following is based only on public documentation from the two projects, and any part that involves hands-on testing is marked as not verified.
Use Cases
- Phone photos need to be backed up to a personal drive, with capacity limited only by local disk space.
- A NAS, mini PC, or old laptop at home can stay powered on long term.
- Photos on the home server need to be viewable from outside networks, but there is no fixed public IP.
- Original photos and videos should be kept intact and organized by date, face, and location.
Prerequisites
A Linux host on x86 or ARM with Docker Engine and the Docker Compose plugin installed. The Immich compose file also starts a PostgreSQL database, Redis, and a machine learning container, so disk space must be reserved for the database in addition to photo storage. For storage, photos and videos are written by user and date into the directory that UPLOAD_LOCATION points to, and capacity should be estimated from the size of the existing library. For remote access, a Twingate account is required, along with a Connector running on the home network and a Client installed on the phone or laptop.
Installation Steps
Create a working directory on the host and download the compose file and example environment file from the official release page:
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
Edit .env and set at least the photo directory, database password, and time zone:
UPLOAD_LOCATION=/mnt/photos
DB_PASSWORD=replace-with-a-random-string
TZ=Asia/Shanghai
After confirming the directory exists, start the containers:
docker compose up -d
Once all containers are running, open http://HOST_IP:2283 in a browser and follow the prompts to create an admin account. On the phone, install the Immich client from the app store, enter the same server address, and log in. The commands above and port 2283 come from the official Immich release page and documentation. They were not run on a test machine, so this part is not verified.
Configuration Notes
UPLOAD_LOCATION should point to a separate disk or mount point. The database directory is managed by a named volume in the compose file by default, and the two should not share a partition. The IMMICH_VERSION environment variable determines which image version is pulled. The official example follows the release channel by default, and both the database and the photo directory should be backed up before upgrading.
Mobile backup is enabled per album, and the client offers two modes: foreground-only backup and background backup. The machine learning container handles smart search and face grouping. Disabling it reduces memory usage at the cost of weaker search.
For remote access, Twingate deploys a Connector on the home network that makes outbound connections. The Client reaches the same internal addresses used on the LAN, and no port forwarding is needed on the router. Docker deployment parameters for the Connector and the token retrieval process should follow the official Twingate documentation. This article does not include specific commands for them.
Limitations and Caveats
Immich is released under the AGPL-3.0 license. Redistributing it or offering it as a network service requires complying with the license’s source disclosure terms, and the LICENSE file in the repository is the authoritative reference.
The source material only includes the video title and description. Any specific version numbers, memory usage figures, or Twingate configuration parameters that may appear in the video were not obtained. The Twingate description says free, but the user limit and feature restrictions of the free tier need to be checked on the official pricing page. This is not verified.
A single-host Docker deployment has no redundancy, and a disk failure on the host loses both the database and the photos. The mitigation is to regularly copy UPLOAD_LOCATION and a database export to another machine, and the restore process should be rehearsed separately.
Immich’s containers have memory requirements. A 1C1G VPS running the database, machine learning, and server together may hit OOM. The exact threshold is not verified.
Items to Test
- Run the full compose stack on a 1C1G VPS and record peak memory from docker stats.
- Back up 200 original photos from a phone in background mode and record time, data usage, and battery drain.
- Disable the machine learning container, rerun smart search and face grouping, and observe which features degrade.
- Deploy a Twingate Connector on the home network and confirm how many users and devices a free account can add.
- Sync UPLOAD_LOCATION to a second machine with rsync, then perform a database restore following the official documentation.
Source
- Video: https://www.youtube.com/watch?v=Z9q4S0Phq_Q
- Immich website: https://immich.app
- Immich repository: https://github.com/immich-app/immich
- Twingate website: https://www.twingate.com