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
Step-by-step guide to deploy on 10.0.0.240: 1. SSH to root@10.0.0.240 2. Download and run deployment script 3. Edit environment variables 4. Verify deployment Includes troubleshooting and management commands. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
3.8 KiB
3.8 KiB
🚀 Deploy ParentFlow to Production - Step by Step
Quick Deploy Instructions
Step 1: Connect to Production Server
Open your terminal and connect via SSH:
ssh root@10.0.0.240
# Password: a3pq5t50yA@#
Step 2: Download and Run Deployment Script
Once connected to the server, run these commands:
# Download the deployment script
wget https://git.noru1.ro/andrei/maternal-app/raw/branch/main/deploy-to-production.sh
# Make it executable
chmod +x deploy-to-production.sh
# Run the deployment
./deploy-to-production.sh
Step 3: Edit Environment Variables (First Time Only)
The script will pause and ask you to edit .env.production.
You need to update these critical values:
# Edit the file
nano /root/maternal-app/.env.production
Key values to update:
JWT_SECRET- Generate with:openssl rand -base64 64JWT_REFRESH_SECRET- Generate with:openssl rand -base64 64OPENAI_API_KEY- Your OpenAI API key for AI features- Redis, MongoDB, MinIO passwords (keep defaults or change)
Press Ctrl+X, then Y, then Enter to save and exit.
Then press Enter in the deployment script to continue.
Step 4: Verify Deployment
After the script completes, verify everything is running:
# Check PM2 processes
pm2 status
# Check Docker containers
docker ps
# Check if services are accessible
curl http://localhost:3020/api/health
curl http://localhost:3030
What the Script Does
- ✅ Clones the repository from Gitea
- ✅ Installs Node.js 18, PM2, Docker, Docker Compose
- ✅ Installs all npm dependencies
- ✅ Builds backend and frontend
- ✅ Starts Docker containers (Redis, MongoDB, MinIO)
- ✅ Runs database migrations on 10.0.0.207
- ✅ Starts PM2 processes for backend (3020) and frontend (3030)
- ✅ Sets up PM2 to restart on system reboot
After Deployment
Test the Application
From your local machine:
- Backend Health: http://10.0.0.240:3020/api/health
- Frontend: http://10.0.0.240:3030
Production URLs (Already configured in Nginx)
Management Commands
On the production server:
# View logs
pm2 logs
# Restart services
pm2 restart all
# Stop services
pm2 stop all
# View real-time metrics
pm2 monit
# Docker logs
docker logs parentflow-redis-prod
docker logs parentflow-mongodb-prod
Troubleshooting
If backend doesn't start:
pm2 logs parentflow-backend-prod --err
cd /root/maternal-app/maternal-app/maternal-app-backend
npm run build
pm2 restart parentflow-backend-prod
If frontend doesn't start:
pm2 logs parentflow-frontend-prod --err
cd /root/maternal-app/maternal-web
npm run build
pm2 restart parentflow-frontend-prod
If database connection fails:
# Test connection
PGPASSWORD=a3ppq psql -h 10.0.0.207 -p 5432 -U postgres -d parentflow -c "SELECT version();"
# Check migrations
cd /root/maternal-app/maternal-app/maternal-app-backend
./scripts/check-migrations.sh
To update after changes:
cd /root/maternal-app
git pull origin main
cd maternal-app/maternal-app-backend
npm install
npm run build
cd ../../maternal-web
npm install
npm run build
pm2 restart all
Success Indicators
You'll know deployment is successful when:
- ✅
pm2 statusshows both processes as "online" - ✅
docker psshows 3 containers running - ✅ Backend responds at http://10.0.0.240:3020/api/health
- ✅ Frontend loads at http://10.0.0.240:3030
- ✅ You can register/login at https://web.parentflowapp.com
Support
If you encounter issues:
- Check logs:
pm2 logs - Check Docker:
docker psanddocker logs [container-name] - Verify PostgreSQL connection to 10.0.0.207
- Ensure ports 3020 and 3030 are not blocked
Ready to deploy! Just SSH to the server and run the 3 commands in Step 2.