148 lines
3.9 KiB
YAML
148 lines
3.9 KiB
YAML
services:
|
|
# PostgreSQL database
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: parser_postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_USER: ${DB_USER:-postgres}
|
|
POSTGRES_PASSWORD: ${DB_PASSWORD:-postgres}
|
|
POSTGRES_DB: ${DB_DATABASE:-parser_zakupok}
|
|
ports:
|
|
- "${DB_PORT:-5432}:5432"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
networks:
|
|
- parser_network
|
|
|
|
# Redis cache (for future use with queues/caching)
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: parser_redis
|
|
restart: unless-stopped
|
|
ports:
|
|
- "6379:6379"
|
|
volumes:
|
|
- redis_data:/data
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 5
|
|
networks:
|
|
- parser_network
|
|
|
|
# Main AdonisJS application (HTTP API server)
|
|
app:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: production
|
|
container_name: parser_app
|
|
restart: unless-stopped
|
|
ports:
|
|
- "${PORT:-3333}:3333"
|
|
environment:
|
|
TZ: ${TZ:-UTC}
|
|
PORT: 3333
|
|
HOST: 0.0.0.0
|
|
LOG_LEVEL: ${LOG_LEVEL:-info}
|
|
APP_KEY: ${APP_KEY}
|
|
NODE_ENV: production
|
|
SESSION_DRIVER: ${SESSION_DRIVER:-cookie}
|
|
DB_HOST: postgres
|
|
DB_PORT: 5432
|
|
DB_USER: ${DB_USER:-postgres}
|
|
DB_PASSWORD: ${DB_PASSWORD:-postgres}
|
|
DB_DATABASE: ${DB_DATABASE:-parser_zakupok}
|
|
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN}
|
|
ICETRADE_BASE_URL: ${ICETRADE_BASE_URL:-https://icetrade.by}
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
redis:
|
|
condition: service_healthy
|
|
networks:
|
|
- parser_network
|
|
healthcheck:
|
|
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3333/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
# Scheduler service (runs scheduled auction parsing every 6 hours)
|
|
scheduler:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: production
|
|
container_name: parser_scheduler
|
|
restart: unless-stopped
|
|
command: ["node", "ace", "scheduler:work"]
|
|
# Use host network to bypass Docker networking issues (Windows)
|
|
network_mode: host
|
|
environment:
|
|
TZ: ${TZ:-UTC}
|
|
LOG_LEVEL: ${LOG_LEVEL:-info}
|
|
APP_KEY: ${APP_KEY}
|
|
NODE_ENV: production
|
|
SESSION_DRIVER: ${SESSION_DRIVER:-cookie}
|
|
# Connect to postgres via localhost when using host network
|
|
DB_HOST: ${DB_HOST:-localhost}
|
|
DB_PORT: ${DB_PORT:-5433}
|
|
DB_USER: ${DB_USER:-postgres}
|
|
DB_PASSWORD: ${DB_PASSWORD:-postgres}
|
|
DB_DATABASE: ${DB_DATABASE:-parser_zakupok}
|
|
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN}
|
|
ICETRADE_BASE_URL: ${ICETRADE_BASE_URL:-https://icetrade.by}
|
|
# Uncomment if using proxy:
|
|
# HTTP_PROXY: ${HTTP_PROXY}
|
|
# HTTPS_PROXY: ${HTTPS_PROXY}
|
|
# NO_PROXY: localhost,127.0.0.1
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
|
|
# Telegram bot service (runs continuously)
|
|
telegram:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
target: production
|
|
container_name: parser_telegram
|
|
restart: unless-stopped
|
|
command: ["node", "ace", "telegram:start"]
|
|
environment:
|
|
TZ: ${TZ:-UTC}
|
|
LOG_LEVEL: ${LOG_LEVEL:-info}
|
|
APP_KEY: ${APP_KEY}
|
|
NODE_ENV: production
|
|
SESSION_DRIVER: ${SESSION_DRIVER:-cookie}
|
|
DB_HOST: postgres
|
|
DB_PORT: 5432
|
|
DB_USER: ${DB_USER:-postgres}
|
|
DB_PASSWORD: ${DB_PASSWORD:-postgres}
|
|
DB_DATABASE: ${DB_DATABASE:-parser_zakupok}
|
|
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN}
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
networks:
|
|
- parser_network
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|
|
redis_data:
|
|
driver: local
|
|
|
|
networks:
|
|
parser_network:
|
|
driver: bridge
|