- Pridaná coolify sieť do postgres a backend služieb - Deklarovaná coolify ako external network - Umožní Traefik-u routovať požiadavky na backend - Opravuje "no available server" chybu 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
117 lines
3.2 KiB
YAML
117 lines
3.2 KiB
YAML
version: '3.8'
|
|
|
|
services:
|
|
# PostgreSQL Database
|
|
postgres:
|
|
image: postgres:15-alpine
|
|
container_name: ebook_postgres
|
|
restart: unless-stopped
|
|
environment:
|
|
POSTGRES_DB: ${POSTGRES_DB:-ebook_prod}
|
|
POSTGRES_USER: ${POSTGRES_USER:-ebook_user}
|
|
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-changeme123}
|
|
POSTGRES_INITDB_ARGS: "--encoding=UTF8 --lc-collate=sk_SK.UTF-8 --lc-ctype=sk_SK.UTF-8"
|
|
volumes:
|
|
- postgres_data:/var/lib/postgresql/data
|
|
- ./init-scripts:/docker-entrypoint-initdb.d
|
|
# ports:
|
|
# - "5432:5432" # Commented for Coolify - not needed with Traefik
|
|
networks:
|
|
- ebook_network
|
|
- coolify
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-ebook_user} -d ${POSTGRES_DB:-ebook_prod}"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 30s
|
|
|
|
# Backend API + Frontend
|
|
backend:
|
|
build:
|
|
context: ./ebook_backend_admin_panel
|
|
dockerfile: Dockerfile
|
|
container_name: ebook_backend
|
|
restart: unless-stopped
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
environment:
|
|
# Database
|
|
DATABASE_URL: postgresql://${POSTGRES_USER:-ebook_user}:${POSTGRES_PASSWORD:-changeme123}@postgres:5432/${POSTGRES_DB:-ebook_prod}
|
|
|
|
# Security
|
|
SECRET_KEY: ${SECRET_KEY:-change-this-in-production-use-32-chars-minimum}
|
|
DEBUG: ${DEBUG:-false}
|
|
ENVIRONMENT: ${ENVIRONMENT:-production}
|
|
|
|
# Admin
|
|
ADMIN_USERNAME: ${ADMIN_USERNAME:-admin}
|
|
ADMIN_PASSWORD: ${ADMIN_PASSWORD:-admin@123}
|
|
|
|
# CORS
|
|
CORS_ORIGINS: ${CORS_ORIGINS:-http://localhost:8000}
|
|
TRUSTED_HOSTS: ${TRUSTED_HOSTS:-*}
|
|
|
|
# Application
|
|
APP_NAME: ${APP_NAME:-Ebook Translation System}
|
|
APP_VERSION: ${APP_VERSION:-1.0.0}
|
|
LOG_LEVEL: ${LOG_LEVEL:-INFO}
|
|
|
|
# Server
|
|
HOST: 0.0.0.0
|
|
PORT: 8000
|
|
# ports:
|
|
# - "8000:8000" # Commented for Coolify - Traefik handles routing
|
|
expose:
|
|
- "8000" # Internal exposure only, Traefik will route to this
|
|
labels:
|
|
- "coolify.managed=true"
|
|
- "coolify.type=application"
|
|
# Coolify automatically adds Traefik labels based on domain config
|
|
volumes:
|
|
# Pre persistenciu logov a translation súborov
|
|
- backend_logs:/app/admin-backend/logs
|
|
- translation_files:/app/admin-backend/translationfile
|
|
networks:
|
|
- ebook_network
|
|
- coolify
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:8000/health"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 3
|
|
start_period: 40s
|
|
|
|
# Nginx Reverse Proxy (voliteľné - Coolify má vlastný)
|
|
# nginx:
|
|
# image: nginx:alpine
|
|
# container_name: ebook_nginx
|
|
# restart: unless-stopped
|
|
# depends_on:
|
|
# - backend
|
|
# ports:
|
|
# - "80:80"
|
|
# - "443:443"
|
|
# volumes:
|
|
# - ./nginx/nginx.conf:/etc/nginx/nginx.conf:ro
|
|
# - ./nginx/ssl:/etc/nginx/ssl:ro
|
|
# networks:
|
|
# - ebook_network
|
|
|
|
networks:
|
|
ebook_network:
|
|
driver: bridge
|
|
name: ebook_network
|
|
coolify:
|
|
external: true
|
|
name: coolify
|
|
|
|
volumes:
|
|
postgres_data:
|
|
name: ebook_postgres_data
|
|
backend_logs:
|
|
name: ebook_backend_logs
|
|
translation_files:
|
|
name: ebook_translation_files
|