chore(backend): upgrade deps and remove redis/rq
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
ENVIRONMENT=dev
|
||||
LOG_LEVEL=INFO
|
||||
DATABASE_URL=postgresql+psycopg://postgres:postgres@localhost:5432/mission_control
|
||||
REDIS_URL=redis://localhost:6379/0
|
||||
CORS_ORIGINS=http://localhost:3000
|
||||
BASE_URL=
|
||||
|
||||
|
||||
@@ -11,16 +11,15 @@ This directory contains the **Mission Control backend API** (FastAPI + SQLModel)
|
||||
- Python **3.12+**
|
||||
- [`uv`](https://github.com/astral-sh/uv) (recommended; used by this repo)
|
||||
- Postgres (local or Docker)
|
||||
- Redis (local or Docker)
|
||||
|
||||
## Quick start (local backend + Docker Postgres/Redis)
|
||||
## Quick start (local backend + Docker Postgres)
|
||||
|
||||
From the repo root:
|
||||
|
||||
```bash
|
||||
# start dependencies
|
||||
cp .env.example .env
|
||||
docker compose -f compose.yml --env-file .env up -d db redis
|
||||
docker compose -f compose.yml --env-file .env up -d db
|
||||
|
||||
# run backend
|
||||
cd backend
|
||||
@@ -56,7 +55,6 @@ A starter file exists at `backend/.env.example`.
|
||||
- Default: `postgresql+psycopg://postgres:postgres@localhost:5432/openclaw_agency`
|
||||
- Recommended local/dev default (matches `backend/.env.example`):
|
||||
`postgresql+psycopg://postgres:postgres@localhost:5432/mission_control`
|
||||
- `REDIS_URL` (default: `redis://localhost:6379/0`)
|
||||
- `CORS_ORIGINS` (comma-separated)
|
||||
- Example: `http://localhost:3000`
|
||||
- `BASE_URL` (optional)
|
||||
@@ -153,16 +151,6 @@ uv run python scripts/export_openapi.py
|
||||
|
||||
- If backend runs **locally** (not in compose), `DATABASE_URL` should usually point at `localhost`.
|
||||
|
||||
### Backend can’t connect to Redis
|
||||
|
||||
- Ensure the Redis container is up:
|
||||
|
||||
```bash
|
||||
docker compose -f compose.yml --env-file .env logs -f --tail=200 redis
|
||||
```
|
||||
|
||||
- Confirm `REDIS_URL=redis://localhost:6379/0` when running backend locally.
|
||||
|
||||
### CORS issues from the frontend
|
||||
|
||||
- Set `CORS_ORIGINS=http://localhost:3000` (or a comma-separated list) in `backend/.env`.
|
||||
|
||||
@@ -25,7 +25,6 @@ class Settings(BaseSettings):
|
||||
|
||||
environment: str = "dev"
|
||||
database_url: str = "postgresql+psycopg://postgres:postgres@localhost:5432/openclaw_agency"
|
||||
redis_url: str = "redis://localhost:6379/0"
|
||||
|
||||
# Clerk auth (auth only; roles stored in DB)
|
||||
clerk_secret_key: str = Field(min_length=1)
|
||||
|
||||
@@ -35,7 +35,7 @@ class GatewayConfig:
|
||||
|
||||
|
||||
def _build_gateway_url(config: GatewayConfig) -> str:
|
||||
base_url = (config.url or "").strip()
|
||||
base_url: str = (config.url or "").strip()
|
||||
if not base_url:
|
||||
message = "Gateway URL is not configured for this board."
|
||||
raise OpenClawGatewayError(message)
|
||||
@@ -44,11 +44,11 @@ def _build_gateway_url(config: GatewayConfig) -> str:
|
||||
return base_url
|
||||
parsed = urlparse(base_url)
|
||||
query = urlencode({"token": token})
|
||||
return urlunparse(parsed._replace(query=query))
|
||||
return str(urlunparse(parsed._replace(query=query)))
|
||||
|
||||
|
||||
async def _await_response(
|
||||
ws: websockets.WebSocketClientProtocol,
|
||||
ws: websockets.ClientConnection,
|
||||
request_id: str,
|
||||
) -> object:
|
||||
while True:
|
||||
@@ -70,7 +70,7 @@ async def _await_response(
|
||||
|
||||
|
||||
async def _send_request(
|
||||
ws: websockets.WebSocketClientProtocol,
|
||||
ws: websockets.ClientConnection,
|
||||
method: str,
|
||||
params: dict[str, Any] | None,
|
||||
) -> object:
|
||||
@@ -102,7 +102,7 @@ def _build_connect_params(config: GatewayConfig) -> dict[str, Any]:
|
||||
|
||||
|
||||
async def _ensure_connected(
|
||||
ws: websockets.WebSocketClientProtocol,
|
||||
ws: websockets.ClientConnection,
|
||||
first_message: str | bytes | None,
|
||||
config: GatewayConfig,
|
||||
) -> None:
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
"""RQ queue and Redis connection helpers for background workers."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from redis import Redis
|
||||
from rq import Queue
|
||||
|
||||
from app.core.config import settings
|
||||
|
||||
|
||||
def get_redis() -> Redis:
|
||||
"""Create a Redis client from configured settings."""
|
||||
return Redis.from_url(settings.redis_url)
|
||||
|
||||
|
||||
def get_queue(name: str) -> Queue:
|
||||
"""Return an RQ queue bound to the configured Redis connection."""
|
||||
return Queue(name, connection=get_redis())
|
||||
@@ -12,36 +12,34 @@ name = "openclaw-agency-backend"
|
||||
version = "0.1.0"
|
||||
requires-python = ">=3.12"
|
||||
dependencies = [
|
||||
"fastapi==0.128.0",
|
||||
"uvicorn[standard]==0.30.6",
|
||||
"sqlmodel==0.0.22",
|
||||
"sqlalchemy[asyncio]==2.0.34",
|
||||
"alembic==1.13.2",
|
||||
"psycopg[binary]==3.3.2",
|
||||
"pydantic-settings==2.5.2",
|
||||
"python-dotenv==1.0.1",
|
||||
"websockets==12.0",
|
||||
"rq==1.16.2",
|
||||
"redis==5.1.1",
|
||||
"sse-starlette==2.1.3",
|
||||
"jinja2==3.1.6",
|
||||
"fastapi-pagination==0.15.9",
|
||||
"clerk-backend-api==1.4.1",
|
||||
"alembic==1.18.3",
|
||||
"clerk-backend-api==4.2.0",
|
||||
"fastapi==0.128.6",
|
||||
"fastapi-pagination==0.15.10",
|
||||
"jinja2==3.1.6",
|
||||
"psycopg[binary]==3.3.2",
|
||||
"pydantic-settings==2.12.0",
|
||||
"python-dotenv==1.2.1",
|
||||
"sqlalchemy[asyncio]==2.0.46",
|
||||
"sqlmodel==0.0.32",
|
||||
"sse-starlette==3.2.0",
|
||||
"uvicorn[standard]==0.40.0",
|
||||
"websockets==16.0",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = [
|
||||
"black==24.10.0",
|
||||
"flake8==7.1.1",
|
||||
"httpx==0.27.0",
|
||||
"isort==5.13.2",
|
||||
"mypy==1.11.2",
|
||||
"pytest==8.3.3",
|
||||
"pytest-asyncio==0.24.0",
|
||||
"pytest-cov==6.0.0",
|
||||
"coverage[toml]==7.6.10",
|
||||
"ruff==0.6.9",
|
||||
"aiosqlite==0.21.0",
|
||||
"aiosqlite==0.22.1",
|
||||
"black==26.1.0",
|
||||
"coverage[toml]==7.13.4",
|
||||
"flake8==7.3.0",
|
||||
"httpx==0.28.1",
|
||||
"isort==7.0.0",
|
||||
"mypy==1.19.1",
|
||||
"pytest==9.0.2",
|
||||
"pytest-asyncio==1.3.0",
|
||||
"pytest-cov==7.0.0",
|
||||
"ruff==0.15.0",
|
||||
]
|
||||
|
||||
[tool.mypy]
|
||||
|
||||
@@ -18,7 +18,7 @@ async def run() -> None:
|
||||
from app.models.boards import Board
|
||||
from app.models.gateways import Gateway
|
||||
from app.models.users import User
|
||||
from app.services.openclaw import GatewayAgentIdentity
|
||||
from app.services.openclaw.shared import GatewayAgentIdentity
|
||||
|
||||
await init_db()
|
||||
async with async_session_maker() as session:
|
||||
|
||||
@@ -52,7 +52,10 @@ def _parse_args() -> argparse.Namespace:
|
||||
async def _run() -> int:
|
||||
from app.db.session import async_session_maker
|
||||
from app.models.gateways import Gateway
|
||||
from app.services.openclaw import GatewayTemplateSyncOptions, sync_gateway_templates
|
||||
from app.services.openclaw.provisioning import (
|
||||
GatewayTemplateSyncOptions,
|
||||
sync_gateway_templates,
|
||||
)
|
||||
|
||||
args = _parse_args()
|
||||
gateway_id = UUID(args.gateway_id)
|
||||
|
||||
790
backend/uv.lock
generated
790
backend/uv.lock
generated
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user