infrastructure-compose/database-compose.yml

47 lines
1.3 KiB
YAML

version: "3"
services:
mysql:
image: mysql:8
restart: always
env_file: .mysql.env
ports:
- "3306:3306"
volumes:
- "/mysql:/var/lib/mysql"
postgres:
image: postgres:17
restart: always
env_file: .postgres.env
ports:
- "5432:5432"
volumes:
- "/postgres:/var/lib/postgresql/data"
postgres_immich:
image: docker.io/tensorchord/pgvecto-rs:pg14-v0.2.0@sha256:90724186f0a3517cf6914295b5ab410db9ce23190a2d9d0b9dd6463e3fa298f0
env_file: .postgres_immich.env
ports:
- "5433:5432"
volumes:
- "/postgres_immich:/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