mirror of
https://github.com/BEDOLAGA-DEV/remnawave-bedolaga-telegram-bot.git
synced 2026-01-20 03:40:26 +00:00
103 lines
2.4 KiB
YAML
103 lines
2.4 KiB
YAML
|
|
services:
|
|
# PostgreSQL Database
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: remnawave_bot_db
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: remnawave_bot
|
|
POSTGRES_USER: remnawave_user
|
|
POSTGRES_PASSWORD: secure_password_123
|
|
POSTGRES_INITDB_ARGS: "--encoding=UTF-8 --lc-collate=C --lc-ctype=C"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./init-db.sql:/docker-entrypoint-initdb.d/init-db.sql:ro
|
|
ports:
|
|
- "5432:5432"
|
|
networks:
|
|
- bot_network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U remnawave_user -d remnawave_bot"]
|
|
interval: 15s
|
|
timeout: 10s
|
|
retries: 5
|
|
start_period: 30s
|
|
|
|
# RemnaWave Bot
|
|
bot:
|
|
build:
|
|
context: .
|
|
dockerfile: Dockerfile
|
|
container_name: remnawave_bot
|
|
restart: unless-stopped
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
env_file:
|
|
- .env
|
|
environment:
|
|
# Override database URL to use PostgreSQL container
|
|
DATABASE_URL: postgresql+asyncpg://remnawave_user:secure_password_123@postgres:5432/remnawave_bot
|
|
volumes:
|
|
- ./logs:/app/logs
|
|
- ./data:/app/data
|
|
networks:
|
|
- bot_network
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "python -c 'print(\"Bot is running\")'"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 30s
|
|
|
|
# Redis (optional, for caching and session storage)
|
|
redis:
|
|
image: redis:7-alpine
|
|
container_name: remnawave_bot_redis
|
|
restart: unless-stopped
|
|
command: redis-server --appendonly yes --requirepass redis_password_123
|
|
volumes:
|
|
- redis_data:/data
|
|
ports:
|
|
- "6379:6379"
|
|
networks:
|
|
- bot_network
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "--raw", "incr", "ping"]
|
|
interval: 10s
|
|
timeout: 3s
|
|
retries: 5
|
|
|
|
# Nginx (optional, for serving static files or reverse proxy)
|
|
nginx:
|
|
image: nginx:alpine
|
|
container_name: remnawave_bot_nginx
|
|
restart: unless-stopped
|
|
ports:
|
|
- "80:80"
|
|
- "443:443"
|
|
volumes:
|
|
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
|
- ./ssl:/etc/nginx/ssl:ro
|
|
- ./static:/usr/share/nginx/html:ro
|
|
networks:
|
|
- bot_network
|
|
depends_on:
|
|
- bot
|
|
profiles:
|
|
- with-nginx
|
|
|
|
volumes:
|
|
postgres_data:
|
|
driver: local
|
|
redis_data:
|
|
driver: local
|
|
|
|
networks:
|
|
bot_network:
|
|
driver: bridge
|
|
ipam:
|
|
config:
|
|
- subnet: 172.20.0.0/16
|