Dockerize chat_backend for server-infra deploy (closes #6).
Add uv packaging, env-driven Django settings, OLLAMA_BASE_URL (LAN GPU host), DatabaseStorage for prompt/document blobs, compose/CI/deploy workflows mirroring scha, and ASGI gunicorn+UvicornWorker for WebSockets.
This commit is contained in:
@@ -1,40 +1,38 @@
|
||||
# Chat Bot Backend
|
||||
# Chat Backend
|
||||
|
||||
## Setup
|
||||
Django + Channels API for AIML Operations chat (`llm_be/`).
|
||||
|
||||
Clone the repo
|
||||
```console
|
||||
git clone http://10.0.0.160:3000/AI_ML_Operations_LLC/Chat_Bot_Backend.git
|
||||
## Local (uv)
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
uv sync
|
||||
cd llm_be
|
||||
uv run python manage.py migrate
|
||||
uv run python manage.py runserver 0.0.0.0:8003
|
||||
```
|
||||
|
||||
Go into the repo
|
||||
```console
|
||||
cd Chat_Bot_Backend
|
||||
## Docker (dev compose = bundled Postgres)
|
||||
|
||||
```bash
|
||||
docker compose up --build
|
||||
```
|
||||
|
||||
Create the virtual environment
|
||||
```console
|
||||
virtualenv --python=python3.9 venv
|
||||
```
|
||||
Prod compose (`docker-compose.prod.yml`) expects external `DATABASE_URL` and
|
||||
`WEB_PORT` from server-infra secrets. See `.env.prod.example`.
|
||||
|
||||
Activate the Virtual Environment
|
||||
```console
|
||||
. venv/bin/activate
|
||||
```
|
||||
## Ollama
|
||||
|
||||
Install the requirments
|
||||
```console
|
||||
python -m pip install -r requirements.txt
|
||||
```
|
||||
Set `OLLAMA_BASE_URL` (default `http://127.0.0.1:11434` locally).
|
||||
Deployed envs use the GPU host: `http://10.0.0.128:11434`.
|
||||
|
||||
Pre-populate the database with test data
|
||||
## File storage
|
||||
|
||||
Run the dev server
|
||||
```console
|
||||
python manage.py
|
||||
```
|
||||
Prompt attachments and documents are stored in Postgres (`StoredFile` /
|
||||
`DatabaseStorage`), not on the container filesystem.
|
||||
|
||||
## TODO
|
||||
## Deploy
|
||||
|
||||
- [ ] Create inital database with temp data
|
||||
- [ ] Do a lot of stuff.....
|
||||
Gitea Actions on `master` → `server-infra/scripts/deploy.sh --app chat_backend --env prod`.
|
||||
|
||||
Related: [chat_backend#6](https://git.aimloperations.com/ai_ml_operations/chat_backend/issues/6)
|
||||
|
||||
Reference in New Issue
Block a user