From 26b7f45e586a408acf05d243bd0636a33be2e43d Mon Sep 17 00:00:00 2001 From: Luis Otavio Date: Wed, 22 Jan 2025 03:20:15 -0300 Subject: [PATCH] Refactor: Update configuration for database ports and remove unused dependencies; enhance API server settings --- apps/ai_api/eda_ai_api/main.py | 11 +++++++---- apps/ai_api/uv.lock | 18 +----------------- config.example.yaml | 6 ++++-- deploy/trigger-stack/export-config.ts | 2 +- packages/config/python/eda_config/types.py | 2 ++ packages/config/python/pyproject.toml | 2 +- packages/config/typescript/package.json | 2 +- packages/config/typescript/src/types.ts | 2 ++ 8 files changed, 19 insertions(+), 26 deletions(-) diff --git a/apps/ai_api/eda_ai_api/main.py b/apps/ai_api/eda_ai_api/main.py index 648b210..3ba7007 100644 --- a/apps/ai_api/eda_ai_api/main.py +++ b/apps/ai_api/eda_ai_api/main.py @@ -31,12 +31,15 @@ def run_server() -> None: # Use localhost for development, configure via config for production host = "127.0.0.1" # Default to localhost - if config.services.ai_api.get( - "allow_external", False - ): # Only if explicitly enabled + if ( + hasattr(config.services.ai_api, "allow_external") + and config.services.ai_api.allow_external + ): host = "0.0.0.0" # nosec B104 # Explicitly allowed in config - uvicorn.run("eda_ai_api.main:app", host=host, port=config.ports.ai_api, reload=True) + uvicorn.run( + "eda_ai_api.main:app", host=host, port=config.ports.ai_api, reload=True + ) if __name__ == "__main__": diff --git a/apps/ai_api/uv.lock b/apps/ai_api/uv.lock index b398338..e0e7c07 100644 --- a/apps/ai_api/uv.lock +++ b/apps/ai_api/uv.lock @@ -863,7 +863,6 @@ dependencies = [ { name = "rank-bm25" }, { name = "requests" }, { name = "uvicorn" }, - { name = "zep-python" }, ] [package.optional-dependencies] @@ -912,12 +911,11 @@ requires-dist = [ { name = "rank-bm25", specifier = ">=0.2.2" }, { name = "requests", specifier = ">=2.31.0" }, { name = "uvicorn", specifier = ">=0.25.0" }, - { name = "zep-python", specifier = ">=2.0.2" }, ] [[package]] name = "eda-config" -version = "0.1.13" +version = "0.1.19" source = { directory = "../../packages/config/python" } dependencies = [ { name = "pydantic" }, @@ -5303,20 +5301,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/93/86/f1305e1ab1d6dc27d245ffc83d18d88f2bebf6c6488725ee82dffb3eda7a/yarl-1.17.0-py3-none-any.whl", hash = "sha256:62dd42bb0e49423f4dd58836a04fcf09c80237836796025211bbe913f1524993", size = 44053 }, ] -[[package]] -name = "zep-python" -version = "2.0.2" -source = { registry = "https://pypi.org/simple" } -dependencies = [ - { name = "httpx" }, - { name = "pydantic" }, - { name = "typing-extensions" }, -] -sdist = { url = "https://files.pythonhosted.org/packages/b5/64/1b0c4afa6d0e8f35e1072eacdfe8ec216871be5f2dfd569942f69232482f/zep_python-2.0.2.tar.gz", hash = "sha256:919fd635ad5801f30d9ef6da0bb99e854ed4c3cd1357dc8ada4a39b8171a41bc", size = 22273 } -wheels = [ - { url = "https://files.pythonhosted.org/packages/1c/d4/09a6bc0c32f91b7b5b93322513d51299ca9b35bdd6b0560b39104c296f39/zep_python-2.0.2-py3-none-any.whl", hash = "sha256:d7b2cadf1eb15007825362cae5ddff9c9d0ada5b4f75cf91e5b87986459f7817", size = 40011 }, -] - [[package]] name = "zipp" version = "3.20.2" diff --git a/config.example.yaml b/config.example.yaml index 29e783c..072a814 100644 --- a/config.example.yaml +++ b/config.example.yaml @@ -10,7 +10,9 @@ ports: landingpage: 8081 docs: 8082 db: - postgres: 5432 + postgres: 5439 + trigger_postgres: 5440 + langtrace_postgres: 5441 redis: 6379 neo4j: http: 7474 # Neo4j browser interface @@ -114,7 +116,7 @@ services: trigger: project_id: "xxx" api_url: "http://localhost:3040" - environment: "development" + environment: "production" runtime: "docker-compose" v3_enabled: true concurrency: diff --git a/deploy/trigger-stack/export-config.ts b/deploy/trigger-stack/export-config.ts index 269e5d0..7277f9b 100644 --- a/deploy/trigger-stack/export-config.ts +++ b/deploy/trigger-stack/export-config.ts @@ -18,7 +18,7 @@ const envVars = { DIRECT_URL: `postgresql://${config.databases.trigger_postgres.user}:${config.databases.trigger_postgres.password}@postgres:5432/${config.databases.trigger_postgres.database}`, // Add this line // Add database ports - POSTGRES_PORT: config.ports.db.postgres, + POSTGRES_PORT: config.ports.db.trigger_postgres, // Use trigger-specific port REDIS_PORT: config.ports.db.redis, // Redis settings diff --git a/packages/config/python/eda_config/types.py b/packages/config/python/eda_config/types.py index 170887a..6a3090f 100644 --- a/packages/config/python/eda_config/types.py +++ b/packages/config/python/eda_config/types.py @@ -64,6 +64,8 @@ class ApiKeys(BaseModel): class DbPorts(BaseModel): postgres: int + trigger_postgres: int # Add new port + langtrace_postgres: int # Add new port redis: int neo4j: Dict[str, int] clickhouse: int diff --git a/packages/config/python/pyproject.toml b/packages/config/python/pyproject.toml index b0e5856..a0842e9 100644 --- a/packages/config/python/pyproject.toml +++ b/packages/config/python/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "eda-config" -version = "0.1.16" +version = "0.1.19" description = "Configuration management for EDA" requires-python = ">=3.11" dependencies = [ diff --git a/packages/config/typescript/package.json b/packages/config/typescript/package.json index 3c569e7..face18a 100644 --- a/packages/config/typescript/package.json +++ b/packages/config/typescript/package.json @@ -1,6 +1,6 @@ { "name": "@eda/config", - "version": "0.1.11", + "version": "0.1.14", "main": "dist/config.js", "types": "dist/config.d.ts", "type": "module", diff --git a/packages/config/typescript/src/types.ts b/packages/config/typescript/src/types.ts index b28706e..5692fb8 100644 --- a/packages/config/typescript/src/types.ts +++ b/packages/config/typescript/src/types.ts @@ -171,6 +171,8 @@ export const ConfigSchema = z.object({ docs: z.number(), db: z.object({ postgres: z.number(), + trigger_postgres: z.number(), // Add new port + langtrace_postgres: z.number(), // Add new port redis: z.number(), neo4j: z.object({ http: z.number(),