Immich Deployment and Usage Guide
This guide provides comprehensive instructions for deploying and using Immich, a high-performance self-hosted photo and video management solution.
Prerequisites
Before you begin, ensure you have the following installed:
- Docker & Docker Compose: Immich is designed to run in Docker containers.
- Git: For cloning the Immich repository.
Installation
Immich primarily uses Docker Compose for deployment.
-
Clone the Repository:
git clone https://github.com/immich-app/immich.git cd immich -
Prepare Environment Files: Immich uses
.envfiles for configuration. Copy the example environment files:cp .env.example .env cp docker-compose.yml.example docker-compose.ymlNote: It's crucial to review and customize these files based on your setup.
-
Pull Docker Images:
docker compose pull -
Start Immich:
docker compose up -dThis command will start all Immich services in detached mode.
Configuration
Immich's configuration is primarily managed through the .env file and docker-compose.yml.
Environment Variables (.env)
Edit the .env file to configure Immich. Key variables include:
UPLOAD_LOCATION: Path to store your photos and videos. Ensure this path is correctly mapped as a volume indocker-compose.yml.DB_HOSTNAME,DB_USERNAME,DB_PASSWORD,DB_DATABASE: PostgreSQL database connection details.JWT_SECRET: A strong, randomly generated secret for JWT authentication.TYPESENSE_API_KEY: API key for Typesense search.MACHINE_LEARNING_HOST: Host for the machine learning service.
Docker Compose (docker-compose.yml)
The docker-compose.yml file defines the services, networks, and volumes for Immich.
- Volumes: Ensure that the
UPLOAD_LOCATIONyou set in.envis correctly mounted as a volume for theimmich-serverandimmich-microservicescontainers. For example:
Wherevolumes: - ./upload:/usr/src/app/upload./uploadis the host path and/usr/src/app/uploadis the container path. - Ports: By default, Immich services expose ports. Adjust them if necessary to avoid conflicts.
immich-server:2283:3001(API)immich-web:80:80(Web UI)
- Database: Immich uses PostgreSQL. The
docker-compose.ymltypically includes a PostgreSQL service. Ensure its data volume is persistent.
Database Migrations
Immich uses Kysely for database migrations. The application handles migrations automatically on startup. If you encounter issues during an upgrade from an older TypeORM-based Immich instance, you might see an error like ErrorMessages.TypeOrmUpgrade. Refer to the official Immich documentation for specific upgrade paths.
Build & Run Locally
Immich is built using TypeScript. While the primary deployment method is Docker, developers might need to build and run components locally.
Development Setup
- Install Node.js: Ensure you have Node.js (LTS recommended) installed.
- Install Dependencies:
Navigate to the specific service directory (e.g.,
server/,web/,mobile/) and install dependencies:cd server npm install - Run Services:
Each service typically has a
start:devscript. For example, to run the server in development mode:
This will usually include hot-reloading for development.cd server npm run start:dev
Production Build
To build Immich for production without Docker:
- Build Server:
cd server npm install npm run build - Build Web:
The built artifacts will be in acd web npm install npm run builddistorbuilddirectory within each service. You would then need to configure a web server (like Nginx) to serve the web UI and proxy requests to the Immich API.
Deployment
The recommended and most straightforward deployment method for Immich is using Docker Compose.
-
Server Requirements:
- CPU: Immich can be CPU-intensive, especially during initial asset processing (thumbnails, facial recognition, smart search). A modern multi-core CPU is recommended.
- RAM: At least 8GB RAM is recommended, more for larger libraries.
- Storage: Ample storage for your photos and videos, plus SSD for the database and application files for better performance.
- Network: Stable network connection for accessing the web UI and mobile apps.
-
Deployment Steps (Docker Compose): Follow the "Installation" steps above to clone the repository, configure
.envanddocker-compose.yml, and then run:docker compose up -d -
Access Immich: Once the containers are running, you can access the Immich web interface by navigating to
http://localhost(or the IP address/domain of your server) in your web browser. -
Mobile App Configuration: For the mobile app, set the
Server Endpoint URLtohttp://your-server-ip-or-domain:2283(or the port you configured for theimmich-server).
Recommended Platforms
- Self-hosted Server (Linux VM/Bare Metal): This is the most common and recommended deployment method using Docker Compose. It provides full control over your data and resources.
- NAS (Network Attached Storage): Many NAS devices support Docker, making them suitable for Immich deployment, especially for leveraging existing storage.
- Cloud VMs (AWS EC2, Google Cloud, Azure): For those who prefer cloud infrastructure, a Linux VM can host Immich using Docker Compose. Ensure you configure appropriate security groups and persistent storage.
Troubleshooting
Here are some common issues and their solutions:
-
ErrorMessages.TypeOrmUpgradeduring startup:- Issue: This error indicates that your database contains TypeORM migrations from an older Immich version that are incompatible with the current Kysely-based migration system.
- Solution: Do not attempt to run Kysely migrations directly on a database that has incomplete TypeORM migrations. You must follow the official Immich upgrade path from your specific previous version. Consult the Immich documentation on upgrading for the correct procedure, which often involves specific steps to bridge the migration gap.
-
Containers fail to start:
- Check Docker Logs: Use
docker compose logsto view the logs of failing containers. This often provides specific error messages. - Port Conflicts: Ensure no other applications are using the ports Immich is trying to bind (e.g., 80, 2283).
- Resource Limits: Verify your server has enough RAM and CPU.
.envConfiguration: Double-check all variables in your.envfile, especially database credentials and paths.
- Check Docker Logs: Use
-
"502 Bad Gateway" or "Connection Refused" when accessing the web UI:
immich-servernot running: The API backend might not be running. Checkdocker compose psanddocker compose logs immich-server.- Incorrect
immich-webconfiguration: Ensure the web service is correctly configured to proxy requests to the API. - Firewall: Check if your server's firewall is blocking access to the Immich ports.
-
Assets not appearing after upload:
UPLOAD_LOCATION: Verify that theUPLOAD_LOCATIONin your.envfile is correct and that the corresponding volume mount indocker-compose.ymlis correctly configured and accessible by the containers.- Permissions: Ensure the Docker user has read/write permissions to the
UPLOAD_LOCATIONdirectory on your host system. - Microservices: Check the logs of
immich-microservicesfor any errors related to asset processing.
-
Slow performance:
- Hardware: Consider upgrading CPU, RAM, or using SSD storage for the database and asset files.
- Database: Ensure your PostgreSQL database is running efficiently.
- Machine Learning: If facial recognition or smart search is slow, check the
immich-machine-learningservice logs and ensure it has sufficient resources.
-
Unable to log in to the mobile app:
- Server Endpoint URL: Confirm the
Server Endpoint URLin the mobile app settings is correct (e.g.,https://your-domain.comorhttp://your-server-ip:2283). - Network Access: Ensure your mobile device can reach the server. Check firewall rules.
- Server Endpoint URL: Confirm the
For further assistance, refer to the official Immich documentation or join the Immich Discord server.