From e5ec7bab716ab9a88c87b953365cb40b2a0d15c0 Mon Sep 17 00:00:00 2001 From: Andrei Date: Mon, 6 Oct 2025 21:54:16 +0000 Subject: [PATCH] docs: Add clear production deployment instructions for main branch --- DEPLOY_PRODUCTION_SERVER.md | 76 +++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 DEPLOY_PRODUCTION_SERVER.md diff --git a/DEPLOY_PRODUCTION_SERVER.md b/DEPLOY_PRODUCTION_SERVER.md new file mode 100644 index 0000000..ce549ad --- /dev/null +++ b/DEPLOY_PRODUCTION_SERVER.md @@ -0,0 +1,76 @@ +# Production Server Deployment Instructions + +## Quick Deploy on Server 10.0.0.240 + +Since the repository has already been cloned, run these commands: + +```bash +# 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: +```bash +git checkout main +git pull origin main +``` + +### Start all services: +```bash +./start-production.sh +``` + +### Stop all services: +```bash +./stop-production.sh +``` + +### Check PM2 status: +```bash +pm2 status +pm2 logs +``` + +### Check Docker services: +```bash +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 \ No newline at end of file