Improve deployment safety and chat reliability
Deploy FluentGerman.ai / deploy (push) Successful in 1m25s

This commit is contained in:
2026-08-29 17:28:50 +02:00
parent e9f12bc2ba
commit d974aaedc8
15 changed files with 746 additions and 153 deletions
+19 -5
View File
@@ -19,7 +19,7 @@ A web-based tool for a German language teacher to provide clients with customize
| Layer | Technology |
|-------|-----------|
| Backend | Python 3.12 + FastAPI |
| Database | PostgreSQL (async via SQLAlchemy + asyncpg) |
| Database | MySQL (async via SQLAlchemy + aiomysql) |
| Auth | JWT + bcrypt |
| LLM | LiteLLM (provider-agnostic) |
| Voice | OpenAI Whisper/TTS or Web Speech API (feature flag) |
@@ -47,12 +47,26 @@ uvicorn app.main:app --reload
## Production Deployment (Debian)
```bash
# Prerequisites: PostgreSQL and nginx already installed
# Prerequisites: MySQL and nginx already installed
sudo bash deploy/setup.sh
```
# Then edit the .env file:
On a **fresh install** the script generates the database password and writes it
into `.env`, then installs the service *without starting it* — so the app never
goes live with the template's LLM key and default admin password:
```bash
# 1. Set LLM_API_KEY and ADMIN_PASSWORD (leave DATABASE_URL alone):
sudo nano /opt/fluentgerman/backend/.env
# 2. Start it:
sudo systemctl start fluentgerman
```
Re-running `setup.sh` on an **existing install** keeps `.env` and the database
password untouched, and restarts the service.
```bash
# Restart after config changes:
sudo systemctl restart fluentgerman
```
@@ -64,7 +78,7 @@ sudo systemctl restart fluentgerman
│ ├── app/
│ │ ├── main.py # FastAPI entry point
│ │ ├── config.py # Environment-based settings
│ │ ├── database.py # Async PostgreSQL setup
│ │ ├── database.py # Async MySQL setup
│ │ ├── models.py # User & Instruction models
│ │ ├── schemas.py # Pydantic request/response
│ │ ├── auth.py # JWT + bcrypt + dependencies
@@ -97,7 +111,7 @@ All settings via `.env` file (see `.env.example`):
| Variable | Description |
|----------|-------------|
| `SECRET_KEY` | JWT signing key (generate a strong random one) |
| `DATABASE_URL` | PostgreSQL connection string |
| `DATABASE_URL` | MySQL connection string |
| `LLM_API_KEY` | Your LLM provider API key |
| `LLM_MODEL` | Model to use (e.g. `gpt-4o-mini`, `claude-3-haiku-20240307`) |
| `VOICE_MODE` | `api` (OpenAI Whisper/TTS) or `browser` (Web Speech API) |