duckil_plm/docker-compose.db.yml

124 lines
3.5 KiB
YAML
Raw Normal View History

2024-11-18 19:51:13 +09:00
# docker-compose.db.yml
2024-11-18 20:13:53 +09:00
2024-11-18 19:51:13 +09:00
version: "3.8"
services:
fems-postgres:
image: postgres:16
container_name: fems-postgres
restart: unless-stopped
env_file:
- .env.${NODE_ENV:-development}
2024-11-18 20:03:20 +09:00
ports:
- "${POSTGRES_PORT}:5432"
2024-11-18 19:51:13 +09:00
environment:
- NODE_ENV=${NODE_ENV:-development}
- LANG=en_US.utf8
- LC_ALL=en_US.utf8
2024-11-19 07:21:45 +09:00
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
2024-11-18 19:51:13 +09:00
- POSTGRES_HOST_AUTH_METHOD=scram-sha-256
- POSTGRES_INITDB_ARGS=--auth-host=scram-sha-256 --auth-local=scram-sha-256
2024-11-19 07:21:45 +09:00
- TZ=Asia/Seoul
2024-11-18 19:51:13 +09:00
volumes:
- fems_postgres:/var/lib/postgresql/data
- ./backups/postgres:/backups
2024-11-19 07:21:45 +09:00
- ./fems-postgres/init-scripts:/docker-entrypoint-initdb.d
- ./fems-postgres/postgresql.conf:/etc/postgresql/postgresql.conf:ro
- ./fems-postgres/pg_hba.conf:/etc/postgresql/pg_hba.conf:ro
2024-11-18 19:51:13 +09:00
command:
- "postgres"
- "-c"
2024-11-19 07:21:45 +09:00
- "config_file=/etc/postgresql/postgresql.conf"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
2024-11-18 19:51:13 +09:00
fems-timescaledb:
image: timescale/timescaledb:latest-pg16
container_name: fems-timescaledb
restart: unless-stopped
env_file:
- .env.${NODE_ENV:-development}
ports:
2024-11-18 21:40:42 +09:00
- "${TIMESCALEDB_PORT}:5433"
2024-11-18 19:51:13 +09:00
environment:
2024-11-18 21:15:33 +09:00
- NODE_ENV=${NODE_ENV:-development}
2024-11-19 06:13:58 +09:00
- POSTGRES_DB=postgres
- POSTGRES_USER=postgres
2024-11-18 21:24:23 +09:00
- POSTGRES_PASSWORD=${TIMESCALEDB_PASSWORD}
2024-11-19 06:13:58 +09:00
- TIMESCALEDB_DB=${TIMESCALEDB_DB}
- TIMESCALEDB_USER=${TIMESCALEDB_USER}
- TIMESCALEDB_PASSWORD=${TIMESCALEDB_PASSWORD}
- LANG=C.UTF-8
- LC_ALL=C.UTF-8
2024-11-18 19:51:13 +09:00
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"]
2024-11-19 06:45:12 +09:00
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 10s
timeout: 5s
retries: 5
2024-11-18 19:51:13 +09:00
fems-redis:
image: redis:alpine
container_name: fems-redis
restart: unless-stopped
env_file:
- .env.${NODE_ENV:-development}
2024-11-18 21:28:55 +09:00
# ports:
# - "${REDIS_PORT}:6379"
2024-11-18 20:28:52 +09:00
command: ["redis-server", "--requirepass", "${REDIS_PASSWORD}"]
2024-11-18 19:51:13 +09:00
volumes:
- fems_redis:/data
- ./backups/redis:/backups
environment:
- NODE_ENV=${NODE_ENV:-development}
2024-11-19 06:45:12 +09:00
- REDIS_PASSWORD=${REDIS_PASSWORD}
2024-11-18 19:51:13 +09:00
depends_on:
- fems-postgres
- fems-timescaledb
2024-11-19 06:45:12 +09:00
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 10s
timeout: 5s
retries: 3
2024-11-18 19:51:13 +09:00
2024-11-19 20:50:52 +09:00
fems-mqtt:
image: eclipse-mosquitto:latest
container_name: fems-mqtt
restart: unless-stopped
ports:
- "${MQTT_PORT}:1883" # MQTT
- "${MQTT_WSS_PORT}:8883" # MQTT over WebSocket
volumes:
- ./fems-mqtt/config:/mosquitto/config
- ./fems-mqtt/data:/mosquitto/data
- ./fems-mqtt/log:/mosquitto/log
- ./fems-mqtt/certs:/mosquitto/certs
environment:
- TZ=Asia/Seoul
healthcheck:
test: ["CMD", "/usr/sbin/mosquitto_sub", "-t", "$$SYS/#", "-C", "1"]
interval: 30s
timeout: 10s
retries: 3
2024-11-18 20:13:53 +09:00
2024-11-18 19:51:13 +09:00
volumes:
fems_postgres:
fems_redis:
fems_timescaledb:
2024-11-18 20:06:09 +09:00
networks:
default:
driver: bridge
internal:
driver: bridge