forked from minzeyaphyo/burmddit
🔧 Fix: Add DATABASE_URL runtime support for category pages
- Updated Dockerfile to accept DATABASE_URL at runtime - Added .env.example for frontend - Created Coolify environment setup guide Fixes category pages 404 error - DATABASE_URL needs to be set in Coolify
This commit is contained in:
84
COOLIFY-ENV-SETUP.md
Normal file
84
COOLIFY-ENV-SETUP.md
Normal file
@@ -0,0 +1,84 @@
|
||||
# Coolify Environment Variables Setup
|
||||
|
||||
## Issue: Category Pages 404 Error
|
||||
|
||||
**Root Cause:** DATABASE_URL environment variable not set in Coolify deployment
|
||||
|
||||
## Solution
|
||||
|
||||
### Set Environment Variable in Coolify
|
||||
|
||||
1. Go to Coolify dashboard: https://coolify.qikbite.asia
|
||||
2. Navigate to Applications → burmddit
|
||||
3. Go to "Environment Variables" tab
|
||||
4. Add the following variable:
|
||||
|
||||
```
|
||||
Name: DATABASE_URL
|
||||
Value: postgres://burmddit:Burmddit2026@172.26.13.68:5432/burmddit
|
||||
```
|
||||
|
||||
5. Save and redeploy
|
||||
|
||||
### Alternative: Via Coolify API
|
||||
|
||||
```bash
|
||||
curl -X POST \
|
||||
https://coolify.qikbite.asia/api/v1/applications/ocoock0oskc4cs00o0koo0c8/envs \
|
||||
-H "Authorization: Bearer YOUR_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{
|
||||
"key": "DATABASE_URL",
|
||||
"value": "postgres://burmddit:Burmddit2026@172.26.13.68:5432/burmddit",
|
||||
"is_build_time": false,
|
||||
"is_preview": false
|
||||
}'
|
||||
```
|
||||
|
||||
## Dockerfile Changes Made
|
||||
|
||||
Updated `/Dockerfile` to accept DATABASE_URL at runtime:
|
||||
|
||||
```dockerfile
|
||||
# Production image
|
||||
FROM base AS runner
|
||||
WORKDIR /app
|
||||
|
||||
ENV NODE_ENV=production
|
||||
ENV NEXT_TELEMETRY_DISABLED=1
|
||||
|
||||
# Database URL will be provided at runtime by Coolify
|
||||
ARG DATABASE_URL
|
||||
ENV DATABASE_URL=${DATABASE_URL}
|
||||
```
|
||||
|
||||
## Testing After Fix
|
||||
|
||||
Once environment variable is set and redeployed:
|
||||
|
||||
```bash
|
||||
# Test category pages
|
||||
curl https://burmddit.com/category/ai-news
|
||||
curl https://burmddit.com/category/tutorials
|
||||
curl https://burmddit.com/category/tips-tricks
|
||||
curl https://burmddit.com/category/upcoming
|
||||
```
|
||||
|
||||
Should return HTML content with articles, not 404.
|
||||
|
||||
## Files Modified
|
||||
|
||||
1. ✅ `/Dockerfile` - Added runtime DATABASE_URL
|
||||
2. ✅ `/frontend/.env.example` - Documented required env vars
|
||||
3. ✅ `/COOLIFY-ENV-SETUP.md` - This file
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. **Boss:** Set DATABASE_URL in Coolify (manual step - requires Coolify UI access)
|
||||
2. **Modo:** Push changes and trigger redeploy
|
||||
3. **Verify:** Test category pages after deployment
|
||||
|
||||
---
|
||||
|
||||
**Status:** ⏳ Waiting for environment variable to be set in Coolify
|
||||
**ETA:** ~5 minutes after env var is set and redeployed
|
||||
Reference in New Issue
Block a user