0.1.41 Release fixes (#889)
<!-- .github/pull_request_template.md --> ## Description <!-- Provide a clear description of the changes in this PR --> ## DCO Affirmation I affirm that all code in every commit of this pull request conforms to the terms of the Topoteretes Developer Certificate of Origin.
This commit is contained in:
parent
d8ef2903ba
commit
d91602e24b
15 changed files with 5150 additions and 16 deletions
|
|
@ -45,6 +45,10 @@ uv sync --extra debug --extra api --extra postgres --extra weaviate --extra qdra
|
||||||
|
|
||||||
FROM python:3.12-slim-bookworm
|
FROM python:3.12-slim-bookworm
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
libpq5 \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=uv /app /app
|
COPY --from=uv /app /app
|
||||||
|
|
@ -57,5 +61,7 @@ RUN chmod +x /app/entrypoint.sh
|
||||||
ENV PATH="/app/.venv/bin:$PATH"
|
ENV PATH="/app/.venv/bin:$PATH"
|
||||||
|
|
||||||
ENV PYTHONPATH=/app
|
ENV PYTHONPATH=/app
|
||||||
|
# ENV LOG_LEVEL=ERROR
|
||||||
|
ENV PYTHONUNBUFFERED=1
|
||||||
|
|
||||||
ENTRYPOINT ["/app/entrypoint.sh"]
|
ENTRYPOINT ["/app/entrypoint.sh"]
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,7 @@ depends_on: Union[str, Sequence[str], None] = "8057ae7329c2"
|
||||||
|
|
||||||
|
|
||||||
def upgrade() -> None:
|
def upgrade() -> None:
|
||||||
try:
|
await_only(create_default_user())
|
||||||
await_only(create_default_user())
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
def downgrade() -> None:
|
def downgrade() -> None:
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,10 @@ RUN --mount=type=cache,target=/root/.cache/uv \
|
||||||
|
|
||||||
FROM python:3.12-slim-bookworm
|
FROM python:3.12-slim-bookworm
|
||||||
|
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
libpq5 \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
COPY --from=uv /root/.local /root/.local
|
COPY --from=uv /root/.local /root/.local
|
||||||
|
|
|
||||||
|
|
@ -13,17 +13,22 @@ echo "Environment: $ENVIRONMENT"
|
||||||
# inconsistencies and should cause the startup to fail. This check allows for
|
# inconsistencies and should cause the startup to fail. This check allows for
|
||||||
# smooth redeployments and container restarts while maintaining data integrity.
|
# smooth redeployments and container restarts while maintaining data integrity.
|
||||||
echo "Running database migrations..."
|
echo "Running database migrations..."
|
||||||
MIGRATION_OUTPUT=$(uv run alembic upgrade head 2>&1) || {
|
|
||||||
if [[ $MIGRATION_OUTPUT == *"UserAlreadyExists"* ]] || [[ $MIGRATION_OUTPUT == *"User default_user@example.com already exists"* ]]; then
|
MIGRATION_OUTPUT=$(alembic upgrade head 2>&1)
|
||||||
|
MIGRATION_EXIT_CODE=$?
|
||||||
|
|
||||||
|
if [[ $MIGRATION_EXIT_CODE -ne 0 ]]; then
|
||||||
|
if [[ "$MIGRATION_OUTPUT" == *"UserAlreadyExists"* ]] || [[ "$MIGRATION_OUTPUT" == *"User default_user@example.com already exists"* ]]; then
|
||||||
echo "Warning: Default user already exists, continuing startup..."
|
echo "Warning: Default user already exists, continuing startup..."
|
||||||
else
|
else
|
||||||
echo "Migration failed with unexpected error:"
|
echo "Migration failed with unexpected error."
|
||||||
echo "$MIGRATION_OUTPUT"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
fi
|
||||||
|
|
||||||
echo "Starting Cognee MCP Server"
|
echo "Database migrations done."
|
||||||
|
|
||||||
|
echo "Starting Cognee MCP Server..."
|
||||||
|
|
||||||
# Add startup delay to ensure DB is ready
|
# Add startup delay to ensure DB is ready
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
|
||||||
5083
cognee-mcp/uv.lock
generated
Normal file
5083
cognee-mcp/uv.lock
generated
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,2 +1,3 @@
|
||||||
from .config import get_graph_config
|
from .config import get_graph_config
|
||||||
from .get_graph_engine import get_graph_engine
|
from .get_graph_engine import get_graph_engine
|
||||||
|
from .use_graph_adapter import use_graph_adapter
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,10 @@
|
||||||
|
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
|
|
||||||
|
|
||||||
from .config import get_graph_config
|
from .config import get_graph_config
|
||||||
from .graph_db_interface import GraphDBInterface
|
from .graph_db_interface import GraphDBInterface
|
||||||
|
from .supported_databases import supported_databases
|
||||||
|
|
||||||
|
|
||||||
async def get_graph_engine() -> GraphDBInterface:
|
async def get_graph_engine() -> GraphDBInterface:
|
||||||
|
|
@ -74,6 +76,15 @@ def create_graph_engine(
|
||||||
specified.
|
specified.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if graph_database_provider in supported_databases:
|
||||||
|
adapter = supported_databases[graph_database_provider]
|
||||||
|
|
||||||
|
return adapter(
|
||||||
|
graph_database_url=graph_database_url,
|
||||||
|
graph_database_username=graph_database_username,
|
||||||
|
graph_database_password=graph_database_password,
|
||||||
|
)
|
||||||
|
|
||||||
if graph_database_provider == "neo4j":
|
if graph_database_provider == "neo4j":
|
||||||
if not (graph_database_url and graph_database_username and graph_database_password):
|
if not (graph_database_url and graph_database_username and graph_database_password):
|
||||||
raise EnvironmentError("Missing required Neo4j credentials.")
|
raise EnvironmentError("Missing required Neo4j credentials.")
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
supported_databases = {}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
from .supported_databases import supported_databases
|
||||||
|
|
||||||
|
|
||||||
|
def use_graph_adapter(vector_db_name, vector_db_adapter):
|
||||||
|
supported_databases[vector_db_name] = vector_db_adapter
|
||||||
|
|
@ -3,3 +3,4 @@ from .models.CollectionConfig import CollectionConfig
|
||||||
from .vector_db_interface import VectorDBInterface
|
from .vector_db_interface import VectorDBInterface
|
||||||
from .config import get_vectordb_config
|
from .config import get_vectordb_config
|
||||||
from .get_vector_engine import get_vector_engine
|
from .get_vector_engine import get_vector_engine
|
||||||
|
from .use_vector_adapter import use_vector_adapter
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
from .supported_databases import supported_databases
|
||||||
from .embeddings import get_embedding_engine
|
from .embeddings import get_embedding_engine
|
||||||
|
|
||||||
from functools import lru_cache
|
from functools import lru_cache
|
||||||
|
|
@ -38,6 +39,15 @@ def create_vector_engine(
|
||||||
"""
|
"""
|
||||||
embedding_engine = get_embedding_engine()
|
embedding_engine = get_embedding_engine()
|
||||||
|
|
||||||
|
if vector_db_provider in supported_databases:
|
||||||
|
adapter = supported_databases[vector_db_provider]
|
||||||
|
|
||||||
|
return adapter(
|
||||||
|
utl=vector_db_url,
|
||||||
|
api_key=vector_db_key,
|
||||||
|
embedding_engine=embedding_engine,
|
||||||
|
)
|
||||||
|
|
||||||
if vector_db_provider == "weaviate":
|
if vector_db_provider == "weaviate":
|
||||||
from .weaviate_db import WeaviateAdapter
|
from .weaviate_db import WeaviateAdapter
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
supported_databases = {}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
from .supported_databases import supported_databases
|
||||||
|
|
||||||
|
|
||||||
|
def use_vector_adapter(vector_db_name, vector_db_adapter):
|
||||||
|
supported_databases[vector_db_name] = vector_db_adapter
|
||||||
|
|
@ -13,7 +13,7 @@ services:
|
||||||
- DEBUG=false # Change to true if debugging
|
- DEBUG=false # Change to true if debugging
|
||||||
- HOST=0.0.0.0
|
- HOST=0.0.0.0
|
||||||
- ENVIRONMENT=local
|
- ENVIRONMENT=local
|
||||||
- PYTHONPATH=.
|
- LOG_LEVEL=ERROR
|
||||||
extra_hosts:
|
extra_hosts:
|
||||||
# Allows the container to reach your local machine using "host.docker.internal" instead of "localhost"
|
# Allows the container to reach your local machine using "host.docker.internal" instead of "localhost"
|
||||||
- "host.docker.internal:host-gateway"
|
- "host.docker.internal:host-gateway"
|
||||||
|
|
|
||||||
|
|
@ -13,15 +13,19 @@ echo "Environment: $ENVIRONMENT"
|
||||||
# inconsistencies and should cause the startup to fail. This check allows for
|
# inconsistencies and should cause the startup to fail. This check allows for
|
||||||
# smooth redeployments and container restarts while maintaining data integrity.
|
# smooth redeployments and container restarts while maintaining data integrity.
|
||||||
echo "Running database migrations..."
|
echo "Running database migrations..."
|
||||||
MIGRATION_OUTPUT=$(alembic upgrade head 2>&1) || {
|
|
||||||
if [[ $MIGRATION_OUTPUT == *"UserAlreadyExists"* ]] || [[ $MIGRATION_OUTPUT == *"User default_user@example.com already exists"* ]]; then
|
MIGRATION_OUTPUT=$(alembic upgrade head 2>&1)
|
||||||
|
MIGRATION_EXIT_CODE=$?
|
||||||
|
|
||||||
|
if [[ $MIGRATION_EXIT_CODE -ne 0 ]]; then
|
||||||
|
if [[ "$MIGRATION_OUTPUT" == *"UserAlreadyExists"* ]] || [[ "$MIGRATION_OUTPUT" == *"User default_user@example.com already exists"* ]]; then
|
||||||
echo "Warning: Default user already exists, continuing startup..."
|
echo "Warning: Default user already exists, continuing startup..."
|
||||||
else
|
else
|
||||||
echo "Migration failed with unexpected error:"
|
echo "Migration failed with unexpected error."
|
||||||
echo "$MIGRATION_OUTPUT"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
fi
|
||||||
|
|
||||||
echo "Database migrations done."
|
echo "Database migrations done."
|
||||||
|
|
||||||
echo "Starting server..."
|
echo "Starting server..."
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue