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 healthcheck: test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER}"] 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-SHELL", "curl http://localhost:11434"] interval: 10s timeout: 5s retries: 5 deploy: resources: limits: memory: 5g api: build: . container_name: api restart: unless-stopped command: bash -c "uvicorn library_service.main:app --host 0.0.0.0 --port 8000 --forwarded-allow-ips=*" 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