3.4 KiB
3.4 KiB
Deployment Guide for Phosphat Report App
This guide will help you deploy the Phosphat Report application on your VPS using the provided compose.yml file.
Prerequisites
- Docker and Docker Compose installed on your VPS
- Git (to clone the repository)
- At least 1GB RAM and 10GB disk space
Quick Deployment
-
Clone the repository to your VPS:
git clone <your-repo-url> cd phosphat-report-app -
Deploy the application:
docker-compose -f compose.yml up -d --build -
Check the status:
docker-compose -f compose.yml ps -
Access your application:
- URL:
http://your-vps-ip:3000 - Default login:
superadmin/P@ssw0rd123!
- URL:
Environment Variables (Hardcoded in compose.yml)
The following environment variables are already configured in the compose.yml file:
- NODE_ENV:
production - DATABASE_URL:
file:/app/data/production.db - SESSION_SECRET:
your-super-secure-session-secret-change-this-min-32-chars - SUPER_ADMIN:
superadmin - SUPER_ADMIN_EMAIL:
admin@yourcompany.com - SUPER_ADMIN_PASSWORD:
P@ssw0rd123! - MAIL_HOST:
smtp.gmail.com - MAIL_PORT:
587 - MAIL_USERNAME:
your-email@gmail.com - MAIL_PASSWORD:
your-app-password
Services Included
Main Application (app)
- Port: 3000
- Database: SQLite with persistent storage
- Health Check: Available at
/healthendpoint - Resource Limits: 512MB RAM, 0.5 CPU
Backup Service (backup)
- Purpose: Automatic daily database backups at 2 AM
- Retention: Keeps backups for 7 days
- Location:
/backupvolume
Useful Commands
View logs:
docker-compose -f compose.yml logs -f app
Stop services:
docker-compose -f compose.yml down
Restart services:
docker-compose -f compose.yml restart
Manual backup:
docker-compose -f compose.yml exec app cp /app/data/production.db /app/data/backup_$(date +%Y%m%d_%H%M%S).db
Check health:
curl http://localhost:3000/health
Volumes
- app_data: Stores the SQLite database
- app_logs: Application logs
- backup_data: Database backups
Security Notes
- Change default passwords after first login
- Update email settings in the application
- Configure firewall to only allow necessary ports
- Use HTTPS with a reverse proxy (nginx/traefik) for production
Troubleshooting
Application won't start:
# Check logs
docker-compose -f compose.yml logs app
# Rebuild without cache
docker-compose -f compose.yml build --no-cache app
Database issues:
# Reset database (WARNING: This will delete all data)
docker-compose -f compose.yml down
docker volume rm $(docker volume ls -q | grep app_data)
docker-compose -f compose.yml up -d
Port conflicts:
If port 3000 is already in use, edit the compose.yml file and change:
ports:
- "3001:3000" # Change 3000 to any available port
Updating the Application
-
Pull latest changes:
git pull origin main -
Rebuild and restart:
docker-compose -f compose.yml up -d --build
Support
For issues and support:
- Check the application logs
- Verify all services are running
- Test the health endpoint
- Check database connectivity
The application should be accessible at http://your-vps-ip:3000 after successful deployment.