Update service ports in documentation and configuration files to 12000 for backend

This commit is contained in:
2026-04-27 21:35:35 +02:00
parent 8f4d01d34d
commit 80999b3659
5 changed files with 23 additions and 33 deletions
+1 -1
View File
@@ -42,7 +42,7 @@ cp .env.example .env
```bash ```bash
cd backend cd backend
uvicorn app.main:app --reload --port 8000 uvicorn app.main:app --reload --port 12000
``` ```
### Running the frontend ### Running the frontend
+6 -6
View File
@@ -13,7 +13,7 @@ Describes:
│ ┌─────────────┐ ┌─────────────────────┐ │ │ ┌─────────────┐ ┌─────────────────────┐ │
│ │ frontend │ │ backend │ │ │ │ frontend │ │ backend │ │
│ │ (Flask) │ │ (FastAPI) │ │ │ │ (Flask) │ │ (FastAPI) │ │
│ │ :5000 │ │ :8000 │ │ │ │ :5000 │ │ :12000 │ │
│ └──────┬──────┘ └──────────┬──────────┘ │ │ └──────┬──────┘ └──────────┬──────────┘ │
│ │ │ │ │ │ │ │
│ └────────┬──────────┘ │ │ └────────┬──────────┘ │
@@ -31,11 +31,11 @@ Describes:
**Mapping of Building Blocks to Infrastructure:** **Mapping of Building Blocks to Infrastructure:**
| Building Block | Container / Process | Port | | Building Block | Container / Process | Port |
| --------------- | ---------------------------- | ---- | | --------------- | ---------------------------- | ----- |
| Flask frontend | `frontend` | 5000 | | Flask frontend | `frontend` | 5000 |
| FastAPI backend | `backend` | 8000 | | FastAPI backend | `backend` | 12000 |
| DuckDB | File on host (`data/app.db`) | — | | DuckDB | File on host (`data/app.db`) | — |
## Infrastructure Level 2 ## Infrastructure Level 2
+14 -24
View File
@@ -6,14 +6,14 @@ This guide covers deploying `ai.allucanget.biz` using [Coolify](https://coolify.
The application consists of two Python services: The application consists of two Python services:
| Service | Framework | Port | Description | | Service | Framework | Port | Description |
| -------- | ----------------- | ---- | ------------------------------------------ | | -------- | ----------------- | ----- | ------------------------------------------ |
| Backend | FastAPI + uvicorn | 8000 | REST API, auth, AI generation, DuckDB | | Backend | FastAPI + uvicorn | 12000 | REST API, auth, AI generation, DuckDB |
| Frontend | Flask + gunicorn | 5000 | SSR web UI, session auth, proxy to backend | | Frontend | Flask + gunicorn | 5000 | SSR web UI, session auth, proxy to backend |
Coolify's built-in reverse proxy routes traffic: Coolify's built-in reverse proxy routes traffic:
- `/api/*` → Backend (port 8000) - `/api/*` → Backend (port 12000)
- `/` → Frontend (port 5000) - `/` → Frontend (port 5000)
## Prerequisites ## Prerequisites
@@ -30,10 +30,10 @@ Coolify's built-in reverse proxy routes traffic:
4. Choose the `main` branch 4. Choose the `main` branch
5. Set **Build Pack** to `nixpacks` 5. Set **Build Pack** to `nixpacks`
6. **CRITICAL: Set Base Directory to `/backend`** — this tells Nixpacks to look in the `backend/` subdirectory for `requirements.txt` and the Python application 6. **CRITICAL: Set Base Directory to `/backend`** — this tells Nixpacks to look in the `backend/` subdirectory for `requirements.txt` and the Python application
7. Set **Ports Exposed** to `8000` 7. Set **Ports Exposed** to `12000`
8. Set **Start Command** to: 8. Set **Start Command** to:
```txt ```txt
uvicorn app.main:app --host 0.0.0.0 --port 8000 uvicorn app.main:app --host 0.0.0.0 --port 12000
``` ```
9. Click **Create Resource** 9. Click **Create Resource**
@@ -73,10 +73,10 @@ Add these as **Runtime** environment variables in Coolify:
Add these as **Runtime** environment variables in Coolify: Add these as **Runtime** environment variables in Coolify:
| Variable | Description | Example | | Variable | Description | Example |
| ------------------ | ----------------------------------------- | -------------------------------------------------------------- | | ------------------ | ----------------------------------------- | --------------------------------------------------------------- |
| `FLASK_SECRET_KEY` | Flask session cookie signing key | Generate with `openssl rand -hex 32` | | `FLASK_SECRET_KEY` | Flask session cookie signing key | Generate with `openssl rand -hex 32` |
| `BACKEND_URL` | Internal URL to reach the backend service | `http://localhost:8000` (or use Coolify's internal networking) | | `BACKEND_URL` | Internal URL to reach the backend service | `http://localhost:12000` (or use Coolify's internal networking) |
## Step 3: Configure Reverse Proxy ## Step 3: Configure Reverse Proxy
@@ -85,7 +85,7 @@ Coolify provides a built-in reverse proxy. Configure routing rules:
### Backend Proxy Rules ### Backend Proxy Rules
- **Domain**: `api.ai.allucanget.biz` (or subdomain of your choice) - **Domain**: `api.ai.allucanget.biz` (or subdomain of your choice)
- **Port**: `8000` - **Port**: `12000`
- **Path**: `/api/*` → forward to backend - **Path**: `/api/*` → forward to backend
### Frontend Proxy Rules ### Frontend Proxy Rules
@@ -104,7 +104,7 @@ If you need custom Nginx configuration, create `nginx/coolify.conf`:
# Backend API proxy # Backend API proxy
location /api/ { location /api/ {
proxy_pass http://backend:8000; proxy_pass http://backend:12000;
proxy_set_header Host $host; proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -152,7 +152,7 @@ If you want to persist DuckDB data:
### Frontend can't reach backend ### Frontend can't reach backend
- Ensure `BACKEND_URL` points to the correct internal URL - Ensure `BACKEND_URL` points to the correct internal URL
- If both services are on the same Coolify server, use `http://localhost:8000` - If both services are on the same Coolify server, use `http://localhost:12000`
- Check that the backend service is running and healthy - Check that the backend service is running and healthy
### CORS errors ### CORS errors
@@ -191,13 +191,3 @@ All required environment variables:
- [ ] Domain names configured - [ ] Domain names configured
- [ ] Health checks passing - [ ] Health checks passing
- [ ] Logs reviewed for errors - [ ] Logs reviewed for errors
## Nixpacks Configuration
The project includes Nixpacks configuration files for both services:
- `nixpacks.toml` — Shared configuration (Python version, packages)
- `backend/nixpacks.toml` — Backend-specific (uvicorn, port 8000)
- `frontend/nixpacks.toml` — Frontend-specific (gunicorn, port 5000)
Nixpacks automatically detects Python projects and installs dependencies from `requirements.txt`. No additional configuration is needed for basic deployments.
+1 -1
View File
@@ -4,6 +4,6 @@ import os
class Config: class Config:
SECRET_KEY = os.getenv("FLASK_SECRET_KEY", "dev-secret-change-in-production") SECRET_KEY = os.getenv("FLASK_SECRET_KEY", "dev-secret-change-in-production")
BACKEND_URL = os.getenv("BACKEND_URL", "http://localhost:8000") BACKEND_URL = os.getenv("BACKEND_URL", "http://localhost:12000")
SESSION_COOKIE_HTTPONLY = True SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_SAMESITE = "Lax" SESSION_COOKIE_SAMESITE = "Lax"
+1 -1
View File
@@ -3,7 +3,7 @@
# Backend API proxy # Backend API proxy
upstream backend { upstream backend {
server 127.0.0.1:8000; server 127.0.0.1:12000;
} }
# Frontend proxy # Frontend proxy