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
76 lines
1.6 KiB
Markdown
76 lines
1.6 KiB
Markdown
# 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 |