stream / docker-compose.yml
CineMax's picture
Upload docker-compose.yml
7a4e1c5 verified
# =============================================
# STREAMCORE DOCKER COMPOSE
# =============================================
#
# DEPLOYMENT OPTIONS:
#
# β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
# β”‚ OPTION 1: Development / Local Testing (NO SSL, NO NGINX) β”‚
# β”‚ β”‚
# β”‚ docker compose up -d --build β”‚
# β”‚ β”‚
# β”‚ Access: β”‚
# β”‚ - Frontend: http://localhost:5000 β”‚
# β”‚ - Backend: http://localhost:3000 β”‚
# β”‚ - Database: localhost:5433 (mapped to container 5432) β”‚
# β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
#
# β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
# β”‚ OPTION 2: Production with SSL (NGINX + Let's Encrypt) β”‚
# β”‚ β”‚
# β”‚ 1. Set your domains: β”‚
# β”‚ export FRONTEND_DOMAIN=yourdomain.com β”‚
# β”‚ export BACKEND_DOMAIN=api.yourdomain.com β”‚
# β”‚ export LETSENCRYPT_EMAIL=admin@yourdomain.com β”‚
# β”‚ β”‚
# β”‚ 2. Update PUBLIC_BASE_URL and NEXT_PUBLIC_API_URL below β”‚
# β”‚ β”‚
# β”‚ 3. Run with proxy profile: β”‚
# β”‚ docker compose --profile proxy up -d --build β”‚
# β”‚ β”‚
# β”‚ Access: β”‚
# β”‚ - Frontend: https://yourdomain.com β”‚
# β”‚ - Backend: https://api.yourdomain.com β”‚
# β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
#
# β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
# β”‚ OPTION 3: Your Own Reverse Proxy (Nginx, Traefik, Caddy, etc.) β”‚
# β”‚ β”‚
# β”‚ docker compose up -d --build β”‚
# β”‚ β”‚
# β”‚ Then configure your own proxy to forward: β”‚
# β”‚ - yourdomain.com -> localhost:5000 β”‚
# β”‚ - api.yourdomain.com -> localhost:3000 β”‚
# β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
#
# NOTE: The nginx-proxy services are ONLY started when you use --profile proxy.
# You don't need to delete or comment anything for Options 1 or 3.
#
# CONFIGURATION: Edit the values marked with βš™οΈ EDIT below
#
# =============================================
services:
# =============================================
# POSTGRESQL DATABASE
# =============================================
postgres:
image: postgres:16
container_name: streamcore-postgres
restart: unless-stopped
environment:
# βš™οΈ EDIT: Database credentials
POSTGRES_USER: streamcore
POSTGRES_PASSWORD: StreamCore_DB_2024_Production!
POSTGRES_DB: streamcore
volumes:
- postgres-data:/var/lib/postgresql/data
ports:
- "5433:5432"
networks:
- streamcore-network
healthcheck:
test: [ "CMD-SHELL", "pg_isready -U streamcore -d streamcore" ]
interval: 5s
timeout: 5s
retries: 10
start_period: 10s
# =============================================
# BACKEND API (Rust/Axum)
# =============================================
backend:
build:
context: ./backend
container_name: streamcore-backend
restart: unless-stopped
environment:
# Server
SERVER_ADDRESS: "0.0.0.0:3000"
# βš™οΈ EDIT: Must match postgres credentials above
DATABASE_URL: "postgres://streamcore:StreamCore_DB_2024_Production!@postgres:5432/streamcore"
# βš™οΈ EDIT: URLs (change to your domains for production)
PUBLIC_BASE_URL: "https://apistreamcore.syruum.com"
CORS_ALLOWED_ORIGINS: "https://streamcore.syruum.com,https://apistreamcore.syruum.com,http://localhost:5000,http://localhost:3000"
# βš™οΈ EDIT: Security - CHANGE THESE IN PRODUCTION!
JWT_SECRET: "${JWT_SECRET:-ae85a308c80be3b2006da9126620c5fbc2ceadeadbe9c8e9040e9ad0c5d362c8}"
ADMIN_DEFAULT_PASSWORD: "${ADMIN_DEFAULT_PASSWORD:-22333265}"
# βš™οΈ EDIT: Stripe (optional - for reseller payments)
STRIPE_SECRET_KEY: "sk_test_placeholder"
STRIPE_WEBHOOK_SECRET: "whsec_placeholder"
STRIPE_CURRENCY: "usd"
STRIPE_SUCCESS_URL: "https://streamcore.syruum.com/credits/success"
STRIPE_CANCEL_URL: "https://streamcore.syruum.com/credits/cancel"
# Backup Configuration
BACKUP_ENABLED: "true"
BACKUP_DIR: "/data/backups"
BACKUP_RETENTION_DAYS: "30"
BACKUP_INTERVAL_HOURS: "24"
# App Config
CONTENT_OVERVIEW_MULTIPLIER: "x1"
SKIP_MIGRATIONS: "false"
RUST_LOG: "iptv_backend=info,tower_http=warn,sqlx=warn"
DEBUG_MODE: "false"
# Nginx Proxy config (used when profile=proxy)
# βš™οΈ EDIT: Change to your backend domain
VIRTUAL_HOST: "apistreamcore.syruum.com"
VIRTUAL_PORT: "3000"
LETSENCRYPT_HOST: "apistreamcore.syruum.com"
LETSENCRYPT_EMAIL: "admin@syruum.com"
volumes:
- backend-data:/data
- /media:/media
ports:
- "3000:3000"
networks:
- streamcore-network
depends_on:
postgres:
condition: service_healthy
# =============================================
# FRONTEND WEB APP (Next.js)
# =============================================
frontend:
build:
context: ./frontend
args:
# βš™οΈ EDIT: Your app name
APP_NAME: "StreamCore"
# βš™οΈ EDIT: CRITICAL - Must be set at build time for client-side code
NEXT_PUBLIC_API_URL: "https://apistreamcore.syruum.com"
container_name: streamcore-frontend
restart: unless-stopped
environment:
# API URLs
INTERNAL_API_URL: "http://backend:3000"
# βš™οΈ EDIT: Change to your backend domain for production
NEXT_PUBLIC_API_URL: "https://apistreamcore.syruum.com"
NEXT_PUBLIC_APP_NAME: "StreamCore"
# Proxy settings
STREAMCORE_PROXY_ALLOWED_HOSTS: "*"
STREAMCORE_PROXY_REQUIRE_AUTH: "false"
STREAMCORE_PROXY_ALLOW_PRIVATE: "true"
# Nginx Proxy config (used when profile=proxy)
# βš™οΈ EDIT: Change to your frontend domain
VIRTUAL_HOST: "streamcore.syruum.com"
VIRTUAL_PORT: "5000"
LETSENCRYPT_HOST: "streamcore.syruum.com"
LETSENCRYPT_EMAIL: "admin@syruum.com"
depends_on:
- backend
ports:
- "5000:5000"
networks:
- streamcore-network
# =============================================
# NGINX REVERSE PROXY (Production with SSL)
# =============================================
# Automatically generates SSL certificates via Let's Encrypt
# Enable with: docker compose --profile proxy up -d --build
#
# Required environment variables (set in .env or export):
# FRONTEND_DOMAIN=yourdomain.com
# BACKEND_DOMAIN=api.yourdomain.com
# LETSENCRYPT_EMAIL=admin@yourdomain.com
#
nginx-proxy:
image: nginxproxy/nginx-proxy:1.4
container_name: nginx-proxy
restart: always
profiles:
- proxy
ports:
- "80:80"
- "443:443"
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- nginx-certs:/etc/nginx/certs:ro
- nginx-vhost:/etc/nginx/vhost.d
- nginx-html:/usr/share/nginx/html
- ./nginx/custom.conf:/etc/nginx/conf.d/custom.conf:ro
networks:
- streamcore-network
acme-companion:
image: nginxproxy/acme-companion:2.2
container_name: acme-companion
restart: always
profiles:
- proxy
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- nginx-certs:/etc/nginx/certs:rw
- nginx-vhost:/etc/nginx/vhost.d
- nginx-html:/usr/share/nginx/html
- acme-state:/etc/acme.sh
environment:
# βš™οΈ EDIT: Your email for Let's Encrypt notifications
DEFAULT_EMAIL: "admin@syruum.com"
NGINX_PROXY_CONTAINER: nginx-proxy
depends_on:
- nginx-proxy
networks:
- streamcore-network
networks:
streamcore-network:
driver: bridge
volumes:
backend-data:
postgres-data:
nginx-certs:
nginx-vhost:
nginx-html:
acme-state: