initial commit
This commit is contained in:
50
fluxer_devops/postgres/compose.yaml
Normal file
50
fluxer_devops/postgres/compose.yaml
Normal file
@@ -0,0 +1,50 @@
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:17-alpine
|
||||
hostname: postgres
|
||||
environment:
|
||||
- POSTGRES_DB=fluxer
|
||||
- POSTGRES_USER=fluxer
|
||||
- POSTGRES_PASSWORD_FILE=/run/secrets/postgres_password
|
||||
secrets:
|
||||
- postgres_password
|
||||
volumes:
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
- ./conf/postgresql.conf:/etc/postgresql/postgresql.conf
|
||||
command: postgres -c config_file=/etc/postgresql/postgresql.conf
|
||||
networks:
|
||||
- fluxer-shared
|
||||
ports:
|
||||
- '5432:5432'
|
||||
deploy:
|
||||
replicas: 1
|
||||
restart_policy:
|
||||
condition: on-failure
|
||||
delay: 10s
|
||||
max_attempts: 3
|
||||
resources:
|
||||
limits:
|
||||
cpus: '4'
|
||||
memory: 16G
|
||||
reservations:
|
||||
cpus: '2'
|
||||
memory: 8G
|
||||
healthcheck:
|
||||
test: ['CMD-SHELL', 'pg_isready -U fluxer -d fluxer']
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
start_period: 30s
|
||||
shm_size: 2g
|
||||
|
||||
networks:
|
||||
fluxer-shared:
|
||||
external: true
|
||||
|
||||
volumes:
|
||||
postgres_data:
|
||||
driver: local
|
||||
|
||||
secrets:
|
||||
postgres_password:
|
||||
external: true
|
||||
60
fluxer_devops/postgres/conf/postgresql.conf
Normal file
60
fluxer_devops/postgres/conf/postgresql.conf
Normal file
@@ -0,0 +1,60 @@
|
||||
listen_addresses = '*'
|
||||
max_connections = 200
|
||||
superuser_reserved_connections = 3
|
||||
|
||||
shared_buffers = 4GB
|
||||
effective_cache_size = 12GB
|
||||
maintenance_work_mem = 1GB
|
||||
work_mem = 20MB
|
||||
|
||||
checkpoint_timeout = 15min
|
||||
checkpoint_completion_target = 0.9
|
||||
max_wal_size = 4GB
|
||||
min_wal_size = 1GB
|
||||
|
||||
random_page_cost = 1.1
|
||||
effective_io_concurrency = 200
|
||||
|
||||
wal_buffers = 16MB
|
||||
wal_compression = on
|
||||
wal_level = replica
|
||||
max_wal_senders = 3
|
||||
|
||||
logging_collector = on
|
||||
log_directory = 'log'
|
||||
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log'
|
||||
log_rotation_age = 1d
|
||||
log_rotation_size = 100MB
|
||||
log_line_prefix = '%t [%p]: [%l-1] user=%u,db=%d,app=%a,client=%h '
|
||||
log_checkpoints = on
|
||||
log_connections = on
|
||||
log_disconnections = on
|
||||
log_duration = off
|
||||
log_lock_waits = on
|
||||
log_statement = 'none'
|
||||
log_temp_files = 0
|
||||
log_min_duration_statement = 1000
|
||||
|
||||
autovacuum = on
|
||||
autovacuum_max_workers = 3
|
||||
autovacuum_naptime = 30s
|
||||
|
||||
shared_preload_libraries = 'pg_stat_statements'
|
||||
track_io_timing = on
|
||||
track_functions = all
|
||||
|
||||
pg_stat_statements.max = 10000
|
||||
pg_stat_statements.track = all
|
||||
|
||||
default_statistics_target = 100
|
||||
max_parallel_workers_per_gather = 2
|
||||
max_parallel_workers = 4
|
||||
max_worker_processes = 4
|
||||
|
||||
datestyle = 'iso, mdy'
|
||||
timezone = 'UTC'
|
||||
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'
|
||||
Reference in New Issue
Block a user