Method 2: Deployment Using Docker Compose
On-prem Deployment Guide (AWS)
Goal: Deploy Hivel VM services using Docker Compose with manual orchestration.
Prerequisites:
Database Migration completed successfully
.envfile configured with application user credentials (DB_USER and DB_PASSWORD)Docker and Docker Compose installed on VM
AWS ECR access configured (IAM role or AWS CLI credentials)
Advanced Docker and Docker Compose knowledge
Step 1: Authenticate with AWS ECR
Application/System: EC2 VM (AWS CLI and Docker)
Goal: Log Docker in to the AWS ECR registry so images can be pulled.
For Hivel's ECR:
# Authenticate with ECR
aws ecr get-login-password --region ap-south-1 | \
docker login --username AWS --password-stdin \
730335373269.dkr.ecr.ap-south-1.amazonaws.com
For your own ECR:
Expected result: Output shows Login Succeeded.
If it fails: Verify AWS credentials are configured and have ECR permissions.
Step 2: Create Docker Network
Application/System: EC2 VM (Docker)
Goal: Create a shared network for all services to communicate.
Expected result: Command prints a network ID with no errors.
Step 3: Deploy VM Services
Application/System: EC2 VM (Docker Compose)
Goal: Pull images and start all services.
On your EC2 VM, run:
Wait 2-5 minutes for all services to start.
Docker Compose Management Commands
Use these commands to manage services after deployment:
Important Notes
All commands must be run from
/opt/hivel-onprem/services/vmdirectoryAlways use
--env-file ../../config/.envto ensure services read correct configurationServices communicate via the
microservices_networkcreated in Step 2Logs are displayed live with
docker-compose logs -f; useCtrl+Cto exitDo not manually manage the Docker network or service ordering; Docker Compose handles this
Keep all services on the same Docker network for communication
Next Steps
After successful deployment:
Verify all services are running:
docker-compose psCheck logs for any errors:
docker-compose logsAccess the Hivel application at the configured frontend URL
Proceed to Log Rotation Setup
Quick Troubleshooting
Image pull fails: Verify ECR authentication succeeded (Login Succeeded)
Services fail to start: Check
.envfile has correct database credentials and RDS is reachableServices can't communicate: Verify all services are on
microservices_networkwithdocker network inspect microservices_networkPermission denied errors: Ensure user running Docker Compose has Docker permissions
See Troubleshooting for detailed solutions.
Last updated