Skip to content

Commit

Permalink
build: adding postgres configuration and edit containers name
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeversiane committed Oct 23, 2024
1 parent cd3d9e8 commit c640e48
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 5 deletions.
24 changes: 24 additions & 0 deletions conf/postgres/postgres.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
listen_addresses = '*'
max_connections = 300
superuser_reserved_connections = 3
unix_socket_directories = '/var/run/postgresql'
shared_buffers = 512MB
work_mem = 8MB
maintenance_work_mem = 256MB
effective_cache_size = 1GB
wal_buffers = 64MB
synchronous_commit = on
fsync = on
full_page_writes = on
checkpoint_timeout = 10min
checkpoint_completion_target = 0.9
random_page_cost = 4.0
effective_io_concurrency = 2
autovacuum = on
log_statement = 'mod'
log_duration = off
log_lock_waits = on
log_error_verbosity = terse
log_min_messages = error
log_min_error_statement = error
log_min_duration_statement = 1000ms
19 changes: 14 additions & 5 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,26 @@ services:
dockerfile: build/database/Dockerfile
volumes:
- local_postgres_data:/var/lib/postgresql/data
- ./conf/postgres/:/docker-entrypoint-initdb.d/
ports:
- "${POSTGRES_PORT}:${POSTGRES_PORT}"
- "5432:5432"
networks:
- golangnetwork
healthcheck:
test: ["CMD-SHELL", "pg_isready -q -d ${POSTGRES_DB} -U ${POSTGRES_USER} || exit 1"]
test: ["CMD-SHELL", "pg_isready -q -d postgres -U postgres || exit 1"]
interval: 10s
timeout: 5s
retries: 3
start_period: 20s
command:
[
"postgres",
"-c","config_file=/docker-entrypoint-initdb.d/postgres.conf",
]

migrate:
image: migrate/migrate
container_name: mg02
container_name: mg03
volumes:
- ./migrations:/migrations
command: [
Expand All @@ -43,7 +49,7 @@ services:
context: .
dockerfile: build/server/Dockerfile
image: app
container_name: go02
container_name: go03
restart: unless-stopped
depends_on:
- migrate
Expand All @@ -54,7 +60,7 @@ services:

nginx:
image: nginx:alpine
container_name: nx02
container_name: nx03
ports:
- "8000:8000"
volumes:
Expand All @@ -65,6 +71,7 @@ services:
- golangnetwork

jaeger-all-in-one:
container_name: jaeger03
image: jaegertracing/all-in-one:latest
ports:
- "5775:5775/udp"
Expand All @@ -77,6 +84,7 @@ services:
- "14250:14250"

otel-collector:
container_name: collector03
image: otel/opentelemetry-collector-contrib:0.53.0
command: ["--config=/conf/collector-config.yaml"]
volumes:
Expand All @@ -92,6 +100,7 @@ services:
- jaeger-all-in-one

prometheus:
container_name: prometheus03
image: prom/prometheus:latest
restart: always
volumes:
Expand Down

0 comments on commit c640e48

Please sign in to comment.