diff --git a/Dockerfile b/Dockerfile index 00e5a00..c7df417 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,5 +8,8 @@ FROM base AS test RUN chmod +x docker-entrypoint.sh CMD ["./docker-entrypoint.sh"] +FROM base AS dev-server +CMD ["fastapi", "run", "dev", "--port", "3000"] + FROM base AS prod CMD ["celery", "-A", "worker", "worker", "-l", "INFO"] diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 0000000..d22a0d1 --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,111 @@ +--- + +services: + app: + build: + context: . + target: dev-server + dockerfile: Dockerfile + ports: + - "3000:3000" + environment: + - PORT=3000 + - MONGODB_HOST=mongo + - MONGODB_PORT=27017 + - MONGODB_USER=root + - MONGODB_PASS=pass + - TRACELOOP_BASE_URL=some_url + - NEO4J_PROTOCOL=bolt + - NEO4J_HOST=neo4j + - NEO4J_PORT=7687 + - NEO4J_USER=neo4j + - NEO4J_PASSWORD=password + - NEO4J_DB=neo4j + - POSTGRES_HOST=postgres + - POSTGRES_USER=root + - POSTGRES_PASS=pass + - POSTGRES_PORT=5432 + - RABBIT_HOST=rabbitmq + - RABBIT_PORT=5672 + - RABBIT_USER=root + - RABBIT_PASSWORD=pass + - CHUNK_SIZE=512 + - EMBEDDING_DIM=1024 + - K1_RETRIEVER_SEARCH=20 + - K2_RETRIEVER_SEARCH=5 + - D_RETRIEVER_SEARCH=7 + - COHERE_API_KEY=some_credentials + - OPENAI_API_KEY=some_credentials2 + - QDRANT_HOST=qdrant + - QDRANT_PORT=6333 + - QDRANT_API_KEY= + volumes: + - ./coverage:/project/coverage + depends_on: + rabbitmq: + condition: service_healthy + mongo: + condition: service_healthy + postgres: + condition: service_healthy + qdrant-healthcheck: + condition: service_healthy + mongo: + image: "mongo:6.0.8" + environment: + - MONGO_INITDB_ROOT_USERNAME=root + - MONGO_INITDB_ROOT_PASSWORD=pass + healthcheck: + test: echo 'db.stats().ok' | mongosh localhost:27017/test --quiet + interval: 60s + timeout: 10s + retries: 2 + start_period: 40s + postgres: + image: "ankane/pgvector" + environment: + - POSTGRES_USER=root + - POSTGRES_PASSWORD=pass + healthcheck: + test: [ "CMD-SHELL", "pg_isready" ] + interval: 10s + timeout: 5s + retries: 5 + rabbitmq: + image: "rabbitmq:3-management-alpine" + environment: + - RABBITMQ_DEFAULT_USER=root + - RABBITMQ_DEFAULT_PASS=pass + healthcheck: + test: rabbitmq-diagnostics -q ping + interval: 30s + timeout: 30s + retries: 2 + start_period: 40s + qdrant: + image: qdrant/qdrant:v1.9.2 + restart: always + container_name: qdrant + ports: + - 6333:6333 + expose: + - 6333 + volumes: + - ./qdrant_data:/qdrant_data + qdrant-healthcheck: + restart: always + image: curlimages/curl:latest + entrypoint: + [ + "/bin/sh", + "-c", + "--", + "while true; do sleep 30; done;" + ] + depends_on: + - qdrant + healthcheck: + test: [ "CMD", "curl", "-f", "http://qdrant:6333/readyz" ] + interval: 10s + timeout: 2s + retries: 5 diff --git a/docker-compose.example.yml b/docker-compose.example.yml deleted file mode 100644 index 54891ef..0000000 --- a/docker-compose.example.yml +++ /dev/null @@ -1,50 +0,0 @@ ---- - -services: - api: - build: - context: . - target: prod - command: uvicorn main:app --host 0.0.0.0 --port 8000 --reload - ports: - - 8000:8000 - environment: - - RABBIT_USER=root - - RABBIT_PASSWORD=pass - - RABBIT_HOST=rabbitmq - - RABBIT_PORT=5672 - - REDIS_PASSWORD=pass - - REDIS_HOST=redis - - REDIS_PORT=6379 - volumes: - - ./:/project/ - worker: - build: - context: . - target: prod - dockerfile: Dockerfile - environment: - - RABBIT_USER=root - - RABBIT_PASSWORD=pass - - RABBIT_HOST=rabbitmq - - RABBIT_PORT=5672 - - REDIS_PASSWORD=pass - - REDIS_HOST=redis - - REDIS_PORT=6379 - rabbitmq: - image: "rabbitmq:3-management-alpine" - environment: - - RABBITMQ_DEFAULT_USER=root - - RABBITMQ_DEFAULT_PASS=pass - healthcheck: - test: rabbitmq-diagnostics -q ping - interval: 30s - timeout: 30s - retries: 2 - start_period: 40s - ports: - - 5672:5672 - redis: - image: bitnami/redis - environment: - - REDIS_PASSWORD=pass diff --git a/requirements.txt b/requirements.txt index 117b496..4c1e138 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,6 +24,6 @@ tc-messageBroker==1.7.1 traceloop-sdk==0.14.1 backoff==2.2.1 fastapi[standard]==0.114.1 -faststream==0.5.23 +faststream==0.5.28 aio_pika==9.4.0 mongomock==4.2.0.post1