feat: Update all production configs for dedicated PostgreSQL server
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

- PostgreSQL now on dedicated server: 10.0.0.207:5432
- Database: parentflow (user: postgres, password: a3ppq)
- Removed PostgreSQL from docker-compose.production.yml
- Updated start-production.sh to check PostgreSQL connectivity
- Updated migration scripts to use dedicated server
- Created .env.admin.example for admin service configuration
- Updated admin dashboard docs with PostgreSQL details
- Redis, MongoDB, MinIO remain as Docker containers on 10.0.0.240

Infrastructure:
- Application Server: 10.0.0.240 (PM2 + Docker services)
- Database Server: 10.0.0.207 (PostgreSQL only)
- Admin Server: 10.0.0.241 (future deployment)
- Nginx Proxy: Separate server with SSL configured

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-06 21:39:28 +00:00
parent bfefb19100
commit e07aaa5016
4 changed files with 143 additions and 40 deletions

View File

@@ -57,29 +57,40 @@ fi
echo -e "${YELLOW}Waiting for databases to be healthy...${NC}"
sleep 10
# Check database health
echo -e "${BLUE}Checking database health...${NC}"
# Check PostgreSQL connectivity (dedicated server)
echo -e "${BLUE}Checking PostgreSQL connectivity on 10.0.0.207...${NC}"
PGPASSWORD=a3ppq psql -h 10.0.0.207 -p 5432 -U postgres -d parentflow -c "SELECT version();" > /dev/null 2>&1
if [ $? -eq 0 ]; then
echo -e "${GREEN}✓ PostgreSQL connection successful${NC}"
else
echo -e "${RED}✗ Cannot connect to PostgreSQL on 10.0.0.207${NC}"
echo "Please ensure PostgreSQL is running and accessible"
exit 1
fi
# Check Docker services health
echo -e "${BLUE}Checking Docker services health...${NC}"
MAX_RETRIES=30
RETRY_COUNT=0
while [ $RETRY_COUNT -lt $MAX_RETRIES ]; do
POSTGRES_HEALTHY=$(docker inspect parentflow-postgres-prod --format='{{.State.Health.Status}}' 2>/dev/null || echo "starting")
REDIS_HEALTHY=$(docker inspect parentflow-redis-prod --format='{{.State.Health.Status}}' 2>/dev/null || echo "starting")
MONGO_HEALTHY=$(docker inspect parentflow-mongodb-prod --format='{{.State.Health.Status}}' 2>/dev/null || echo "starting")
MINIO_HEALTHY=$(docker inspect parentflow-minio-prod --format='{{.State.Health.Status}}' 2>/dev/null || echo "starting")
if [ "$POSTGRES_HEALTHY" = "healthy" ] && [ "$REDIS_HEALTHY" = "healthy" ] && [ "$MONGO_HEALTHY" = "healthy" ]; then
echo -e "${GREEN}✓ All databases are healthy${NC}"
if [ "$REDIS_HEALTHY" = "healthy" ] && [ "$MONGO_HEALTHY" = "healthy" ] && [ "$MINIO_HEALTHY" = "healthy" ]; then
echo -e "${GREEN}✓ All Docker services are healthy${NC}"
break
fi
echo -e "${YELLOW}Waiting for databases... ($RETRY_COUNT/$MAX_RETRIES)${NC}"
echo -e "${YELLOW}Waiting for Docker services... ($RETRY_COUNT/$MAX_RETRIES)${NC}"
sleep 2
((RETRY_COUNT++))
done
if [ $RETRY_COUNT -eq $MAX_RETRIES ]; then
echo -e "${RED}✗ Databases failed to become healthy${NC}"
echo "Check Docker logs with: docker logs parentflow-postgres-prod"
echo -e "${RED}✗ Docker services failed to become healthy${NC}"
echo "Check Docker logs with: docker logs parentflow-redis-prod"
exit 1
fi
@@ -91,11 +102,11 @@ cd /root/maternal-app/maternal-app/maternal-app-backend
# Check if migration script exists
if [ -f "./scripts/master-migration.sh" ]; then
echo -e "${YELLOW}Running master migration script...${NC}"
DATABASE_HOST=localhost \
DATABASE_HOST=10.0.0.207 \
DATABASE_PORT=5432 \
DATABASE_NAME=parentflow_production \
DATABASE_USER=parentflow_user \
DATABASE_PASSWORD=parentflow_secure_password_2024 \
DATABASE_NAME=parentflow \
DATABASE_USER=postgres \
DATABASE_PASSWORD=a3ppq \
./scripts/master-migration.sh || {
echo -e "${YELLOW}Warning: Migrations may have partially failed. Continuing...${NC}"
}