๐จ Building
Local Build
# Build the entire solutiondotnet build BlazorBlueprint.sln --configuration Release# Run testsdotnet test BlazorBlueprint.sln --configuration Release# Publish for deploymentdotnet publish Web/BlazorBlueprint.Web/BlazorBlueprint.Web.csproj --configuration Release --output ./publish/webDocker Build
# Build all services with Docker Compose (GitHub Actions)docker-compose -f .github/workflows/docker-compose.yml build# Build all services with Docker Compose (Azure DevOps)docker-compose -f .azure/devops/docker-compose.yml build# Or build individual imagesdocker build -f Web/BlazorBlueprint.Web/Dockerfile -t blazor-blueprint-web .docker build -f Services/BlazorBlueprint.ApplicationService/Dockerfile -t blazor-blueprint-api .๐ฆ Deployment
Quick Deployment (Docker Compose)
# Deploy all services (GitHub Actions)docker-compose -f .github/workflows/docker-compose.yml up -d# Deploy all services (Azure DevOps)docker-compose -f .azure/devops/docker-compose.yml up -d# View logsdocker-compose -f .azure/devops/docker-compose.yml logs -f# Stop servicesdocker-compose -f .azure/devops/docker-compose.yml downโ What CI/CD Deployment Includes: Complete production stack with MongoDB, Redis, Web App, API Service - all with persistent data volumes and proper networking. This is different from Aspire development which requires you to provide MongoDB separately.
Manual Deployment Scripts
Use the included deployment scripts for manual deployments:
Windows (PowerShell)
# Azure DevOps script.\\.azure\\devops\\deploy-container.ps1 -webImage "your-web-image:latest" -appImage "your-api-image:latest"# GitHub Actions script.\\.github\\workflows\\deploy-container.ps1 -WebImage "your-web-image:latest" -AppImage "your-api-image:latest"Linux/macOS (Shell)
# Set environment variablesexport WEB_IMAGE="your-web-image:latest"export APP_IMAGE="your-api-image:latest"# Run deployment scriptchmod +x .github/workflows/deploy-container.sh./.github/workflows/deploy-container.shProduction Considerations
- Persistent Storage: Docker volumes preserve data across deployments
- Environment Variables: Configure production settings via environment
- SSL/TLS: Add reverse proxy (nginx/Apache) for HTTPS
- Monitoring: Use built-in health checks and infrastructure monitor
- Backups: Regular MongoDB backups and configuration backups
- Scaling: Kubernetes deployment for automatic scaling and high availability
- Background Processing: .NET Worker Service handles background tasks including push notifications, data cleanup, and AI workflows
๐ CI/CD Setup
Quick Setup
Choose your preferred platform and follow the simple setup steps:
๐ What You Need: A container registry (GitHub Container Registry or Docker Hub) and a server with Docker installed.
GitHub Actions Setup
1. Configure Variables and Secrets
Go to your repository โ Settings โ Secrets and variables โ Actions
Variables (Repository Settings โ Actions โ Variables)
# Required VariablesDOCKER_REGISTRY: 'ghcr.io'WEB_IMAGE_REPOSITORY: 'ghcr.io/yourusername/your-web-app'APP_IMAGE_REPOSITORY: 'ghcr.io/yourusername/your-api-service'Secrets (Repository Settings โ Actions โ Secrets)
# Required SecretsGITHUB_TOKEN: 'ghp_xxxxxxxxxxxxxxxxxxxx'2. Setup Self-Hosted Runner
- Install Docker on your server
- Go to Repository โ Settings โ Actions โ Runners โ New self-hosted runner
- Follow GitHub's setup instructions
- Open ports 8080 (Web) and 8081 (API)
3. Deploy
Push to main branch or trigger manual deployment from Actions tab.
Azure DevOps Setup
1. Create Pipeline
- Go to Azure DevOps โ Pipelines โ New Pipeline
- Select your repository
- Choose "Existing Azure Pipelines YAML file"
- Select
.azure/devops/build-pipeline.yml
2. Configure Variables
Go to Pipelines โ Library โ Variable Groups
# Required VariablesDOCKER_REGISTRY_SERVICE_CONNECTION: 'docker-hub-connection'DOCKER_REGISTRY: 'docker.io/'WEB_IMAGE_REPOSITORY: 'yourusername/your-web-app'APP_IMAGE_REPOSITORY: 'yourusername/your-api-service'Service Connection Authentication
# Docker Hub Credentials (configured in Service Connection)Username: 'your-dockerhub-username'Password: 'your-dockerhub-token'3. Create Service Connection
Go to Project Settings โ Service connections โ New service connection โ Docker Registry
- Registry type: Docker Hub
- Connection name: docker-hub-connection
- Username: Your Docker Hub username
- Password: Your Docker Hub access token (not password)
๐ก Note: Use a Docker Hub access token, not your account password, for better security.
4. Deploy
Run the pipeline manually or set up triggers for automatic deployment.
Manual Deployment
For manual deployments, use the included scripts:
Linux/macOS
# Set required environment variablesexport WEB_IMAGE="your-registry/your-web-app:latest"export APP_IMAGE="your-registry/your-api-service:latest"# Run deployment scriptchmod +x .github/workflows/deploy-container.sh./.github/workflows/deploy-container.shWindows
# Run deployment script with required parameters.\\.github\\workflows\\deploy-container.ps1 -WebImage "your-registry/your-web-app:latest" -AppImage "your-registry/your-api-service:latest"What Gets Deployed (CI/CD Production)
- Web Application: Blazor Server app on port 8080
- API Service: Application service on port 8081
- .NET Worker Service: Background processing service for handling async tasks and queue processing
- Kafka: Message queue for background job processing
- MongoDB: Database on port 27018 with persistent storage
- Redis: Cache on port 6379 with persistent storage
- Persistent Storage: Data volumes for MongoDB and Redis
- Networking: Isolated Docker network for service communication
- Kubernetes: Container orchestration for scaling and high availability
๐ก Note: This is the complete production stack. For development with .NET Aspire, MongoDB is not included and must be provided separately. The .NET Worker Service handles background tasks (push notifications, data cleanup, AI workflows) through queue processing, enabling scalable and resilient background processing.
๐ญ Production Environment
Infrastructure Requirements
- Server: 4+ CPU cores, 8GB+ RAM, 20GB+ storage
- Docker: Docker Engine 20.10+ or Docker Desktop
- Network: Ports 8080 (Web), 8081 (API), 80/443 (HTTP/HTTPS)
- SSL Certificate: For HTTPS (Let's Encrypt recommended)
Security Configuration
- Environment Variables: Store secrets in environment, not appsettings.json
- Database Security: Enable MongoDB authentication and encryption
- Redis Security: Configure Redis AUTH and disable dangerous commands
- HTTPS Only: Force HTTPS redirects and secure cookies
- CORS: Configure appropriate CORS policies
Monitoring & Maintenance
- Health Checks: Monitor /health endpoint
- Infrastructure Monitor: Use built-in dashboard
- Logging: Configure structured logging and log aggregation
- Backups: Automated MongoDB backups and disaster recovery
- Updates: Regular security updates and dependency updates
Performance Optimization
- Caching: Redis distributed caching is enabled by default
- CDN: Use CDN for static assets and images
- Database: Create appropriate MongoDB indexes
- Scaling: Kubernetes horizontal pod autoscaling for automatic scaling based on load
- Background Processing: Queue-based background processing enables horizontal scaling of worker services
- Compression: Enable gzip compression in reverse proxy
๐ฆ Ready to Download?
Deploy your SaaS application with confidence. Download the free Developer version or get Enterprise with premium plugins, commercial licensing, and production support.
๐ Open Source on GitHub โข Free for personal/non-commercial use โข Enterprise license (ยฃ399) required for commercial use โข Full source code included