Update service ports to 12015 for backend and 12016 for frontend; adjust configurations and documentation accordingly

This commit is contained in:
2026-04-29 11:52:12 +02:00
parent d484721a94
commit abd61798c7
11 changed files with 59 additions and 57 deletions
+21 -21
View File
@@ -32,13 +32,13 @@ The application consists of two Python services:
| Service | Framework | Port | Description |
| -------- | ----------------- | ----- | ------------------------------------------ |
| Backend | FastAPI + uvicorn | 12000 | REST API, auth, AI generation, DuckDB |
| Frontend | Flask + gunicorn | 12001 | SSR web UI, session auth, proxy to backend |
| Backend | FastAPI + uvicorn | 12015 | REST API, auth, AI generation, DuckDB |
| Frontend | Flask + gunicorn | 12016 | SSR web UI, session auth, proxy to backend |
Coolify's built-in reverse proxy routes traffic:
- `/api/*` → Backend (port 12000)
- `/` → Frontend (port 12001)
- `/api/*` → Backend (port 12015)
- `/` → Frontend (port 12016)
## Prerequisites
@@ -57,7 +57,7 @@ Use Coolify's **Docker Compose** resource with the dedicated compose file `docke
3. Select the `ai.allucanget.biz` repository and `main` branch
4. Set **Compose File** to `docker-compose.coolify.yml`
5. Set **Base Directory** to `/`
6. Select the `frontend` service as the public-facing service on port `12001`
6. Select the `frontend` service as the public-facing service on port `12016`
7. Click **Create Resource**
### Step 2: Configure Environment Variables
@@ -72,15 +72,15 @@ Add these in Coolify before first deploy:
| `APP_NAME` | `backend` | `AI Allucanget` |
| `CORS_ORIGINS` | `backend` | `https://ai.allucanget.biz` |
| `FLASK_SECRET_KEY` | `frontend` | `openssl rand -hex 32` |
| `BACKEND_URL` | `frontend` | `http://backend:12000` |
| `BACKEND_URL` | `frontend` | `http://backend:12015` |
### Step 3: Configure Domain and Proxy
1. Attach domain `ai.allucanget.biz` to the `frontend` service on port `12001`
1. Attach domain `ai.allucanget.biz` to the `frontend` service on port `12016`
2. Enable **Auto HTTPS** in Coolify
3. Coolify terminates TLS and forwards traffic directly to `frontend:12001`
3. Coolify terminates TLS and forwards traffic directly to `frontend:12016`
No nginx service is needed in the Coolify stack. The frontend Flask app proxies `/api/*` calls to `http://backend:12000` internally. Coolify's own reverse proxy handles external TLS termination.
No nginx service is needed in the Coolify stack. The frontend Flask app proxies `/api/*` calls to `http://backend:12015` internally. Coolify's own reverse proxy handles external TLS termination.
### Step 4: Persistent Storage
@@ -103,11 +103,11 @@ No nginx service is needed in the Coolify stack. The frontend Flask app proxies
4. Choose the `main` branch
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
7. Set **Ports Exposed** to `12000`
7. Set **Ports Exposed** to `12015`
8. Set **Start Command** to:
```txt
uvicorn app.main:app --host 0.0.0.0 --port 12000
uvicorn app.main:app --host 0.0.0.0 --port 12015
```
9. Click **Create Resource**
@@ -133,11 +133,11 @@ Add these as **Runtime** environment variables in Coolify:
3. Choose the `main` branch
4. Set **Build Pack** to `nixpacks`
5. **CRITICAL: Set Base Directory to `/frontend`** — this tells Nixpacks to look in the `frontend/` subdirectory for `requirements.txt` and the Python application
6. Set **Ports Exposed** to `12001`
6. Set **Ports Exposed** to `12016`
7. Set **Start Command** to:
```txt
gunicorn app.main:app --bind 0.0.0.0:12001 --workers 2 --timeout 120
gunicorn app.main:app --bind 0.0.0.0:12016 --workers 2 --timeout 120
```
8. Click **Create Resource**
@@ -152,7 +152,7 @@ Add these as **Runtime** environment variables in Coolify:
| Variable | Description | Example |
| ------------------ | ----------------------------------------- | --------------------------------------------------------------- |
| `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:12000` (or use Coolify's internal networking) |
| `BACKEND_URL` | Internal URL to reach the backend service | `http://localhost:12015` (or use Coolify's internal networking) |
## Step 3: Configure Reverse Proxy
@@ -161,13 +161,13 @@ Coolify provides a built-in reverse proxy. Configure routing rules:
### Backend Proxy Rules
- **Domain**: `api.ai.allucanget.biz` (or subdomain of your choice)
- **Port**: `12000`
- **Port**: `12015`
- **Path**: `/api/*` → forward to backend
### Frontend Proxy Rules
- **Domain**: `ai.allucanget.biz`
- **Port**: `12001`
- **Port**: `12016`
- **Path**: `/` → forward to frontend
### Nginx Configuration (Optional)
@@ -180,7 +180,7 @@ If you need custom Nginx configuration, create `nginx/coolify.conf`:
# Backend API proxy
location /api/ {
proxy_pass http://backend:12000;
proxy_pass http://backend:12015;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -189,7 +189,7 @@ location /api/ {
# Frontend proxy
location / {
proxy_pass http://frontend:12001;
proxy_pass http://frontend:12016;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
@@ -222,7 +222,7 @@ If you want to persist DuckDB data:
### Docker Compose deployment fails in Coolify
- Verify Coolify uses `docker-compose.coolify.yml`, not local `docker-compose.yml`
- Verify public domain points to `frontend` service on port `12001`
- Verify public domain points to `frontend` service on port `12016`
- Do not add `nginx` to the Coolify stack — bind-mounting a local config file will fail since the file doesn't exist on the Coolify server
### Backend healthcheck stays unhealthy
@@ -240,7 +240,7 @@ If you want to persist DuckDB data:
### Frontend can't reach backend
- Ensure `BACKEND_URL` points to the correct internal URL
- If both services are on the same Coolify server, use `http://localhost:12000`
- If both services are on the same Coolify server, use `http://localhost:12015`
- Check that the backend service is running and healthy
### CORS errors
@@ -272,7 +272,7 @@ All required environment variables:
- [ ] Repository pushed to Git
- [ ] For Docker Compose: Coolify resource uses `docker-compose.coolify.yml`
- [ ] For Docker Compose: domain points to `frontend` service on port `12001`
- [ ] For Docker Compose: domain points to `frontend` service on port `12016`
- [ ] Backend service created with correct base directory (`/backend`)
- [ ] Backend environment variables configured
- [ ] Frontend service created with correct base directory (`/frontend`)