Files
tp/main_dc/docker-compose.yml
T
valitovgaziz 2440e5d359 modified: main_dc/docker-compose.yml
set interval to 30s for healthcheck for all containers
2025-11-19 05:37:09 +05:00

276 lines
6.0 KiB
YAML

services:
certbot:
build:
context: ./certbot
dockerfile: Dockerfile
container_name: certbot
volumes:
- ./certbot/config:/etc/letsencrypt/config
- certbot_data:/etc/letsencrypt
- certbot_www:/var/www/certbot
env_file:
- .env
environment:
- EMAIL=${EMAIL}
- DOMAINS=${ALL_DOMAINS}
- STAGING=0
restart: unless-stopped
healthcheck:
test:
[
"CMD-SHELL",
"test -f /etc/letsencrypt/live/$$(echo $${DOMAINS} | cut -d',' -f1)/fullchain.pem || exit 1",
]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
nginx:
build:
context: ./nginx
dockerfile: Dockerfile
env_file: .env
container_name: nginx
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- certbot_data:/etc/letsencrypt
- certbot_www:/var/www/certbot
- ./stubSite:/usr/share/nginx/stub/html
- ./yalarba/serv_spa/spa/vue/dist:/usr/share/nginx/yalarba/html
- ./valitovgaziz/html:/usr/share/nginx/valitovgaziz/html
- ./BB/bbvue/dist:/usr/share/nginx/begushiybashkir/html
- analytics_logs:/var/log/analytics:ro
networks:
- web-network
- internal
- app-network
- bb-network
depends_on:
certbot:
condition: service_healthy
api_tp:
condition: service_healthy
api_bb:
condition: service_healthy
analytics:
condition: service_healthy
healthcheck:
test: ["CMD-SHELL", "curl -f http://localhost/health || exit 1"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
analytics:
build:
context: ./valitovgaziz/analytics
dockerfile: Dockerfile
container_name: analytics
restart: unless-stopped
ports:
- "9999:3000"
environment:
- NODE_ENV=production
- PORT=3000
- LOG_LEVEL=info
- LOG_RETENTION_DAYS=30
volumes:
- analytics_logs:/app/logs
- analytics_data:/app/data
networks:
- web-network
- internal
healthcheck:
test: ["CMD", "wget", "--spider", "http://localhost:3000/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
api_tp:
build:
context: ./yalarba/api_tp
dockerfile: Dockerfile
ports:
- "8888:8080"
container_name: api_tp
restart: unless-stopped
depends_on:
db:
condition: service_healthy
environment:
# Database connection settings
DB_HOST: db
DB_PORT: 5432
DB_USER: postgres
DB_PASSWORD: postgres
DB_NAME: mydb
APP_PORT: 8080
networks:
- app-network
healthcheck:
test:
[
"CMD",
"wget",
"--no-verbose",
"--tries=1",
"--spider",
"http://localhost:8080/health",
]
interval: 30s
timeout: 10s
retries: 3
db:
image: postgres:15-alpine
ports:
- "5432:5432"
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: mydb
container_name: db_tp
volumes:
- db_tp_data:/var/lib/postgresql/data
- ./migrations:/docker-entrypoint-initdb.d
networks:
- app-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 30s
timeout: 10s
retries: 5
api_bb:
build:
context: ./BB/api_bb
dockerfile: Dockerfile
ports:
- "7777:8080"
container_name: api_bb
restart: unless-stopped
depends_on:
db_bb:
condition: service_healthy
env_file:
- ./BB/api_bb/.env
volumes:
- api_bb_uploads:/app/uploads
environment:
# Database connection settings
DB_HOST: db_bb
DB_PORT: 5432
DB_USER: postgres
DB_PASSWORD: postgres
DB_NAME: bb_db
APP_PORT: 8080
networks:
- bb-network
healthcheck:
test:
[
"CMD",
"wget",
"--no-verbose",
"--tries=1",
"--spider",
"http://localhost:8080/api/health",
]
interval: 30s
timeout: 10s
retries: 3
db_bb:
image: postgres:15-alpine
ports:
- "5433:5432"
container_name: db_bb
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: bb_db
volumes:
- db_bb_data:/var/lib/postgresql/data
networks:
- bb-network
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres"]
interval: 30s
timeout: 10s
retries: 5
easysite:
build:
context: ./yalarba/easySite/easySite
dockerfile: Dockerfile
container_name: easysite
restart: unless-stopped
ports:
- "3000:3000"
environment:
NODE_ENV: production
HOST: 0.0.0.0
PORT: 3000
networks:
- web-network
- app-network
healthcheck:
test: ["CMD", "wget", "--spider", "http://localhost:3000/api/health"]
interval: 30s
timeout: 10s
retries: 3
api_es:
build:
context: ./yalarba/api_es
dockerfile: Dockerfile
container_name: api_es
restart: unless-stopped
env_file:
- ./yalarba/api_es/.env
depends_on:
db:
condition: service_healthy
environment:
DB_HOST: db
DB_PORT: 5432
DB_USER: postgres
DB_PASSWORD: postgres
DB_NAME: mydb
APP_PORT: ${API_ES_APP_PORT}
networks:
- app-network
- web-network
healthcheck:
test: ["CMD", "wget", "--spider", "http://localhost:8088/health"]
interval: 30s
timeout: 10s
retries: 3
volumes:
certbot_data:
certbot_www:
db_tp_data:
db_bb_data:
api_bb_uploads:
analytics_logs: # Volume для логов аналитики
analytics_data: # Volume для данных аналитики
networks:
web-network:
driver: bridge
internal:
driver: bridge
app-network:
driver: bridge
bb-network:
driver: bridge
# Эта опция автоматически удаляет orphans
x-remove-orphans: true