diff --git a/caddy/.env.example b/caddy/.env.example index c0a9fc3..dcd2dfb 100644 --- a/caddy/.env.example +++ b/caddy/.env.example @@ -40,3 +40,9 @@ GLANCE_KEY= GHOST_DOMAIN= GHOST_CRT= GHOST_KEY= + +############# Immich ############# +IMMICH_DOMAIN= +IMMICH_CRT= +IMMICH_KEY= + diff --git a/caddy/Caddyfile b/caddy/Caddyfile index b1b5d62..a1c13b0 100644 --- a/caddy/Caddyfile +++ b/caddy/Caddyfile @@ -153,6 +153,24 @@ } } +############## immich ############## +{$IMMICH_DOMAIN} { + tls /etc/ssl/custom/{$IMMICH_CRT} /etc/ssl/custom/{$IMMICH_KEY} + + request_body { + max_size 1024MB + } + + reverse_proxy http://immich_server:2283 { + header_up X-Real-IP {http.request.header.Cf-Connecting-Ip} + header_up X-Forwarded-For {http.request.header.Cf-Connecting-Ip} + header_up X-Country-Code {http.request.header.Cf-Ipcountry} + header_up X-Forwarded-Proto {http.request.scheme} + header_up Host {http.request.host} + header_up -CF-* + } +} + import Caddyfile.private diff --git a/glance/assets/immich.png b/glance/assets/immich.png new file mode 100644 index 0000000..cbdc20b Binary files /dev/null and b/glance/assets/immich.png differ diff --git a/glance/config/home.yml b/glance/config/home.yml index 3c291aa..c60c40e 100644 --- a/glance/config/home.yml +++ b/glance/config/home.yml @@ -32,6 +32,9 @@ - title: wg.aykhans.me url: https://wg.aykhans.me/ icon: /assets/wireguard.png + - title: photos.aykhans.me + url: https://photos.aykhans.me/ + icon: /assets/immich.png - title: aykhans.me url: https://aykhans.me/ icon: /assets/ghost.png diff --git a/immich/.env.example b/immich/.env.example new file mode 100644 index 0000000..00265a3 --- /dev/null +++ b/immich/.env.example @@ -0,0 +1,12 @@ +# The location where your uploaded files are stored +UPLOAD_LOCATION=./data/server + +# The location where your database files are stored. Network shares are not supported for the database +DB_DATA_LOCATION=./data/postgres + +DB_PASSWORD=postgres + +# The values below this line do not need to be changed +################################################################################### +DB_USERNAME=postgres +DB_DATABASE_NAME=immich \ No newline at end of file diff --git a/immich/.gitignore b/immich/.gitignore new file mode 100644 index 0000000..394be19 --- /dev/null +++ b/immich/.gitignore @@ -0,0 +1,2 @@ +/data/* +!.gitkeep diff --git a/immich/data/.gitkeep b/immich/data/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/immich/docker-compose.yml b/immich/docker-compose.yml new file mode 100644 index 0000000..121bbeb --- /dev/null +++ b/immich/docker-compose.yml @@ -0,0 +1,80 @@ +networks: + immich: + external: false + caddy: + name: caddy + driver: bridge + external: true + +services: + immich-server: + container_name: immich_server + image: ghcr.io/immich-app/immich-server:release + volumes: + # Do not edit the next line. If you want to change the media storage location on your system, edit the value of UPLOAD_LOCATION in the .env file + - ${UPLOAD_LOCATION}:/data + - /etc/localtime:/etc/localtime:ro + env_file: + - .env + ports: + - "2283:2283" + depends_on: + - redis + - database + networks: + - immich + - caddy + deploy: + resources: + limits: + cpus: "1.5" + memory: 1G + restart: unless-stopped + healthcheck: + disable: false + + immich-machine-learning: + container_name: immich_machine_learning + image: ghcr.io/immich-app/immich-machine-learning:release + volumes: + - model-cache:/cache + env_file: + - .env + networks: + - immich + # deploy: + # resources: + # limits: + # cpus: "1" + # memory: 600M + restart: unless-stopped + healthcheck: + disable: false + + redis: + container_name: immich_redis + image: docker.io/valkey/valkey:8-bookworm@sha256:facc1d2c3462975c34e10fccb167bfa92b0e0dbd992fc282c29a61c3243afb11 + networks: + - immich + healthcheck: + test: redis-cli ping || exit 1 + restart: unless-stopped + + database: + container_name: immich_postgres + image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0@sha256:32324a2f41df5de9efe1af166b7008c3f55646f8d0e00d9550c16c9822366b4a + environment: + POSTGRES_PASSWORD: ${DB_PASSWORD} + POSTGRES_USER: ${DB_USERNAME} + POSTGRES_DB: ${DB_DATABASE_NAME} + POSTGRES_INITDB_ARGS: "--data-checksums" + networks: + - immich + volumes: + # Do not edit the next line. If you want to change the database storage location on your system, edit the value of DB_DATA_LOCATION in the .env file + - ${DB_DATA_LOCATION}:/var/lib/postgresql/data + shm_size: 128mb + restart: unless-stopped + +volumes: + model-cache: diff --git a/main.sh b/main.sh index 9b15a39..f778cce 100755 --- a/main.sh +++ b/main.sh @@ -61,6 +61,7 @@ generate_env_files() { cp --update=none ./caddy/.env.example ./caddy/.env cp --update=none ./glance/.env.example ./glance/.env cp --update=none ./ghost/.env.example ./ghost/.env + cp --update=none ./immich/.env.example ./immich/.env cp --update=none ./caddy/Caddyfile.private.example ./caddy/Caddyfile.private # cp --update=none ./slash/.env.example ./slash/.env # cp --update=none ./grafana/.env.example ./grafana/.env @@ -172,6 +173,15 @@ start_services() { exit 1 fi + echo "Starting immich..." + $DOCKER_COMPOSE_COMMAND -f ./immich/docker-compose.yml up -d + if [ $? -eq 0 ]; then + print_success "Immich started successfully." + else + print_error "failed to start Immich!" + exit 1 + fi + echo "Starting caddy..." $DOCKER_COMPOSE_COMMAND -f ./caddy/docker-compose.yml up -d if [ $? -eq 0 ]; then @@ -282,6 +292,15 @@ stop_services() { exit 1 fi + echo "Stopping immich..." + $DOCKER_COMPOSE_COMMAND -f ./immich/docker-compose.yml down + if [ $? -eq 0 ]; then + print_success "Immich stopped successfully." + else + print_error "failed to stop Immich!" + exit 1 + fi + echo "Stopping caddy..." $DOCKER_COMPOSE_COMMAND -f ./caddy/docker-compose.yml down if [ $? -eq 0 ]; then