102 lines
2.7 KiB
YAML
102 lines
2.7 KiB
YAML
# docker-compose.db.yml
|
|
# 기본 서비스 정의 (공통 설정)
|
|
version: "3.8"
|
|
|
|
services:
|
|
fems-postgres:
|
|
image: postgres:16
|
|
container_name: fems-postgres
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env.${NODE_ENV:-development}
|
|
ports:
|
|
- "${POSTGRES_PORT}:5432"
|
|
environment:
|
|
- NODE_ENV=${NODE_ENV:-development}
|
|
- LANG=en_US.utf8
|
|
- LC_ALL=en_US.utf8
|
|
- POSTGRES_HOST_AUTH_METHOD=scram-sha-256
|
|
- POSTGRES_INITDB_ARGS=--auth-host=scram-sha-256 --auth-local=scram-sha-256
|
|
volumes:
|
|
- fems_postgres:/var/lib/postgresql/data
|
|
- ./backups/postgres:/backups
|
|
- ./init-scripts:/docker-entrypoint-initdb.d
|
|
command:
|
|
- "postgres"
|
|
- "-c"
|
|
- "max_connections=100"
|
|
- "-c"
|
|
- "shared_buffers=128MB"
|
|
healthcheck:
|
|
test:
|
|
[
|
|
"CMD-SHELL",
|
|
"pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-postgres}",
|
|
]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
# healthcheck:
|
|
# test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
|
|
# interval: 30s
|
|
# timeout: 10s
|
|
# retries: 3
|
|
|
|
fems-timescaledb:
|
|
image: timescale/timescaledb:latest-pg16
|
|
container_name: fems-timescaledb
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env.${NODE_ENV:-development}
|
|
ports:
|
|
- "${TIMESCALEDB_PORT}:5442"
|
|
environment:
|
|
POSTGRES_DB: ${TIMESCALEDB_DB}
|
|
POSTGRES_USER: ${TIMESCALEDB_USER}
|
|
POSTGRES_PASSWORD: ${TIMESCALEDB_PASSWORD}
|
|
volumes:
|
|
- fems_timescaledb:/var/lib/postgresql/data
|
|
- ./fems-timescaledb/postgresql.conf:/etc/postgresql/postgresql.conf:ro
|
|
- ./fems-timescaledb/pg_hba.conf:/etc/postgresql/pg_hba.conf:ro
|
|
- ./fems-timescaledb/init-scripts:/docker-entrypoint-initdb.d/:ro
|
|
command: ["postgres", "-c", "config_file=/etc/postgresql/postgresql.conf"]
|
|
# healthcheck:
|
|
# test:
|
|
# ["CMD-SHELL", "pg_isready -U ${TIMESCALEDB_USER} -d ${TIMESCALEDB_DB}"]
|
|
networks:
|
|
- internal
|
|
|
|
fems-redis:
|
|
image: redis:alpine
|
|
container_name: fems-redis
|
|
restart: unless-stopped
|
|
env_file:
|
|
- .env.${NODE_ENV:-development}
|
|
ports:
|
|
- "${REDIS_PORT}:6379"
|
|
command:
|
|
[
|
|
"redis-server",
|
|
"--requirepass",
|
|
"${NODE_ENV:-development:-REDIS_PASSWORD}",
|
|
]
|
|
volumes:
|
|
- fems_redis:/data
|
|
- ./backups/redis:/backups
|
|
environment:
|
|
- NODE_ENV=${NODE_ENV:-development}
|
|
- REDIS_PASSWORD=${NODE_ENV:-development:-REDIS_PASSWORD}
|
|
depends_on:
|
|
- fems-postgres
|
|
- fems-timescaledb
|
|
# healthcheck:
|
|
# test: ["CMD", "redis-cli", "ping"]
|
|
# interval: 30s
|
|
# timeout: 10s
|
|
# retries: 3
|
|
|
|
volumes:
|
|
fems_postgres:
|
|
fems_redis:
|
|
fems_timescaledb:
|