Fix Coolify deployment: remove volume bind mounts
This commit is contained in:
@ -1,10 +1,24 @@
|
||||
# ✅ Coolify Deployment - FIXED!
|
||||
|
||||
## What Was Wrong
|
||||
## Issues Fixed
|
||||
|
||||
### Issue 1: Port Already Allocated ✅
|
||||
|
||||
**Error:** `Bind for 0.0.0.0:8000 failed: port is already allocated`
|
||||
|
||||
**Cause:** Your `docker-compose.yml` used `ports:` which tries to bind to the host's ports. Coolify uses Traefik reverse proxy, so it doesn't need (and conflicts with) port bindings.
|
||||
**Cause:** Your `docker-compose.yml` used `ports:` which tries to bind to the host's ports. Coolify's dashboard runs on port 8000, causing a conflict.
|
||||
|
||||
**Fix:** Changed `ports:` to `expose:` - Coolify's Caddy reverse proxy handles routing
|
||||
|
||||
### Issue 2: Module/File Not Found ✅
|
||||
|
||||
**Backend Error:** `ModuleNotFoundError: No module named 'app'`
|
||||
|
||||
**Frontend Error:** `npm error enoent Could not read package.json`
|
||||
|
||||
**Cause:** Development volume mounts (`./backend:/app`, `./frontend:/app`) override Dockerfile COPY commands. In Coolify, these paths don't exist.
|
||||
|
||||
**Fix:** Removed bind mounts from docker-compose.yml - files now copied by Dockerfile
|
||||
|
||||
## What I Fixed
|
||||
|
||||
@ -15,21 +29,29 @@
|
||||
backend:
|
||||
ports:
|
||||
- "8000:8000" # ❌ Binds to host, causes conflict
|
||||
volumes:
|
||||
- ./backend:/app # ❌ Overrides Dockerfile, causes ModuleNotFoundError
|
||||
|
||||
frontend:
|
||||
ports:
|
||||
- "5173:5173" # ❌ Binds to host, causes conflict
|
||||
volumes:
|
||||
- ./frontend:/app # ❌ Overrides Dockerfile, causes package.json error
|
||||
- /app/node_modules
|
||||
```
|
||||
|
||||
**After:**
|
||||
```yaml
|
||||
backend:
|
||||
expose:
|
||||
- "8000" # ✅ Internal only, Coolify handles routing
|
||||
- "8000" # ✅ Internal only, Caddy handles routing
|
||||
volumes:
|
||||
- sqlite_data:/app/data # ✅ Keep named volume for database
|
||||
|
||||
frontend:
|
||||
expose:
|
||||
- "5173" # ✅ Internal only, Coolify handles routing
|
||||
- "5173" # ✅ Internal only, Caddy handles routing
|
||||
# ✅ No volumes - files copied by Dockerfile
|
||||
```
|
||||
|
||||
## Files Created for Production Deployment
|
||||
|
||||
Reference in New Issue
Block a user