151 lines
3.7 KiB
Markdown
151 lines
3.7 KiB
Markdown
# Dokploy Troubleshooting Guide
|
|
|
|
## Current Configuration
|
|
- **Application Port**: 5173 (to avoid conflict with your existing app on port 3000)
|
|
- **Container Port**: 5173
|
|
- **Health Check**: http://localhost:5173/health
|
|
|
|
## Common Issues and Solutions
|
|
|
|
### 1. 404 Page Not Found
|
|
|
|
**Possible Causes:**
|
|
- Port mapping issue
|
|
- Application not starting properly
|
|
- Dokploy routing configuration
|
|
|
|
**Solutions:**
|
|
|
|
#### A. Check Dokploy Port Configuration
|
|
In Dokploy, make sure:
|
|
1. Go to your application settings
|
|
2. Check "Port" or "Exposed Port" is set to **5173**
|
|
3. If there's a "Target Port" field, set it to **5173** as well
|
|
|
|
#### B. Check Application Logs
|
|
1. In Dokploy, go to your application
|
|
2. Click "Logs" tab
|
|
3. Look for: `[remix-serve] http://localhost:5173`
|
|
4. If you see port 3000 instead, there's a configuration issue
|
|
|
|
#### C. Verify Environment Variables
|
|
Make sure these are set in Dokploy environment variables:
|
|
```
|
|
NODE_ENV=production
|
|
PORT=5173
|
|
SESSION_SECRET=your-secure-secret
|
|
SUPER_ADMIN=superadmin
|
|
SUPER_ADMIN_EMAIL=admin@yourcompany.com
|
|
SUPER_ADMIN_PASSWORD=YourSecurePassword123!
|
|
```
|
|
|
|
### 2. Application Starts but Shows Wrong Port in Logs
|
|
|
|
If logs show `http://localhost:3000` instead of `5173`:
|
|
|
|
1. **Check Dokploy Environment Variables**:
|
|
- Ensure `PORT=5173` is set
|
|
- Remove any conflicting port variables
|
|
|
|
2. **Redeploy** the application after fixing environment variables
|
|
|
|
### 3. Health Check Failures
|
|
|
|
If health checks are failing:
|
|
|
|
1. **Manual Health Check**:
|
|
```bash
|
|
# SSH into your server and run:
|
|
docker exec -it phosphat-report-app wget -qO- http://localhost:5173/health
|
|
```
|
|
|
|
2. **Expected Response**:
|
|
```json
|
|
{
|
|
"status": "ok",
|
|
"timestamp": "2025-07-24T...",
|
|
"uptime": 123.45,
|
|
"environment": "production",
|
|
"database": "connected"
|
|
}
|
|
```
|
|
|
|
### 4. Database Issues
|
|
|
|
If you see database connection errors:
|
|
|
|
1. **Check Database Path**:
|
|
- Ensure `DATABASE_URL=file:/app/data/production.db`
|
|
- Check if `/app/data` directory has proper permissions
|
|
|
|
2. **Reset Database** (if needed):
|
|
```bash
|
|
# Stop application in Dokploy
|
|
# SSH into server and run:
|
|
docker volume rm $(docker volume ls -q | grep app_data)
|
|
# Restart application in Dokploy
|
|
```
|
|
|
|
## Access Your Application
|
|
|
|
Once deployed successfully:
|
|
|
|
### Direct Access
|
|
- **URL**: `http://your-server-ip:5173`
|
|
- **Login**: Use the credentials from `SUPER_ADMIN_EMAIL` and `SUPER_ADMIN_PASSWORD`
|
|
|
|
### Through Reverse Proxy (if configured)
|
|
- **URL**: `https://your-domain.com`
|
|
- Make sure your reverse proxy (nginx/traefik) is configured to forward to port 5173
|
|
|
|
## Dokploy-Specific Configuration
|
|
|
|
### Environment Variables to Set in Dokploy UI:
|
|
```
|
|
NODE_ENV=production
|
|
PORT=5173
|
|
DATABASE_URL=file:/app/data/production.db
|
|
SESSION_SECRET=your-super-secure-session-secret-min-32-chars
|
|
SUPER_ADMIN=superadmin
|
|
SUPER_ADMIN_EMAIL=admin@yourcompany.com
|
|
SUPER_ADMIN_PASSWORD=YourSecurePassword123!
|
|
```
|
|
|
|
### Port Configuration:
|
|
- **Container Port**: 5173
|
|
- **Host Port**: 5173 (or any available port you prefer)
|
|
|
|
## Quick Deployment Checklist
|
|
|
|
- [ ] Repository URL is correct
|
|
- [ ] Branch is set to `main`
|
|
- [ ] Environment variables are set
|
|
- [ ] Port is configured as 5173
|
|
- [ ] Build completed successfully
|
|
- [ ] Container is running
|
|
- [ ] Health check passes
|
|
- [ ] Application is accessible at `http://server-ip:5173`
|
|
|
|
## Still Having Issues?
|
|
|
|
1. **Check Container Status**:
|
|
```bash
|
|
docker ps | grep phosphat-report
|
|
```
|
|
|
|
2. **View Real-time Logs**:
|
|
```bash
|
|
docker logs -f phosphat-report-app
|
|
```
|
|
|
|
3. **Test Health Endpoint**:
|
|
```bash
|
|
curl http://localhost:5173/health
|
|
```
|
|
|
|
4. **Check Port Binding**:
|
|
```bash
|
|
netstat -tlnp | grep 5173
|
|
```
|
|
|
|
If none of these solutions work, the issue might be with Dokploy's internal routing or your server's firewall configuration. |