Files
maternal-app/DEPLOY_PRODUCTION_SERVER.md
Andrei e5ec7bab71
Some checks failed
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 / 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-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
docs: Add clear production deployment instructions for main branch
2025-10-06 21:54:16 +00:00

1.6 KiB

Production Server Deployment Instructions

Quick Deploy on Server 10.0.0.240

Since the repository has already been cloned, run these commands:

# Navigate to the project directory
cd /root/maternal-app

# Switch to the main branch (where all the code is)
git checkout main
git pull origin main

# Make deployment script executable and run it
chmod +x deploy-to-production.sh
./deploy-to-production.sh

What the Deployment Script Does

  1. Installs System Dependencies

    • Node.js 20.x
    • PM2 process manager
    • Docker and Docker Compose
    • PostgreSQL client tools
  2. Sets Up Database

    • Connects to PostgreSQL at 10.0.0.207
    • Creates parentflow database if needed
    • Runs all migrations in sequence
  3. Starts Services

    • Redis, MongoDB, MinIO via Docker Compose
    • Backend API on port 3020 via PM2
    • Frontend on port 3005 via PM2
  4. Configures PM2

    • Sets up auto-restart on system reboot
    • Saves PM2 configuration

Manual Commands if Needed

Check out the main branch:

git checkout main
git pull origin main

Start all services:

./start-production.sh

Stop all services:

./stop-production.sh

Check PM2 status:

pm2 status
pm2 logs

Check Docker services:

docker-compose -f docker-compose.production.yml ps
docker-compose -f docker-compose.production.yml logs

Important Notes

  • Database: PostgreSQL is on dedicated server 10.0.0.207 (not in Docker)
  • Default branch issue: The repository default branch is 'master' but all code is on 'main'
  • Always use main branch: Make sure to checkout main branch after cloning