Some checks failed
ParentFlow CI/CD Pipeline / Backend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Frontend Tests (push) Has been cancelled
ParentFlow CI/CD Pipeline / Security Scanning (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-app/maternal-app-backend dockerfile:Dockerfile.production name:backend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Build Docker Images (map[context:maternal-web dockerfile:Dockerfile.production name:frontend]) (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Development (push) Has been cancelled
ParentFlow CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / Lint and Test (push) Has been cancelled
CI/CD Pipeline / E2E Tests (push) Has been cancelled
CI/CD Pipeline / Build Application (push) Has been cancelled
- Update deploy-production.sh to properly checkout main branch - Fix PRODUCTION_INSTALLATION.md to include checkout main step - Ensure all deployment instructions switch to main branch correctly
6.0 KiB
6.0 KiB
Production Deployment Instructions
Prerequisites
- Ubuntu/Debian server with root access
- Server IP: 10.0.0.240
- PostgreSQL server at: 10.0.0.207
- Domains configured:
- api.parentflowapp.com → 10.0.0.240:3020
- web.parentflowapp.com → 10.0.0.240:3030
- adminpf.parentflowapp.com → 10.0.0.240:3335
Quick Installation (One Command)
SSH into your production server and run:
cd /root && \
git clone https://andrei:33edc%40%40NHY%5E%5E@git.noru1.ro/andrei/maternal-app.git parentflow-production && \
cd parentflow-production && \
git checkout main && \
chmod +x deploy-production.sh && \
./deploy-production.sh
This will automatically:
- Install Node.js 22 and all dependencies
- Install Docker and Docker Compose
- Start all required services (Redis, MongoDB, MinIO)
- Run database migrations
- Build all applications
- Start PM2 services
Manual Step-by-Step Installation
1. Clone Repository
cd /root
git clone https://andrei:33edc%40%40NHY%5E%5E@git.noru1.ro/andrei/maternal-app.git parentflow-production
cd parentflow-production
git checkout main
2. Make Scripts Executable
chmod +x deploy-production.sh
chmod +x migrate-production.sh
chmod +x start-production.sh
chmod +x stop-production.sh
3. Run Initial Deployment
./deploy-production.sh
This script will:
- Install Node.js 22
- Install Docker and Docker Compose
- Clone the latest code from main branch
- Install all npm dependencies
- Start Docker services (Redis, MongoDB, MinIO)
- Run database migrations
- Build production apps
- Start PM2 services
4. Verify Installation
After deployment completes, verify all services are running:
# Check PM2 services
pm2 list
# Check service health
curl http://localhost:3020/health # Backend API
curl http://localhost:3030 # Frontend
curl http://localhost:3335 # Admin Dashboard
# Check Docker services
docker ps
Service Management
Start All Services
cd /root/parentflow-production
./start-production.sh
Stop All Services
cd /root/parentflow-production
./stop-production.sh
Run Database Migrations Only
cd /root/parentflow-production
./migrate-production.sh
View Logs
# PM2 logs
pm2 logs parentflow-backend-prod
pm2 logs parentflow-frontend-prod
pm2 logs parentflow-admin-prod
# Docker logs
docker logs parentflow-redis
docker logs parentflow-mongodb
docker logs parentflow-minio
Update Production
To update production with the latest code:
cd /root/parentflow-production
git pull origin main
./deploy-production.sh
Service Ports
| Service | Port | URL |
|---|---|---|
| Backend API | 3020 | https://api.parentflowapp.com |
| Frontend | 3030 | https://web.parentflowapp.com |
| Admin Dashboard | 3335 | https://adminpf.parentflowapp.com |
| Redis | 6379 | Internal only |
| MongoDB | 27017 | Internal only |
| MinIO | 9000 | Internal only |
| MinIO Console | 9001 | http://10.0.0.240:9001 |
Database Access
Production database is hosted on dedicated server:
- Host: 10.0.0.207
- Port: 5432
- Database: parentflow
- User: postgres
- Password: a3ppq
To access database directly:
PGPASSWORD=a3ppq psql -h 10.0.0.207 -p 5432 -U postgres -d parentflow
Admin Dashboard
Access the admin dashboard at: https://adminpf.parentflowapp.com
Default admin credentials:
- Email: admin@parentflowapp.com
- Password: admin123
IMPORTANT: Change the admin password after first login!
Troubleshooting
Services Not Starting
# Check PM2 status
pm2 status
# Check error logs
pm2 logs --err
# Restart specific service
pm2 restart parentflow-backend-prod
pm2 restart parentflow-frontend-prod
pm2 restart parentflow-admin-prod
Port Conflicts
# Check what's using a port
lsof -i :3020 # Backend
lsof -i :3030 # Frontend
lsof -i :3335 # Admin
# Kill process on port (if needed)
kill -9 $(lsof -t -i:3020)
Database Connection Issues
# Test database connection
PGPASSWORD=a3ppq psql -h 10.0.0.207 -p 5432 -U postgres -d parentflow -c "\dt"
# Check migrations status
cd /root/parentflow-production
./migrate-production.sh
Docker Issues
# Restart Docker services
docker-compose -f docker-compose.production.yml down
docker-compose -f docker-compose.production.yml up -d
# Check Docker logs
docker logs parentflow-redis -f
docker logs parentflow-mongodb -f
Monitoring
PM2 Monitoring
# Enable PM2 web monitoring
pm2 web
# Save PM2 configuration
pm2 save
pm2 startup
System Resources
# Check memory usage
free -h
# Check disk space
df -h
# Check CPU usage
htop
Backup
Database Backup
# Create backup
PGPASSWORD=a3ppq pg_dump -h 10.0.0.207 -p 5432 -U postgres -d parentflow > backup_$(date +%Y%m%d).sql
# Restore backup
PGPASSWORD=a3ppq psql -h 10.0.0.207 -p 5432 -U postgres -d parentflow < backup_20240101.sql
Application Backup
# Backup uploads and data
tar -czf parentflow_data_$(date +%Y%m%d).tar.gz /root/parentflow-production/uploads
Security Notes
-
Change default passwords immediately after installation:
- Admin dashboard password
- Database passwords (if using defaults)
- Redis password
- MongoDB password
- MinIO credentials
-
Configure firewall to only allow necessary ports:
- 80, 443 (HTTP/HTTPS)
- 22 (SSH - consider changing default port)
- Block direct access to service ports from outside
-
Enable SSL/TLS using Let's Encrypt:
apt-get install certbot python3-certbot-nginx certbot --nginx -d api.parentflowapp.com -d web.parentflowapp.com -d adminpf.parentflowapp.com -
Regular Updates:
# Update system packages apt update && apt upgrade -y # Update Node.js packages (with caution) cd /root/parentflow-production npm audit fix
Support
For issues or questions:
- Check PM2 logs:
pm2 logs - Check application logs in
/root/parentflow-production/logs/ - Review error logs:
pm2 logs --err - Check system logs:
journalctl -xe