125 lines
3.3 KiB
YAML
125 lines
3.3 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}:5432"
|
|
environment:
|
|
POSTGRES_DB: ${TIMESCALEDB_DB}
|
|
POSTGRES_USER: ${POSTGRES_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", "${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
|
|
|
|
# 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
|
|
|
|
volumes:
|
|
fems_postgres:
|
|
fems_redis:
|
|
fems_timescaledb:
|
|
|
|
networks:
|
|
default:
|
|
driver: bridge
|
|
internal:
|
|
driver: bridge
|