Overview
This guide covers deploying the Product Distribution Dashboard to production environments, with detailed instructions for Render.com deployment and configuration for Azure PostgreSQL.Deployment Architecture
The application uses a multi-service architecture:- Backend: Docker-based Spring Boot application (Java 17)
- Frontend: Static Angular build served via CDN
- Database: Azure PostgreSQL managed database
Render.com Deployment
The application is configured for deployment on Render using therender.yaml Blueprint specification.
Prerequisites
Render Account
Create a free account at render.com
Render Blueprint Configuration
Therender.yaml file defines the deployment configuration:
Deployment Steps
Connect Repository to Render
- Log in to Render Dashboard
- Click “New” → “Blueprint”
- Connect your GitHub repository
- Render will automatically detect
render.yaml
Configure Environment Variables
Before deploying, set sensitive environment variables that are not in
render.yaml:Backend Service:DATABASE_PASSWORD: Your Azure PostgreSQL password
Deploy Services
Click “Apply” to deploy both services:
- Backend builds from Docker image
- Frontend builds and deploys static assets
- Render assigns URLs to each service
Database Setup (Azure PostgreSQL)
The production environment uses Azure PostgreSQL with SSL enabled.Creating Azure PostgreSQL Database
Database Connection String
The production profile (application-prod.properties) uses:
DATABASE_HOST: product-distribution-db.postgres.database.azure.comDATABASE_PORT: 5432DATABASE_NAME: product_distribution_dbDATABASE_USERNAME: product_distributionDATABASE_PASSWORD: (set in Render environment)
Production Configuration
Backend Production Profile
Theprod profile includes optimizations for production:
Environment Variables Reference
| Variable | Required | Description | Example |
|---|---|---|---|
SPRING_PROFILES_ACTIVE | Yes | Spring profile | prod |
DATABASE_HOST | Yes | Azure PostgreSQL host | *.postgres.database.azure.com |
DATABASE_PORT | Yes | Database port | 5432 |
DATABASE_NAME | Yes | Database name | product_distribution_db |
DATABASE_USERNAME | Yes | Database user | product_distribution |
DATABASE_PASSWORD | Yes | Database password | (secret) |
APP_FRONTEND_URL | Yes | Frontend URL for CORS | https://your-app.onrender.com |
PORT | No | Server port | 8080 (default) |
SCHEDULER_DISTRIBUTION_CRON | No | Cron schedule | 0 0 2 * * * (2 AM daily) |
DATA_PRODUCTS_URL | No | Products data source | GitHub raw URL |
DATA_STORES_URL | No | Stores data source | GitHub raw URL |
DATA_WAREHOUSES_URL | No | Warehouses data source | GitHub raw URL |
Health Checks
Backend Health Endpoint
The backend exposes Spring Boot Actuator health checks: Endpoint:/actuator/health
Response:
Exposed Actuator Endpoints
health and info endpoints are exposed in production for security.
Docker Configuration
Backend Dockerfile
Multi-stage build for optimized production images:- Multi-stage build reduces final image size
- Non-root user for security
- Built-in health check
- Cached dependency layer for faster builds
Frontend Build
The frontend is built and deployed as static files:frontend/dist/frontend/browser/
Render serves these files via CDN with automatic HTTPS.
Deployment Workflow
Automatic Deployments
Render automatically deploys when changes are pushed to the main branch:Render Detects Changes
Based on
buildFilter paths, Render determines which services to rebuild:- Changes in
backend/**→ rebuild backend - Changes in
frontend/**→ rebuild frontend - Changes in
render.yaml→ rebuild both
Manual Deployments
Deploy manually from the Render dashboard:- Navigate to service
- Click “Manual Deploy” → “Deploy latest commit”
- Select branch to deploy
Monitoring and Logs
Viewing Logs
Render Dashboard:- Navigate to service → Logs
- Real-time log streaming
- Search and filter capabilities
Metrics and Monitoring
Render provides:- CPU usage graphs
- Memory usage tracking
- Request metrics
- Health check history
For advanced monitoring, integrate with external services like Datadog, New Relic, or Sentry.
Scaling
Horizontal Scaling
Render supports horizontal scaling for paid plans:Vertical Scaling
Upgrade instance size for more resources:- Free: 512 MB RAM, 0.1 CPU
- Starter: 2 GB RAM, 1 CPU
- Standard: 4 GB RAM, 2 CPU
- Pro: 8 GB RAM, 4 CPU
Security Best Practices
Troubleshooting
Backend Won’t Start
Check Environment Variables:Database Connection Errors
Symptoms: Backend logs show connection timeouts Solutions:- Verify Azure firewall rules allow Render IPs
- Check database credentials
- Ensure SSL is configured:
sslmode=require - Verify database is running:
Build Failures
Frontend Build Fails:- Check Node.js version compatibility (requires Node 20)
- Verify
package-lock.jsonis committed - Review build logs for dependency errors
- Check Java version (requires Java 17)
- Verify Maven dependencies are accessible
- Review Dockerfile for syntax errors
High Memory Usage
Solution: Adjust JVM memory settings: Add to Dockerfile:Slow Performance
Solutions:- Increase instance size (upgrade plan)
- Optimize database connection pool:
- Enable database query caching
- Add database indexes for frequently queried fields
Rollback
Render maintains deployment history:Next Steps
Docker Setup
Run the application locally using Docker Compose
Local Development
Set up your local development environment