From 8b9f773f205af23cf3209ff569fad8f5b5c9225e Mon Sep 17 00:00:00 2001 From: andrewso Date: Sun, 23 Feb 2025 21:28:29 +0000 Subject: [PATCH] [23-02-25] immich and cloudflare readme --- cloudflareTunnel.md | 31 ++++++++++++++ immich/README.md | 15 ++++++- immich/docker-compose.yml | 88 +++++++++++++++++++++++++++++++++++++++ immich/immich.env | 6 +++ 4 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 cloudflareTunnel.md create mode 100644 immich/docker-compose.yml create mode 100644 immich/immich.env diff --git a/cloudflareTunnel.md b/cloudflareTunnel.md new file mode 100644 index 0000000..272c970 --- /dev/null +++ b/cloudflareTunnel.md @@ -0,0 +1,31 @@ +# Setting up cloudflare tunnel + +Go to :: https://dash.cloudflare.com/ + +**Important**: Make sure you have a domain set up already, if not or expired go to namecheap and get one + +Go to Zero Trust -> Networks -> Tunnels + +## Creating a new tunnel + +1. Select Cloudflared +2. Give it a name +3. Copy the cloudflare command as this will contain the tunnel token +4. Route Tunnel + - Subdomain: immich + - Domain: your domain bought from namecheap (cathulu.online) + - Path: LEAVE BLANK + - Service Type: HTTP/HTTPS + - Service URL: `DOCKER_CONTAINER_NAME:EXPOSED_PORT` + +## Adding to an existing tunnel + +1. Make sure the status of the tunnel is "HEALTHY" +2. Three dots far right -> Configure +3. Public Hostname tab -> 'Add a public hostname' +4. Add public hostname + - Subdomain: immich + - Domain: your domain bought from namecheap (cathulu.online) + - Path: LEAVE BLANK + - Service Type: HTTP/HTTPS + - Service URL: `DOCKER_CONTAINER_NAME:EXPOSED_PORT` diff --git a/immich/README.md b/immich/README.md index 916f10d..7fc4a9f 100644 --- a/immich/README.md +++ b/immich/README.md @@ -1 +1,14 @@ -#Immich Docker file config +# Immich Docker file config + +Make sure you are under the immich directory. If not `cd` to it or create it `mkdir immich` + +Start the docker containers by running the compose file +``` +docker compose up -d +``` + +Once loaded, immich will be available from `http://192.168.1.xxx:2283`. If you have set up cloudflare correctly this will connect to cloudflare. Currently DNS used is http://immich.cathulu.online if this returns a cloudflare issue you have not set the tunnel up correctly or the docker container running cloudflared is having issues. + +``` +docker logs [CONTAINER NAME OR ID] +``` \ No newline at end of file diff --git a/immich/docker-compose.yml b/immich/docker-compose.yml new file mode 100644 index 0000000..2cc9194 --- /dev/null +++ b/immich/docker-compose.yml @@ -0,0 +1,88 @@ +name: immich + +services: + immich-server: + container_name: immich_server + image: ghcr.io/immich-app/immich-server:release + # extends: + # file: hwaccel.transcoding.yml + # service: cpu # set to one of [nvenc, quicksync, rkmpp, vaapi, vaapi-wsl] for accelerated transcoding + 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 + - /srv/dev-disk-by-uuid-01803dad-cf8d-4540-9abe-ccf26592c371/cathulu/immich:/usr/src/app/upload + - /etc/localtime:/etc/localtime:ro + env_file: + - immich.env + ports: + - '2283:2283' + depends_on: + - redis + - database + restart: always + healthcheck: + disable: false + + immich-machine-learning: + container_name: immich_machine_learning + # For hardware acceleration, add one of -[armnn, cuda, openvino] to the image tag. + # Example tag: ${IMMICH_VERSION:-release}-cuda + image: ghcr.io/immich-app/immich-machine-learning:release + # extends: # uncomment this section for hardware acceleration - see https://immich.app/docs/features/ml-hardware-acceleration + # file: hwaccel.ml.yml + # service: cpu # set to one of [armnn, cuda, openvino, openvino-wsl] for accelerated inference - use the `-wsl` version for WSL2 where applicable + volumes: + - model-cache:/cache + env_file: + - immich.env + restart: always + healthcheck: + disable: false + + cloudflared: + container_name: cloudflared + image: cloudflare/cloudflared:latest + restart: unless-stopped + command: tunnel run + environment: + TUNNEL_TOKEN: //TUNNEL TOKEN FROM CLOUDFLARE// + + redis: + container_name: immich_redis + image: docker.io/redis:6.2-alpine@sha256:905c4ee67b8e0aa955331960d2aa745781e6bd89afc44a8584bfd13bc890f0ae + healthcheck: + test: redis-cli ping || exit 1 + restart: always + + database: + container_name: immich_postgres + image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0 + environment: + POSTGRES_PASSWORD: postgres + POSTGRES_USER: postgres + POSTGRES_DB: immich + POSTGRES_INITDB_ARGS: '--data-checksums' + 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 + - ./postgres:/var/lib/postgresql/data + healthcheck: + test: >- + pg_isready --dbname="$${POSTGRES_DB}" --username="$${POSTGRES_USER}" || exit 1; + Chksum="$$(psql --dbname="$${POSTGRES_DB}" --username="$${POSTGRES_USER}" --tuples-only --no-align + --command='SELECT COALESCE(SUM(checksum_failures), 0) FROM pg_stat_database')"; + echo "checksum failure count is $$Chksum"; + [ "$$Chksum" = '0' ] || exit 1 + interval: 5m + start_interval: 30s + start_period: 5m + command: >- + postgres + -c shared_preload_libraries=vectors.so + -c 'search_path="$$user", public, vectors' + -c logging_collector=on + -c max_wal_size=2GB + -c shared_buffers=512MB + -c wal_compression=on + restart: always + +volumes: + model-cache: diff --git a/immich/immich.env b/immich/immich.env new file mode 100644 index 0000000..134bbde --- /dev/null +++ b/immich/immich.env @@ -0,0 +1,6 @@ +UPLOAD_LOCATION=/srv/dev-disk-by-uuid-01803dad-cf8d-4540-9abe-ccf26592c371/cathulu/immich +DB_DATA_LOCATION=./postgres +IMMICH_VERSION=release +DB_PASSWORD=postgres +DB_USERNAME=postgres +DB_DATABASE_NAME=immich