Newer
Older
book-metadata-service / docker-compose.yml
@malexple malexple 8 hours ago 2 KB small fix
# Быстрый старт:
#   cp .env.example .env   # и поправить пароль
#   docker compose up -d --build
#   curl http://localhost:8081/api/v1/search?q=Дорога

services:
  postgres:
    image: postgres:17-alpine
    container_name: book-metadata-postgres
    restart: unless-stopped
    environment:
      POSTGRES_DB: ${DB_NAME:-bookmetadb}
      POSTGRES_USER: ${DB_USER:-postgres}
      POSTGRES_PASSWORD: ${DB_PASSWORD:-changeme}
    volumes:
      - pgdata:/var/lib/postgresql/data
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-postgres} -d ${DB_NAME:-bookmetadb}"]
      interval: 5s
      timeout: 5s
      retries: 10
    mem_limit: 256m

  app:
    build: .
    image: malexple/book-metadata-service:latest
    container_name: book-metadata-service
    restart: unless-stopped
    depends_on:
      postgres:
        condition: service_healthy
    ports:
      - "${APP_PORT:-8080}:8081"
    environment:
      DB_HOST: postgres
      DB_PORT: 5432
      DB_NAME: ${DB_NAME:-bookmetadb}
      DB_USERNAME: ${DB_USER:-postgres}
      DB_PASSWORD: ${DB_PASSWORD:-changeme}

      GOOGLE_BOOKS_API_KEY: ${GOOGLE_BOOKS_API_KEY:-}

      LIBGEN_ENABLED: ${LIBGEN_ENABLED:-false}
      SIGLA_ENABLED: ${SIGLA_ENABLED:-false}

      LLM_FALLBACK_ENABLED: ${LLM_FALLBACK_ENABLED:-false}
      LLM_FALLBACK_SEARXNG_URL: ${LLM_FALLBACK_SEARXNG_URL:-http://searxng:${SEARXNG_PORT:-8080}}
      LLM_FALLBACK_OLLAMA_URL: ${LLM_FALLBACK_OLLAMA_URL:-http://host.docker.internal:11434}
      LLM_FALLBACK_MODEL: ${LLM_FALLBACK_MODEL:-llama3.2:3b}
      LLM_FALLBACK_CONFIDENCE: ${LLM_FALLBACK_CONFIDENCE:-0.3}
      LLM_FALLBACK_TIMEOUT_SECONDS: ${LLM_FALLBACK_TIMEOUT_SECONDS:-180}
    extra_hosts:
      - "host.docker.internal:host-gateway"
    healthcheck:
      test: ["CMD", "wget", "-qO-", "http://127.0.0.1:8081/actuator/health"]
      interval: 15s
      timeout: 5s
      retries: 5
      start_period: 30s
    mem_limit: 900m

  # searxng:
  #   image: searxng/searxng:latest
  #   container_name: searxng
  #   restart: unless-stopped
  #   ports:
  #     - "127.0.0.1:${SEARXNG_PORT:-8080}:8080"
  #   mem_limit: 256m

volumes:
  pgdata: