Overview
Docker Compose provides the simplest way to deploy FigoRisk. All services are defined in a single configuration file and can be started with one command.
Recommended for : Development, testing, small to medium production deployments
Deployment Package Structure
figorisk-deployment-package/
├── docker-compose.yml # Service definitions
├── nginx.conf # Nginx configuration
├── .env.template # Environment template
├── deploy-figorisk.sh # Automated deployment script
└── README.md # Quick reference guide
Quick Deployment
Download Package
Download and extract the deployment package: wget https://releases.figorisk.com/figorisk-deployment-v1.0.0.zip
unzip figorisk-deployment-v1.0.0.zip
cd figorisk-deployment-package
Configure Environment
Copy the template and edit configuration: cp .env.template .env
nano .env
Required variables: # Database
MONGO_URI = mongodb://admin:YOUR_PASSWORD@mongo:27017/figorisk? authSource = admin
MONGO_ROOT_PASSWORD = YOUR_SECURE_PASSWORD
# Security
JWT_SECRET = $( openssl rand -hex 32 )
SUPER_ADMIN_PASSWORD = admin123
See Configuration Guide for all options.
Run Deployment Script
Execute the automated deployment: chmod +x deploy-figorisk.sh
./deploy-figorisk.sh
The script will:
✅ Pull latest Docker images
✅ Start all services
✅ Run health checks
✅ Display access information
Verify Deployment
Check all services are running: Expected output: NAME STATUS PORTS
figorisk-backend Up (healthy) 3000/tcp
figorisk-frontend Up 3000/tcp
figorisk-mongo Up 27017/tcp
figorisk-nginx Up 0.0.0.0:80->80/tcp
Access Application
Open your browser to: http://localhost Default login:
Username: admin
Password: Value from SUPER_ADMIN_PASSWORD
Manual Deployment
If you prefer manual control over the deployment process:
cp .env.template .env
# Edit .env with your values
2. Create Directories
3. Pull Images
This downloads all required images:
Backend API
Frontend application
MongoDB database
Nginx reverse proxy
4. Start Services
The -d flag runs services in detached mode (background).
5. Monitor Startup
Watch the logs during startup:
Press Ctrl+C to stop following logs.
6. Verify Health
# Check all services
docker-compose ps
# Test backend health
curl http://localhost/api/health
# Test frontend
curl http://localhost
Service Configuration
docker-compose.yml
The deployment uses this service architecture:
services :
backend :
image : glendyxfigorisk/figorisk-core:latest
# NestJS API server
frontend :
image : glendyxfigorisk/figorisk-fe:latest
# Next.js web application
nginx :
image : nginx:alpine
# Reverse proxy and load balancer
mongo :
image : mongo:6.0
# Database server
Service Details
Backend
Frontend
Database
Nginx
Image : glendyxfigorisk/figorisk-core:latest
Technology : NestJS (Node.js)
Internal Port : 3000
Health Check : /health endpointKey Features:
RESTful API
JWT authentication
Role-based access control
MongoDB integration
AWS S3 integration (optional)
Image : glendyxfigorisk/figorisk-fe:latest
Technology : Next.js (React)
Internal Port : 3000Key Features:
Server-side rendering
Responsive design
Modern UI components
Real-time updates
Image : mongo:6.0
Type : NoSQL document database
Internal Port : 27017
Data Storage : Docker volume (mongo_data)Features:
Automatic backups via volume
Authentication enabled
Optimized for GRC data models
Image : nginx:alpine
External Ports : 80 (HTTP), 443 (HTTPS)Configuration:
Reverse proxy to backend/frontend
Request routing
Rate limiting
SSL termination (if configured)
Static file caching
Management Commands
Starting & Stopping
# Start all services
docker-compose up -d
# Stop all services
docker-compose down
# Restart all services
docker-compose restart
# Restart specific service
docker-compose restart backend
Viewing Logs
# All services (follow mode)
docker-compose logs -f
# Specific service
docker-compose logs -f backend
docker-compose logs -f frontend
# Last 100 lines
docker-compose logs --tail=100
# Since specific time
docker-compose logs --since 30m
Checking Status
# Service status
docker-compose ps
# Resource usage
docker stats
# Detailed service info
docker-compose ps backend
Updating
# Pull latest images
docker-compose pull
# Recreate containers with new images
docker-compose up -d
# Or use the deployment script
./deploy-figorisk.sh
Data Persistence
MongoDB Data
Data is stored in a Docker volume:
# List volumes
docker volume ls
# Inspect volume
docker volume inspect figorisk-deployment-package_mongo_data
# Backup database
docker exec figorisk-mongo mongodump \
--out=/backup \
--username=admin \
--password=YOUR_PASSWORD \
--authenticationDatabase=admin
# Copy backup to host
docker cp figorisk-mongo:/backup ./mongo-backup
Upload Files
User-uploaded files are stored in ./uploads:
# Backup uploads
tar -czf uploads-backup.tar.gz uploads/
# Restore uploads
tar -xzf uploads-backup.tar.gz
Scaling Services
Horizontal Scaling
Scale specific services:
# Scale backend to 3 instances
docker-compose up -d --scale backend= 3
# Scale with load balancing
# (Requires nginx configuration update)
Vertical Scaling
Adjust resource limits in docker-compose.yml:
services :
backend :
deploy :
resources :
limits :
cpus : '2'
memory : 4G
reservations :
cpus : '1'
memory : 2G
Security Best Practices
# Generate strong passwords
openssl rand -base64 32
# Update in .env:
MONGO_ROOT_PASSWORD =< generated-password >
JWT_SECRET =< generated-secret >
SUPER_ADMIN_PASSWORD =< strong-password >
Services communicate via internal Docker network. Only nginx exposes ports externally. # Verify network isolation
docker network inspect figorisk-deployment-package_figorisk-network
Obtain SSL certificate
Place in ssl/ directory:
ssl/
├── certificate.crt
└── private.key
Update nginx configuration for SSL
Restart: docker-compose restart nginx
# Check for updates weekly
docker-compose pull
# Apply updates
docker-compose up -d
# Verify health
docker-compose ps
Troubleshooting
Check logs: docker-compose logs < service-nam e >
Common causes:
Port already in use
Missing environment variables
Insufficient resources
Database connection errors
Verify MongoDB is running: docker-compose ps mongo
docker-compose logs mongo
Test connection: docker exec -it figorisk-mongo mongosh \
--username admin \
--password YOUR_PASSWORD \
--authenticationDatabase admin
Check backend health: docker-compose logs backend
curl http://localhost/api/health
Restart services: docker-compose restart backend nginx
Clean up unused resources: # Remove stopped containers
docker container prune
# Remove unused images
docker image prune -a
# Remove unused volumes (CAUTION: loses data)
docker volume prune
MongoDB Optimization
# Increase connection pool in .env
MONGO_URI = mongodb://admin:pass@mongo:27017/figorisk? authSource = admin & maxPoolSize = 50
Backend Optimization
# In docker-compose.yml
backend :
environment :
- NODE_ENV=production
- NODE_OPTIONS=--max-old-space-size=4096
Nginx Caching
Already configured in nginx.conf:
Static assets cached for 1 year
API responses not cached
Compression enabled
Next Steps