upload 2 3

This commit is contained in:
yznahmad 2025-07-24 14:58:18 +03:00
parent 276e4d96a1
commit 2f128c9980
2 changed files with 152 additions and 1 deletions

151
DOKPLOY-TROUBLESHOOTING.md Normal file
View File

@ -0,0 +1,151 @@
# 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.

View File

@ -31,7 +31,7 @@ services:
networks:
- app_network
healthcheck:
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:3000/health", "||", "exit", "1"]
test: ["CMD", "wget", "--no-verbose", "--tries=1", "--spider", "http://localhost:5173/health", "||", "exit", "1"]
interval: 30s
timeout: 10s
retries: 3