4.5 KiB
4.5 KiB
Dokploy Deployment Guide
This guide will help you deploy the Phosphat Report application on Dokploy.
Step 1: Prepare Your Repository
- Fix Git Issues (if you encountered them):
# Remove temporary Excel files git rm --cached "public/~$16-6 Petra.xlsx" # Configure Git line endings for Windows git config core.autocrlf true # Add and commit files git add . git commit -m "Initial commit for Dokploy deployment" git push origin main
Step 2: Create Application in Dokploy
- Login to your Dokploy dashboard
- Click "Create Application"
- Choose "Docker Compose"
- Fill in the details:
- Name:
phosphat-report(or your preferred name) - Repository URL: Your Git repository URL
- Branch:
main - Build Path:
/(root directory)
- Name:
Step 3: Configure Environment Variables
In the Dokploy environment variables section, add these variables:
Required Variables
NODE_ENV=production
SESSION_SECRET=your-super-secure-session-secret-change-this-min-32-chars
SUPER_ADMIN=superadmin
SUPER_ADMIN_EMAIL=admin@yourcompany.com
SUPER_ADMIN_PASSWORD=YourSecurePassword123!
Optional Variables
APP_PORT=3000
DOMAIN=your-domain.com
MAIL_HOST=smtp.gmail.com
MAIL_PORT=587
MAIL_SECURE=false
MAIL_USERNAME=your-email@gmail.com
MAIL_PASSWORD=your-app-password
MAIL_FROM_NAME=Phosphat Report System
MAIL_FROM_EMAIL=noreply@yourcompany.com
LOG_LEVEL=info
Step 4: Deploy
- Click "Deploy" in Dokploy
- Monitor the build logs for any errors
- Wait for deployment to complete
Step 5: Access Your Application
Once deployed, your application will be available at:
- HTTP:
http://your-server-ip:3000 - HTTPS:
https://your-domain.com(if domain is configured)
Troubleshooting
Common Issues
-
Volume Mount Errors:
- The updated docker-compose.yml uses Docker volumes instead of bind mounts
- This should resolve the "no such file or directory" error
-
Build Failures:
- Check the build logs in Dokploy
- Ensure all environment variables are set correctly
- Verify your repository is accessible
-
Database Issues:
- The database will be created automatically on first run
- Check container logs if the application fails to start
Checking Logs
In Dokploy:
- Go to your application
- Click on "Logs" tab
- Select the container (app or backup)
- View real-time logs
Health Check
Once deployed, check if the application is healthy:
curl http://your-server-ip:3000/health
Should return:
{
"status": "ok",
"timestamp": "2025-07-24T10:30:00.000Z",
"uptime": 123.45,
"environment": "production",
"database": "connected"
}
Database Management
Backup
The backup service runs automatically daily at 2 AM. To manually backup:
-
Access the container:
docker exec -it phosphat-report-app sh -
Create backup:
cp /app/data/production.db /app/data/backup_$(date +%Y%m%d_%H%M%S).db
Restore
- Stop the application in Dokploy
- Access the server and restore the database file
- Restart the application
Updates
To update your application:
- Push changes to your Git repository
- Click "Redeploy" in Dokploy
- Monitor the deployment logs
Security Notes
- Change default passwords in environment variables
- Use strong session secret (minimum 32 characters)
- Configure proper domain and SSL
- Regular backups are handled automatically
- Monitor application logs regularly
Support
If you encounter issues:
- Check Dokploy logs for build/runtime errors
- Verify environment variables are set correctly
- Test health endpoint:
/health - Check database connectivity in logs
- Review Docker Compose configuration
File Structure for Dokploy
Your repository should have these key files:
├── docker-compose.yml # Main compose file (Dokploy compatible)
├── docker-compose.dokploy.yml # Alternative compose file
├── Dockerfile # Application container
├── .dockerignore # Docker build exclusions
├── .env.dokploy # Environment template
├── app/ # Application code
├── prisma/ # Database schema
└── public/ # Static assets
The deployment is now optimized for Dokploy and should work without volume mounting issues.