services: db: image: pgvector/pgvector:pg17 container_name: db restart: unless-stopped logging: options: max-size: "10m" max-file: "3" volumes: - ./data/db:/var/lib/postgresql/data networks: - proxy ports: # !сменить внешний порт перед использованием! - 5432:5432 env_file: - ./.env command: - "postgres" - "-c" - "wal_level=logical" - "-c" - "max_replication_slots=10" - "-c" - "max_wal_senders=10" - "-c" - "listen_addresses=*" healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER} -d ${POSTGRES_DB}"] interval: 10s timeout: 5s retries: 5 replication-setup: image: postgres:17-alpine container_name: replication-setup restart: "no" networks: - proxy env_file: - ./.env volumes: - ./setup-replication.sh:/setup-replication.sh entrypoint: ["/bin/sh", "/setup-replication.sh"] depends_on: api: condition: service_started db: condition: service_healthy llm: image: ollama/ollama:latest container_name: llm restart: unless-stopped logging: options: max-size: "10m" max-file: "3" volumes: - ./data/llm:/root/.ollama networks: - proxy ports: # !только локальный тест! - 11434:11434 env_file: - ./.env healthcheck: test: ["CMD", "ollama", "list"] interval: 10s timeout: 5s retries: 5 deploy: resources: limits: memory: 5g api: build: . container_name: api restart: unless-stopped command: python library_service/main.py logging: options: max-size: "10m" max-file: "3" networks: - proxy ports: # !только локальный тест! - 8000:8000 env_file: - ./.env volumes: - .:/code depends_on: db: condition: service_healthy llm: condition: service_healthy networks: proxy: # Рекомендуется использовать через реверс-прокси name: proxy external: true