Skip to content

Instantly share code, notes, and snippets.

@vbogretsov
Created December 21, 2022 21:56
Show Gist options
  • Save vbogretsov/60cb0289229fc5c4fd2c7fd883ae0730 to your computer and use it in GitHub Desktop.
Save vbogretsov/60cb0289229fc5c4fd2c7fd883ae0730 to your computer and use it in GitHub Desktop.
PostgreSQL in docker compose
version: '3.8'
services:
postgres:
# image: postgres:10.18-alpine
image: postgres:13.4
restart: "no"
# Performance tuning by http://pgtune.leopard.in.ua
# DB Version: 10
# OS Type: linux
# DB Type: web
# Total Memory (RAM): 1 GB
# CPUs num: 2
# Connections num: 100
# Data Storage: ssd
command: postgres
-c 'default_transaction_isolation=read committed'
-c 'timezone=UTC'
-c 'client_encoding=UTF8'
-c 'max_connections=100'
-c 'shared_buffers=256MB'
-c 'effective_cache_size=768MB'
-c 'maintenance_work_mem=64MB'
-c 'checkpoint_completion_target=0.7'
-c 'wal_buffers=7864kB'
-c 'default_statistics_target=100'
-c 'random_page_cost=1.1'
-c 'effective_io_concurrency=200'
-c 'work_mem=2621kB'
-c 'min_wal_size=1GB'
-c 'max_wal_size=4GB'
-c 'max_worker_processes=2'
-c 'max_parallel_workers_per_gather=1'
-c 'max_parallel_workers=2'
-c 'wal_level=logical'
volumes:
- postgres:/var/lib/postgresql/data
- ./app/location/db/init.sh:/docker-entrypoint-initdb.d/init-location.sh
- ./app/supplier/db/init.sh:/docker-entrypoint-initdb.d/init-supplier.sh
- ./query.sql:/src/query.sql
env_file:
- ./etc/postgres.env
- ./etc/location.env
- ./etc/supplier.env
ports:
- 5432:5432
stdin_open: true
tty: true
location:
build:
context: ./app/location
args:
DEVBUILD: ${DEVBUILD}
ports:
- 8001:80
env_file:
- ./etc/postgres.env
- ./etc/location.env
volumes:
- ./app/location:/src/app
depends_on:
- postgres
libspec:
build: ./lib/spec
volumes:
- ./lib/spec:/src
volumes:
postgres:
networks:
default:
name: rnd-internal-nw
external: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment