scripts/lech/docker/immich.sh

76 lines
2.3 KiB
Bash
Executable File

#!/bin/bash
set -e
. $HOME/scripts-private/lech/immich.env
VERSION=$(curl --silent https://api.github.com/repos/immich-app/immich/releases | grep "\"tag_name\": \"$MINOR_VERSION" | head -n 1 | sed -E 's/.*"([^"]+)".*/\1/')
echo
echo "VERSION: $VERSION"
up () {
# Exposed on port 3001 in pew-net
docker run \
--detach \
--name immich-server \
--restart unless-stopped \
--env DB_DATABASE_NAME=immich_db \
--env DB_HOSTNAME=immich-pg \
--env DB_USERNAME=immich_user \
--env DB_PASSWORD=immich_pw \
--env IMMICH_MACHINE_LEARNING_URL=http://immich-ml:3003 \
--env REDIS_HOSTNAME=immich-redis \
--volume /mammoth/immich/upload:/usr/src/app/upload:rw \
--volume /mammoth/photos:/external_library/photos:ro \
--volume /etc/localtime:/etc/localtime:ro \
--network pew-net \
ghcr.io/immich-app/immich-server:$VERSION
docker run \
--detach \
--name immich-ml \
--restart unless-stopped \
--env DB_DATABASE_NAME=immich_db \
--env DB_HOSTNAME=immich-pg \
--env DB_USERNAME=immich_user \
--env DB_PASSWORD=immich_pw \
--env IMMICH_MACHINE_LEARNING_URL=http://immich-ml:3003 \
--env REDIS_HOSTNAME=immich-redis \
--volume /mammoth/immich/cache:/cache:rw \
--network pew-net \
ghcr.io/immich-app/immich-machine-learning:$VERSION
docker run \
--detach \
--name immich-redis \
--restart unless-stopped \
--network pew-net \
docker.io/redis:6
docker run \
--detach \
--name immich-pg \
--restart unless-stopped \
--env POSTGRES_PASSWORD=immich_pw \
--env POSTGRES_USER=immich_user \
--env POSTGRES_DB=immich_db \
--env POSTGRES_INITDB_ARGS=--data-checksums \
--volume /mammoth/immich/postgres:/var/lib/postgresql/data:rw \
--network pew-net \
docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0 \
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
}
down () {
docker stop immich-server || true
docker rm immich-server || true
docker stop immich-ml || true
docker rm immich-ml || true
docker stop immich-redis || true
docker rm immich-redis || true
docker stop immich-pg || true
docker rm immich-pg || true
}
$@