auto commit

This commit is contained in:
bangdk 2024-11-19 07:21:45 +09:00
parent 2e1c49a59d
commit 6b43b6ebdf
5 changed files with 49 additions and 9 deletions

View File

@ -36,6 +36,10 @@ POSTGRES_DB=wacefems-database
POSTGRES_USER=wacefems_database_user
POSTGRES_PASSWORD=wacefems-pg-password-PPw09!keep
# Optional Database Config
POSTGRES_MAX_CONNECTIONS=100
POSTGRES_SHARED_BUFFERS=128MB
# TimescaleDB
TIMESCALEDB_HOST=fems-timescaledb
TIMESCALEDB_PORT=5433

View File

@ -43,6 +43,10 @@ POSTGRES_DB=wacefems-database
POSTGRES_USER=wacefems_database_user
POSTGRES_PASSWORD=wacefems-pg-password-PPw09!keep
# Optional Database Config
POSTGRES_MAX_CONNECTIONS=100
POSTGRES_SHARED_BUFFERS=128MB
# TimescaleDB
TIMESCALEDB_HOST=fems-timescaledb
TIMESCALEDB_PORT=5433

View File

@ -15,23 +15,29 @@ services:
- NODE_ENV=${NODE_ENV:-development}
- LANG=en_US.utf8
- LC_ALL=en_US.utf8
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_HOST_AUTH_METHOD=scram-sha-256
- POSTGRES_INITDB_ARGS=--auth-host=scram-sha-256 --auth-local=scram-sha-256
- TZ=Asia/Seoul
volumes:
- fems_postgres:/var/lib/postgresql/data
- ./backups/postgres:/backups
# - ./init-scripts:/docker-entrypoint-initdb.d
- ./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
command:
- "postgres"
- "-c"
- "max_connections=100"
- "-c"
- "shared_buffers=128MB"
# healthcheck:
# test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
# interval: 30s
# timeout: 10s
# retries: 3
- "config_file=/etc/postgresql/postgresql.conf"
networks:
- fems-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"]
interval: 10s
timeout: 5s
retries: 5
fems-timescaledb:
image: timescale/timescaledb:latest-pg16

10
fems-postgres/pg_hba.conf Normal file
View File

@ -0,0 +1,10 @@
# fems-postgres/pg_hba.conf
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all scram-sha-256
# IPv4 local connections:
host all all 127.0.0.1/32 scram-sha-256
# IPv6 local connections:
host all all ::1/128 scram-sha-256
# Allow connections from Docker network
host all all 0.0.0.0/0 scram-sha-256

View File

@ -0,0 +1,16 @@
# fems-postgres/postgresql.conf
listen_addresses = '*'
port = 5432
max_connections = 100
shared_buffers = 128MB
dynamic_shared_memory_type = posix
max_wal_size = 1GB
min_wal_size = 80MB
log_timezone = 'Asia/Seoul'
datestyle = 'iso, ymd'
timezone = 'Asia/Seoul'
lc_messages = 'en_US.utf8'
lc_monetary = 'en_US.utf8'
lc_numeric = 'en_US.utf8'
lc_time = 'en_US.utf8'
default_text_search_config = 'pg_catalog.english'