Immich: Self-Hosted Photo and Video Backup

06-12-2024 - 1 minute, 56 seconds -
documentation immich docker self-hosted

Introduction

Immich is a self-hosted solution for backing up and managing photos and videos, offering features like automatic tagging, AI-powered search, and seamless integration with network storage. This guide outlines how to deploy Immich using Docker, configure it with a network share, and enable additional functionality such as SMTP and external libraries.


Prerequisites

  1. Docker and Docker Compose installed on your server.
  2. A network share for storing media files.
  3. Environment variables (.env file) configured for Immich.

Steps to Set Up Immich

1. Download the Official docker-compose.yml

Ensure you are using the latest release version of Immich's docker-compose.yml: Download from the Latest Release

Avoid using the file from the main branch as it may be incompatible with the release version.

2. Create a .env File

Configure your .env file with the required environment variables. Replace placeholders with your credentials:

DB_PASSWORD=your_database_password
DB_USERNAME=your_database_username
DB_DATABASE_NAME=immich
UPLOAD_LOCATION=/path/to/nas/immich
DB_DATA_LOCATION=/path/to/database
SMTP_SERVER=smtp.example.com
SMTP_PORT=587
SMTP_USERNAME=your_email@example.com
SMTP_PASSWORD=your_email_password

3. Configure Network Share for Media Storage

To use a network share for storing uploads, configure the nas-immich volume in docker-compose.yml:

volumes:
  nas-immich:
    driver_opts:
      type: cifs
      o: "username=administrator,password=your_password"
      device: "//your-server/your-share-path"

Update the UPLOAD_LOCATION in the .env file to match the mounted path.

4. Start the Immich Services

Run the following commands to bring up the Immich services:

docker-compose pull
docker-compose up -d

5. Verify Deployment

  1. Access Immich via your server's IP or domain at http://<your-server>:8016.
  2. Log in with the admin credentials configured in your .env file.
  3. Verify the network share is properly mounted for uploads.

Extended Configuration

Using an External Library

Immich supports managing external libraries stored on network shares or remote directories:

  • Add the external library via the admin panel under Settings > External Libraries.
  • Specify the library's path in the format /pictures/library-name.

Refer to the External Library Guide for detailed instructions.

SMTP Configuration for Notifications

Enable SMTP for email notifications by updating your .env file:

SMTP_SERVER=smtp.gmail.com
SMTP_PORT=587
SMTP_USERNAME=your_email@example.com
SMTP_PASSWORD=your_email_password

For Gmail-specific configuration, see the SMTP Gmail Guide.


Resources and References


Conclusion

This guide provides a complete setup for deploying Immich using Docker. By leveraging network shares and optional configurations such as SMTP and external libraries, you can enhance Immich's functionality and storage flexibility. For further expansion, consider exploring hardware acceleration for machine learning tasks or integrating third-party services.