Overview
Carrier can be used locally in a Docker Compose stack for development and testing. This guide shows you how to configure Carrier as a sidecar service alongside your event worker application.Basic Docker Compose Configuration
Here’s a complete Docker Compose setup for running Carrier with a worker application that expects webhooks at/webhook on port 9000:
This example requires AWS credentials to be mounted even though they are not used with the local SQS container, otherwise the AWS SDK will panic.
Service Configuration Explained
SQS Service
roribio/alpine-sqs image provides a local SQS-compatible service for testing. This lightweight Alpine-based image runs on port 9324 by default and is perfect for local development.
Carrier Service
- Image: Uses the official
amplifysecurity/carrierimage (under 8MB) - Restart policy:
unless-stoppedensures Carrier restarts automatically if it crashes - Volume mount: Maps your local AWS credentials into the container at
/.aws/credentials - Links: Connects to both the
sqsandworkerservices for internal networking
CARRIER_WEBHOOK_ENDPOINT: The full URL where your worker expects webhook POST requestsCARRIER_SQS_ENDPOINT: Points to the local SQS serviceCARRIER_SQS_QUEUE_NAME: The name of the SQS queue to consume from
Worker Service
build: . with your specific configuration (e.g., image name, build context, or docker compose file reference).
Local Development Setup
Step 1: Create docker-compose.yml
Create adocker-compose.yml file in your project root with the configuration above, adjusting the worker configuration to match your application.
Step 2: Configure Environment Variables
You can customize the configuration using additional environment variables:Step 3: Start the Stack
Step 4: View Logs
Development-Specific Configuration
Enable Colorized Logging
For better readability during local development:Enable Statistics Logging
Monitor Carrier’s performance with periodic stats:Health Check Configuration
Ensure Carrier waits for your worker to be ready:Using with AWS SQS
To connect to a real AWS SQS queue instead of the local container:Remove the
sqs service and its link when connecting to AWS SQS.Troubleshooting
AWS SDK Panics
If you see AWS SDK errors, ensure your credentials are properly mounted:Worker Not Receiving Messages
Check that:- The webhook endpoint URL is correct
- The worker service is listening on the expected port
- Service links are properly configured
- Network connectivity between containers is working
Connection Refused Errors
If Carrier can’t connect to the worker:- Verify the worker is running:
docker-compose ps - Check worker logs:
docker-compose logs worker - Ensure the port and path match your worker’s configuration
Next Steps
Kubernetes Deployment
Deploy Carrier as a sidecar in Kubernetes
Configuration Reference
Complete list of configuration options
