mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-19 12:03:54 +02:00
initial health check
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
FROM python:3.11-slim-bullseye
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y git cmake pkg-config libprotobuf-c-dev protobuf-compiler libprotobuf-dev libgoogle-perftools-dev libpq-dev build-essential \
|
||||
&& apt-get install -y git cmake pkg-config libprotobuf-c-dev protobuf-compiler \
|
||||
libprotobuf-dev libgoogle-perftools-dev libpq-dev build-essential curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY ./requirements/default.txt /tmp/requirements.txt
|
||||
|
@@ -1,7 +1,8 @@
|
||||
FROM python:3.11-slim-bullseye
|
||||
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y git cmake pkg-config libprotobuf-c-dev protobuf-compiler libprotobuf-dev libgoogle-perftools-dev libpq-dev build-essential cron \
|
||||
&& apt-get install -y git cmake pkg-config libprotobuf-c-dev protobuf-compiler \
|
||||
libprotobuf-dev libgoogle-perftools-dev libpq-dev build-essential cron curl \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
COPY ./requirements/default.txt /tmp/requirements.txt
|
||||
|
@@ -13,6 +13,7 @@ from danswer.configs.app_configs import WEB_DOMAIN
|
||||
from danswer.datastores.qdrant.indexing import list_collections
|
||||
from danswer.server.admin import router as admin_router
|
||||
from danswer.server.event_loading import router as event_processing_router
|
||||
from danswer.server.health import router as health_router
|
||||
from danswer.server.search_backend import router as backend_router
|
||||
from danswer.utils.logging import setup_logger
|
||||
from fastapi import FastAPI
|
||||
@@ -39,6 +40,7 @@ def get_application() -> FastAPI:
|
||||
application.include_router(backend_router)
|
||||
application.include_router(event_processing_router)
|
||||
application.include_router(admin_router)
|
||||
application.include_router(health_router)
|
||||
|
||||
application.include_router(
|
||||
fastapi_users.get_auth_router(auth_backend),
|
||||
|
@@ -21,7 +21,9 @@ from danswer.dynamic_configs.interface import ConfigNotFoundError
|
||||
from danswer.server.models import AuthStatus
|
||||
from danswer.server.models import AuthUrl
|
||||
from danswer.server.models import GDriveCallback
|
||||
from danswer.server.models import IndexAttemptRequest
|
||||
from danswer.server.models import IndexAttemptSnapshot
|
||||
from danswer.server.models import ListIndexAttemptsResponse
|
||||
from danswer.utils.logging import setup_logger
|
||||
from fastapi import APIRouter
|
||||
from fastapi import Depends
|
||||
@@ -69,11 +71,6 @@ def modify_slack_config(
|
||||
update_slack_config(slack_config)
|
||||
|
||||
|
||||
class IndexAttemptRequest(BaseModel):
|
||||
input_type: InputType = InputType.PULL
|
||||
connector_specific_config: dict[str, Any]
|
||||
|
||||
|
||||
@router.post("/connectors/{source}/index-attempt", status_code=201)
|
||||
def index(
|
||||
source: DocumentSource,
|
||||
@@ -100,10 +97,6 @@ def index(
|
||||
)
|
||||
|
||||
|
||||
class ListIndexAttemptsResponse(BaseModel):
|
||||
index_attempts: list[IndexAttemptSnapshot]
|
||||
|
||||
|
||||
@router.get("/connectors/{source}/index-attempt")
|
||||
def list_index_attempts(
|
||||
source: DocumentSource,
|
||||
|
10
backend/danswer/server/health.py
Normal file
10
backend/danswer/server/health.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from danswer.server.models import HealthCheckResponse
|
||||
from fastapi import APIRouter
|
||||
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.get("/health")
|
||||
def healthcheck() -> HealthCheckResponse:
|
||||
return {"status": "ok"}
|
@@ -1,12 +1,18 @@
|
||||
from datetime import datetime
|
||||
from typing import Any
|
||||
from typing import Literal
|
||||
|
||||
from danswer.configs.constants import DocumentSource
|
||||
from danswer.connectors.models import InputType
|
||||
from danswer.datastores.interfaces import DatastoreFilter
|
||||
from danswer.db.models import IndexingStatus
|
||||
from pydantic import BaseModel
|
||||
|
||||
|
||||
class HealthCheckResponse(BaseModel):
|
||||
status: Literal["ok"]
|
||||
|
||||
|
||||
class AuthStatus(BaseModel):
|
||||
authenticated: bool
|
||||
|
||||
@@ -51,6 +57,11 @@ class UserByEmail(BaseModel):
|
||||
user_email: str
|
||||
|
||||
|
||||
class IndexAttemptRequest(BaseModel):
|
||||
input_type: InputType = InputType.PULL
|
||||
connector_specific_config: dict[str, Any]
|
||||
|
||||
|
||||
class IndexAttemptSnapshot(BaseModel):
|
||||
connector_specific_config: dict[str, Any]
|
||||
status: IndexingStatus
|
||||
@@ -60,5 +71,5 @@ class IndexAttemptSnapshot(BaseModel):
|
||||
docs_indexed: int
|
||||
|
||||
|
||||
class ListWebsiteIndexAttemptsResponse(BaseModel):
|
||||
class ListIndexAttemptsResponse(BaseModel):
|
||||
index_attempts: list[IndexAttemptSnapshot]
|
||||
|
Reference in New Issue
Block a user