Aniworld/docker/docker-compose.yml

167 lines
3.9 KiB
YAML

version: "3.8"
services:
# AniWorld Web Application
aniworld-web:
build:
context: .
dockerfile: Dockerfile
container_name: aniworld-web
restart: unless-stopped
environment:
- ANIME_DIRECTORY=/app/data/anime
- DATABASE_PATH=/app/data/aniworld.db
- LOG_LEVEL=INFO
- FLASK_ENV=production
- WEB_HOST=0.0.0.0
- WEB_PORT=5000
- MASTER_PASSWORD=${MASTER_PASSWORD:-admin123}
volumes:
- anime_data:/app/data
- anime_logs:/app/logs
- anime_backups:/app/backups
- anime_temp:/app/temp
- ${ANIME_DIRECTORY:-./data}:/app/data/anime
ports:
- "${WEB_PORT:-5000}:5000"
networks:
- aniworld
- vpn
depends_on:
- redis
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:5000/api/health/system"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
# Redis for caching and session management
redis:
image: redis:7-alpine
container_name: aniworld-redis
restart: unless-stopped
command: redis-server --appendonly yes
volumes:
- redis_data:/data
networks:
- aniworld
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 30s
timeout: 3s
retries: 3
# Nginx reverse proxy
nginx:
image: nginx:alpine
container_name: aniworld-nginx
restart: unless-stopped
ports:
- "${HTTP_PORT:-80}:80"
- "${HTTPS_PORT:-443}:443"
volumes:
- ./docker/nginx/nginx.conf:/etc/nginx/nginx.conf:ro
- ./docker/nginx/ssl:/etc/nginx/ssl:ro
- nginx_logs:/var/log/nginx
networks:
- aniworld
depends_on:
- aniworld-web
healthcheck:
test: ["CMD", "wget", "--quiet", "--tries=1", "--spider", "http://localhost/health"]
interval: 30s
timeout: 10s
retries: 3
# Monitoring with Prometheus (optional)
prometheus:
image: prom/prometheus
container_name: aniworld-prometheus
restart: unless-stopped
command:
- '--config.file=/etc/prometheus/prometheus.yml'
- '--storage.tsdb.path=/prometheus'
- '--web.console.libraries=/etc/prometheus/console_libraries'
- '--web.console.templates=/etc/prometheus/consoles'
- '--storage.tsdb.retention.time=200h'
- '--web.enable-lifecycle'
volumes:
- ./docker/prometheus:/etc/prometheus
- prometheus_data:/prometheus
networks:
- aniworld
profiles:
- monitoring
# Grafana for monitoring dashboards (optional)
grafana:
image: grafana/grafana
container_name: aniworld-grafana
restart: unless-stopped
environment:
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD:-admin}
volumes:
- grafana_data:/var/lib/grafana
- ./docker/grafana/provisioning:/etc/grafana/provisioning
ports:
- "${GRAFANA_PORT:-3000}:3000"
networks:
- aniworld
depends_on:
- prometheus
profiles:
- monitoring
# VPN/Network services (existing)
wireguard:
container_name: aniworld-wireguard
image: jordanpotter/wireguard
user: "1013:1001"
cap_add:
- NET_ADMIN
- SYS_MODULE
sysctls:
net.ipv4.conf.all.src_valid_mark: 1
volumes:
- ${WG_CONFIG_PATH:-/server_aniworld/wg0.conf}:/etc/wireguard/wg0.conf
restart: unless-stopped
networks:
- vpn
profiles:
- vpn
# Network test utility
curl:
image: curlimages/curl
command: ifconfig.io
user: "1013:1001"
network_mode: service:wireguard
depends_on:
- wireguard
profiles:
- vpn
networks:
aniworld:
driver: bridge
vpn:
driver: bridge
volumes:
anime_data:
driver: local
anime_logs:
driver: local
anime_backups:
driver: local
anime_temp:
driver: local
redis_data:
driver: local
nginx_logs:
driver: local
prometheus_data:
driver: local
grafana_data:
driver: local