fix: adjust Postgres resource limits and healthcheck parameters. Increase memory limit to 256M and modify healthcheck retries and start period to improve stability. Add notes on shared memory requirements and healthcheck behavior in Docker configuration.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
# docker compose -f docker-compose.yaml -f docker-compose.microvps-full.yaml --profile microvps-full down
|
||||
#
|
||||
# Лимиты под хост ~1 ГиБ: сумма лимитов контейнеров ~800 МиБ + запас ОС/Docker. При OOM увеличьте RAM VPS или уберите prometheus/nats из профиля (отдельная правка compose).
|
||||
# Postgres ниже ~240–256 МиБ часто не успевает пройти healthcheck / падает по памяти — не уменьшайте postgres без tuned postgresql.conf.
|
||||
|
||||
services:
|
||||
evobgp-all:
|
||||
@@ -23,7 +24,7 @@ services:
|
||||
resources:
|
||||
limits:
|
||||
cpus: "0.45"
|
||||
memory: 180M
|
||||
memory: 256M
|
||||
|
||||
bird2:
|
||||
deploy:
|
||||
|
||||
@@ -45,6 +45,8 @@ services:
|
||||
profiles: ["reference", "microvps", "microvps-full"]
|
||||
image: postgres:16-alpine
|
||||
restart: unless-stopped
|
||||
# Дефолтный /dev/shm в Docker (64 МиБ) мало для Postgres; иначе ошибки shared memory при старте.
|
||||
shm_size: "256mb"
|
||||
environment:
|
||||
POSTGRES_USER: evobgp
|
||||
POSTGRES_PASSWORD: evobgp
|
||||
@@ -55,7 +57,8 @@ services:
|
||||
test: ["CMD-SHELL", "pg_isready -U evobgp -d evobgp"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 5
|
||||
retries: 12
|
||||
start_period: 45s
|
||||
logging: *default-logging
|
||||
deploy:
|
||||
resources:
|
||||
|
||||
@@ -0,0 +1,170 @@
|
||||
# Standalone stack (без profiles): Portainer / `docker compose -f stack.microvps-full.yaml up -d`
|
||||
# Эквивалент microvps-full из docker-compose.yaml + docker-compose.microvps-full.yaml,
|
||||
# с встроенными configs для Prometheus (как у вас).
|
||||
#
|
||||
# Postgres: shm_size + start_period — иначе часто «dependency postgres failed» на слабом хосте.
|
||||
name: evobgp-microvps-full
|
||||
|
||||
configs:
|
||||
prometheus_yml:
|
||||
content: |
|
||||
global:
|
||||
scrape_interval: 15s
|
||||
evaluation_interval: 15s
|
||||
rule_files:
|
||||
- /etc/prometheus/alerts.yml
|
||||
scrape_configs:
|
||||
- job_name: evobgp-all
|
||||
metrics_path: /metrics
|
||||
static_configs:
|
||||
- targets: ["evobgp-all:8080"]
|
||||
prometheus_alerts_yml:
|
||||
content: |
|
||||
groups: []
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:16-alpine
|
||||
restart: unless-stopped
|
||||
shm_size: "256mb"
|
||||
environment:
|
||||
POSTGRES_USER: evobgp
|
||||
POSTGRES_PASSWORD: evobgp
|
||||
POSTGRES_DB: evobgp
|
||||
volumes:
|
||||
- pgdata:/var/lib/postgresql/data
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "pg_isready -U evobgp -d evobgp"]
|
||||
interval: 10s
|
||||
timeout: 5s
|
||||
retries: 12
|
||||
start_period: 45s
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
nats:
|
||||
image: nats:2.10-alpine
|
||||
restart: unless-stopped
|
||||
command: ["-js", "-m", "8222"]
|
||||
ports:
|
||||
- "4222:4222"
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
bird2:
|
||||
image: git.shts.su/denozord/evobgp-bird2:latest
|
||||
restart: unless-stopped
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
sysctls:
|
||||
net.ipv4.ip_forward: "1"
|
||||
net.ipv6.conf.all.forwarding: "1"
|
||||
volumes:
|
||||
- bird_etc:/etc/bird
|
||||
- bird_run:/run/bird
|
||||
ports:
|
||||
- "179:179/tcp"
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
evobgp-agent:
|
||||
image: git.shts.su/denozord/evobgp-agent:latest
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
bird2:
|
||||
condition: service_started
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
volumes:
|
||||
- bird_etc:/etc/bird
|
||||
- bird_run:/run/bird
|
||||
entrypoint: ["/usr/local/bin/evobgp-agent"]
|
||||
command: ["watch", "-socket=/run/bird/bird.ctl", "-watch-interval=30s"]
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
evobgp-all:
|
||||
image: git.shts.su/denozord/evobgp-all:latest
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
postgres:
|
||||
condition: service_healthy
|
||||
nats:
|
||||
condition: service_started
|
||||
bird2:
|
||||
condition: service_started
|
||||
ports:
|
||||
- "8080:8080"
|
||||
environment:
|
||||
EVOBGP_DATABASE_URL: postgres://evobgp:evobgp@postgres:5432/evobgp?sslmode=disable
|
||||
EVOBGP_BROKER_URL: nats://nats:4222
|
||||
EVOBGP_HTTP_ADDR: ":8080"
|
||||
EVOBGP_SEED_DEMO: "1"
|
||||
EVOBGP_BIRDC_SOCKET: /run/bird/bird.ctl
|
||||
EVOBGP_BIRDC_INTERVAL: 30s
|
||||
EVOBGP_BIRD_ACTIVE_DIR: /etc/bird
|
||||
EVOBGP_BIRD_STAGING_DIR: /tmp/evobgp-bird-staging
|
||||
EVOBGP_DEV_INSECURE: "1"
|
||||
volumes:
|
||||
- bird_etc:/etc/bird
|
||||
- bird_run:/run/bird:ro
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
evobgp-web:
|
||||
image: git.shts.su/denozord/evobgp-web-all:latest
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
evobgp-all:
|
||||
condition: service_started
|
||||
ports:
|
||||
- "3000:80"
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
prometheus:
|
||||
image: prom/prometheus:v2.54.1
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
evobgp-all:
|
||||
condition: service_started
|
||||
ports:
|
||||
- "9090:9090"
|
||||
configs:
|
||||
- source: prometheus_yml
|
||||
target: /etc/prometheus/prometheus.yml
|
||||
- source: prometheus_alerts_yml
|
||||
target: /etc/prometheus/alerts.yml
|
||||
command:
|
||||
- --config.file=/etc/prometheus/prometheus.yml
|
||||
- --storage.tsdb.path=/prometheus
|
||||
- --storage.tsdb.retention.time=7d
|
||||
- --web.enable-lifecycle
|
||||
logging:
|
||||
driver: json-file
|
||||
options:
|
||||
max-size: "10m"
|
||||
max-file: "3"
|
||||
|
||||
volumes:
|
||||
pgdata:
|
||||
bird_etc:
|
||||
bird_run:
|
||||
Reference in New Issue
Block a user