duckil_plm/docker-compose.db.yml

130 lines
3.4 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
- 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:
2024-11-18 20:03:20 +09:00
- "${TIMESCALEDB_PORT}:5442"
2024-11-18 19:51:13 +09:00
environment:
POSTGRES_DB: ${TIMESCALEDB_DB}
2024-11-18 20:15:51 +09:00
POSTGRES_USER: ${TIMESCALEDB_DB}
2024-11-18 19:51:13 +09:00
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}
2024-11-18 20:03:20 +09:00
ports:
- "${REDIS_PORT}:6379"
2024-11-18 19:51:13 +09:00
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
2024-11-18 20:16:16 +09:00
# fems-mqtt:
# build:
# context: ./docker/mqtt
# dockerfile: Dockerfile
# args:
# - MQTT_USERNAME=fems
# - MQTT_PASSWORD=fems123!
# - NODE_RED_USERNAME=nodered_user
# - NODE_RED_PASSWORD=nodered_password123!
# container_name: fems-mqtt
# env_file:
# - .env.${NODE_ENV:-development}
# ports:
# - "${MQTT_PORT}:1883"
# - "${MQTT_WSS_PORT}:8883"
# volumes:
# - mqtt_data:/mosquitto/data
# - mqtt_log:/mosquitto/log
# environment:
# - NODE_ENV=${NODE_ENV:-development}
# restart: unless-stopped
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