Guide to Deploy Immich with Hardware Acceleration on VPS GPU for Optimized Face Recognition
Detailed guide to deploy Immich on a VPS GPU with hardware acceleration for optimized face recognition, covering configuration, installation, performance tuning, and verification.
Image credit: geralt · Pixabay Content License
Introduction to Immich and Benefits of Hardware Acceleration
Immich is a self-hosted image storage and management application, similar to Google Photos, with AI-powered features like face recognition, content-based image search, and automatic categorization. When deployed on a VPS with GPU support, hardware acceleration significantly speeds up AI tasks such as face detection, image analysis, and data processing. By leveraging the GPU for compute-intensive workloads instead of relying solely on the CPU, Immich delivers faster processing, lower latency, and improved overall system efficiency. This is especially valuable for face recognition, where real-time or near-real-time performance is key.
System Requirements and Preparations
System Requirements
- VPS with GPU support for CUDA (e.g., NVIDIA T4, A10G, or compatible GPUs)
- Minimum 16GB RAM
- SSD storage with at least 100GB free space
- Operating System: Ubuntu 22.04 LTS or Debian 12
- Docker and Docker Compose installed
Preparation Steps
Before deployment, ensure the following:
- Access the VPS via SSH
- Verify the GPU is detected by the system
- Install NVIDIA drivers and CUDA Toolkit (compatible with Docker)
Deploying Immich with Hardware Acceleration on VPS GPU
Install NVIDIA Container Toolkit
To enable GPU access for Docker containers, install the NVIDIA Container Toolkit:
# Add NVIDIA repository
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/ubuntu22.04/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
# Update and install
sudo apt update
sudo apt install -y nvidia-container-toolkit
# Restart Docker
sudo systemctl restart docker
Configure docker-compose.yml
Create a docker-compose.yml file with the following configuration:
version: '3.8'
services:
immich-server:
image: immich/immich-server:latest
container_name: immich-server
restart: unless-stopped
ports:
- "2283:2283"
environment:
- NODE_ENV=production
- IMMICH_SERVER_PORT=2283
- IMMICH_SERVER_HOST=0.0.0.0
- IMMICH_DB_HOST=immich-db
- IMMICH_DB_PORT=5432
- IMMICH_DB_USER=immich
- IMMICH_DB_PASSWORD=immichpassword
- IMMICH_DB_NAME=immich
- IMMICH_STORAGE_TYPE=local
- IMMICH_STORAGE_LOCAL_PATH=/immich/data
volumes:
- ./data:/immich/data
devices:
- /dev/dri:/dev/dri
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
immich-worker:
image: immich/immich-worker:latest
container_name: immich-worker
restart: unless-stopped
environment:
- NODE_ENV=production
- IMMICH_SERVER_URL=http://immich-server:2283
- IMMICH_DB_HOST=immich-db
- IMMICH_DB_PORT=5432
- IMMICH_DB_USER=immich
- IMMICH_DB_PASSWORD=immichpassword
- IMMICH_DB_NAME=immich
depends_on:
- immich-server
volumes:
- ./data:/immich/data
devices:
- /dev/dri:/dev/dri
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
immich-db:
image: postgres:15
container_name: immich-db
restart: unless-stopped
environment:
POSTGRES_DB: immich
POSTGRES_USER: immich
POSTGRES_PASSWORD: immichpassword
volumes:
- ./db-data:/var/lib/postgresql/data
ports:
- "5432:5432"
Start Immich
Run the following command to launch the services:
docker-compose up -d
Performance Optimization and Activity Verification
Verify GPU Usage
Ensure the GPU is being utilized by Immich:
# Check GPU status
nvidia-smi
# Check container status
docker ps
# View Immich server logs
docker logs immich-server
Optimize Performance
- Ensure containers are allocated sufficient GPU resources
- Offload CPU-intensive AI tasks to the GPU
- Adjust image processing schedules based on usage patterns
- Monitor performance using
nvidia-smiordocker stats
Troubleshooting Common Issues
- GPU not detected: Verify NVIDIA drivers and CUDA Toolkit are correctly installed and compatible.
- Immich fails to start: Check container logs and ensure the database is running.
- Low performance: Review GPU, RAM, and CPU allocation; ensure no other containers are consuming excessive resources.
References
High-RAM Cloud VPS Plans Optimized for AI, Databases & Cache
Enterprise RAID 10 NVMe SSDs, CMC & FPT District 9 uplinks with Anycast Anti-DDoS and 99.99% SLA.
VPS-4E
10% VAT included
- CPU: 4 vCPU
- RAM: 8 GB
- SSD: 50 GB NVMe
