Deployment
Deployment
Infrastructure, CI/CD, and environment strategy
Deployment
This section covers the complete deployment infrastructure for HRMS projects, from local development to production.
Live Example
HRMS Documentation: https://docs.hrms.bluewoo.com
This documentation site is deployed using the exact setup described in these guides.
Quick Links
| Guide | Description |
|---|---|
| Development Workflow | Start here - Branch → PR → Deploy process |
| Local Development | Docker setup for local development |
| Infrastructure Setup | GCP project and resource configuration |
| CI/CD Pipeline | GitHub Actions workflow |
| Load Balancer Setup | Custom domain with managed SSL |
| Domain Setup | DNS configuration |
Multi-Service Guides (HRMS App)
| Guide | Description |
|---|---|
| Multi-Service CI/CD | GitHub Actions for HRMS (web, api, ai) |
| Cloud SQL Setup | PostgreSQL on Google Cloud SQL |
| MongoDB Atlas Setup | Vector database for AI service |
| Secret Manager Setup | Secure credential storage |
| Redis Memorystore Setup | Caching and session storage |
Infrastructure Overview
| Service | Platform | Purpose |
|---|---|---|
| Containers | Cloud Run | Auto-scaling serverless containers |
| Registry | Artifact Registry | Docker image storage |
| Load Balancer | Global External LB | Custom domains + SSL |
| Database | Cloud SQL (PostgreSQL 17) | Relational data |
| Vectors | MongoDB Atlas | AI embeddings |
| Files | Cloud Storage | Document storage |
| Cache | Cloud Memorystore (Redis) | Session/data cache |
| Secrets | Secret Manager | API keys, credentials |
| CI/CD | GitHub Actions | Automated deployments |
Architecture
hrms-docs (Current Setup)
┌──────────────────────────────────────┐
│ docs.hrms.bluewoo.com │
└──────────────────┬───────────────────┘
│
▼
┌──────────────────────────────────────┐
│ Global Load Balancer │
│ IP: 34.8.128.20 │
│ SSL: Managed Certificate │
└──────────────────┬───────────────────┘
│
▼
┌──────────────────────────────────────┐
│ Cloud Run │
│ (hrms-docs) │
│ europe-west6 │
└──────────────────────────────────────┘HRMS App (Full Stack)
┌─────────────────────────────────────┐
│ Cloud Run Services │
│ │
│ ┌─────────┐ ┌─────────┐ ┌─────┐ │
│ │Frontend │ │ Backend │ │ AI │ │
│ │(Next.js)│ │(NestJS) │ │Svc │ │
│ └────┬────┘ └────┬────┘ └──┬──┘ │
└───────│───────────│──────────│─────┘
│ │ │
┌─────────────┴───────────┴──────────┴─────────────┐
│ │
▼ ▼
┌─────────────────┐ ┌─────────────────┐
│ Cloud SQL │ │ MongoDB Atlas │
│ (PostgreSQL) │ │ (Vectors) │
└─────────────────┘ └─────────────────┘
│
▼
┌─────────────────┐
│ Cloud Storage │
│ (Documents) │
└─────────────────┘Environment Strategy
| Environment | Purpose | Deployment Trigger | URL Pattern |
|---|---|---|---|
| Local | Development | Manual | localhost:3000 |
| Preview | PR testing | Automatic on PR | pr-{n}.run.app |
| Staging | UAT/QA | Merge to main | *-staging.run.app |
| Production | Live users | After staging | *.hrms.bluewoo.com |
CI/CD Pipeline
┌────────┐ ┌──────┐ ┌───────┐ ┌─────────┐ ┌────────────┐
│ Commit │ → │ Lint │ → │ Test │ → │ Build │ → │ Deploy │
│ │ │ │ │ │ │ (Docker)│ │ Staging │
└────────┘ └──────┘ └───────┘ └─────────┘ └─────┬──────┘
│
▼
┌────────────┐
│ Deploy │
│ Production │
└────────────┘See CI/CD Pipeline for detailed workflow configuration.
Deployment Rules
- All deployments through CI/CD - no manual deploys to staging/production
- Staging deploys automatically on merge to main
- Production deploys after staging (can add manual approval)
- Secrets in Secret Manager - never committed to repository
- Rollback via Cloud Run revisions
Key Architecture Decisions
| Decision | Rationale |
|---|---|
| Cloud Run over GKE | Cost-effective for current scale, scales to zero |
| Load Balancer for domains | Works with any region, managed SSL |
| Artifact Registry | Native GCP integration, vulnerability scanning |
| GitHub Actions | Free tier, excellent integration, AI agent support |
| Workload Identity | No service account keys to manage |
| europe-west6 (Zurich) | Swiss data privacy, EU compliance |
Cost Estimate
hrms-docs (Current)
| Resource | Monthly Cost |
|---|---|
| Cloud Run (staging + prod) | $15-45 |
| Load Balancer | $18 |
| Artifact Registry | $1-5 |
| Total | ~$35-70/month |
HRMS App (Future)
| Resource | Monthly Cost |
|---|---|
| Cloud Run (3 services) | $30-80 |
| Cloud SQL | $10-50 |
| Redis Memorystore | $30-50 |
| Load Balancer | $18 |
| Total | ~$90-200/month |
Getting Started
For hrms-docs (Simple)
- Infrastructure Setup - Create GCP project
- CI/CD Pipeline - Set up GitHub Actions
- Load Balancer Setup - Configure custom domain
- Domain Setup - DNS configuration
For HRMS App (Full Stack)
Follow Phase 11: Production Deployment which covers:
- Cloud SQL Setup - PostgreSQL database
- MongoDB Atlas Setup - Vector database
- Secret Manager Setup - Credentials
- Redis Memorystore Setup - Caching
- Multi-Service CI/CD - Deploy 3 services
Rollback Strategy
# List revisions
gcloud run revisions list --service=hrms-docs --region=europe-west6
# Rollback to previous revision
gcloud run services update-traffic hrms-docs \
--to-revisions=PREVIOUS_REVISION=100 \
--region=europe-west6Last updated: December 2025 - Verified and deployed to production