Overview
Thecompose.yml file defines a multi-service environment that includes:
- LocalStack: AWS services emulation (S3, SQS, SNS, Firehose)
- Redis: In-memory data store
- MongoDB: Document database
- epr-laps-backend: The main application service
Quick Start
Start all services
Build and start all services in detached mode:This will:
- Build the epr-laps-backend image from the local Dockerfile
- Pull required images (LocalStack, Redis, MongoDB)
- Create the
cdp-tenantnetwork - Start all services with health checks
Verify services are running
Check the status of all services:All services should show a status of “Up” or “Up (healthy)”.
Service Configuration
LocalStack
Emulates AWS services for local development.Official LocalStack image
4566: LocalStack Gateway (main endpoint)4510-4559: External services port range
Enabled AWS services:
s3, sqs, sns, firehoseDEBUG: Debug mode (default: 1)LS_LOG: LocalStack log level (set to WARN)LOCALSTACK_HOST: Host address (127.0.0.1)
${TMPDIR:-/tmp}/localstack:/var/lib/localstack- LocalStack data./compose/start-localstack.sh:/etc/localstack/init/ready.d/start-localstack.sh- Initialization script
LocalStack requires the
compose/aws.env file for AWS credentials configuration.Redis
In-memory data store for caching and session management.Official Redis Alpine image
Standard Redis port
- Restart policy:
always - Network:
cdp-tenant - No authentication (local development only)
MongoDB
Document database for application data storage.Official MongoDB image
Standard MongoDB port
mongodb-data:/data- Named volume for persistent data storage
- Restart policy:
always - Network:
cdp-tenant - No authentication (local development only)
MongoDB data persists across container restarts using the named volume
mongodb-data.EPR LAPS Backend
The main application service.context: Current directory (.)target:developmentstage from Dockerfile
Application port (mapped to 3001:3001)
- LocalStack to be healthy (passes health check)
- MongoDB to start (doesn’t wait for ready state)
PORT: 3001NODE_ENV: developmentLOCALSTACK_ENDPOINT: http://localstack:4566MONGO_URI: mongodb://mongodb:27017/- Additional variables from
compose/aws.env
Source code changes are automatically reflected in the running container without rebuilding.
Network Configuration
All services communicate over thecdp-tenant bridge network:
mongodb, localstack, redis).
Volume Management
The compose file defines a named volume for MongoDB:Required Configuration Files
The docker-compose setup requires the following files:AWS credentials and configuration for LocalStack.Required variables:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYAWS_DEFAULT_REGION
Initialization script for LocalStack services.Runs when LocalStack reaches the ready state to configure S3 buckets, SQS queues, etc.
Common Operations
Rebuilding Services
Rebuild a specific service after code changes:Restarting Services
Restart a specific service:Scaling Services
Accessing Service Shells
Open a shell in a running container:Viewing Service Configuration
Display the resolved compose configuration:Troubleshooting
LocalStack Not Healthy
If LocalStack fails health checks:MongoDB Connection Issues
Verify MongoDB is accessible:Port Conflicts
If ports are already in use:Volume Permission Issues
If you encounter permission errors with volumes:Frontend Integration (Optional)
The compose file includes a commented-out frontend service example:Performance Optimization
Build Cache
Speed up builds by using BuildKit:Resource Limits
Add resource constraints to prevent services from consuming too much memory:Next Steps
- Review Environment Variables for configuration options
- Check Docker Deployment for standalone container usage
- Configure the
compose/aws.envfile for your local AWS services