180 lines
4.5 KiB
YAML
180 lines
4.5 KiB
YAML
#############################
|
|
# Ports Exposed
|
|
# 4000 - Imex Node API
|
|
# 4556 - LocalStack (Local AWS)
|
|
# 3333 - SocketIO Admin-UI (Optional)
|
|
# 3334 - Redis-Insights (Optional)
|
|
#############################
|
|
|
|
services:
|
|
|
|
# Redis Node 1
|
|
redis-node-1:
|
|
build:
|
|
context: ./redis
|
|
container_name: redis-node-1
|
|
hostname: redis-node-1
|
|
restart: unless-stopped
|
|
networks:
|
|
- redis-cluster-net
|
|
volumes:
|
|
- redis-node-1-data:/data
|
|
- redis-lock:/redis-lock
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
# Redis Node 2
|
|
redis-node-2:
|
|
build:
|
|
context: ./redis
|
|
container_name: redis-node-2
|
|
hostname: redis-node-2
|
|
restart: unless-stopped
|
|
networks:
|
|
- redis-cluster-net
|
|
volumes:
|
|
- redis-node-2-data:/data
|
|
- redis-lock:/redis-lock
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
# Redis Node 3
|
|
redis-node-3:
|
|
build:
|
|
context: ./redis
|
|
container_name: redis-node-3
|
|
hostname: redis-node-3
|
|
restart: unless-stopped
|
|
networks:
|
|
- redis-cluster-net
|
|
volumes:
|
|
- redis-node-3-data:/data
|
|
- redis-lock:/redis-lock
|
|
healthcheck:
|
|
test: ["CMD", "redis-cli", "ping"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 10
|
|
|
|
# LocalStack: Used to emulate AWS services locally, currently setup for SES
|
|
# Notes: Set the ENV Debug to 1 for additional logging
|
|
localstack:
|
|
image: localstack/localstack
|
|
container_name: localstack
|
|
hostname: localstack
|
|
networks:
|
|
- redis-cluster-net
|
|
restart: unless-stopped
|
|
volumes:
|
|
- /var/run/docker.sock:/var/run/docker.sock
|
|
environment:
|
|
- SERVICES=ses,secretsmanager
|
|
- DEBUG=0
|
|
- AWS_ACCESS_KEY_ID=test
|
|
- AWS_SECRET_ACCESS_KEY=test
|
|
- AWS_DEFAULT_REGION=ca-central-1
|
|
- EXTRA_CORS_ALLOWED_HEADERS=Authorization,Content-Type
|
|
- EXTRA_CORS_ALLOWED_ORIGINS=*
|
|
- EXTRA_CORS_EXPOSE_HEADERS=Authorization,Content-Type
|
|
ports:
|
|
- "4566:4566"
|
|
healthcheck:
|
|
test: ["CMD", "curl", "-f", "http://localhost:4566/_localstack/health"]
|
|
interval: 10s
|
|
timeout: 5s
|
|
retries: 5
|
|
start_period: 20s
|
|
|
|
# AWS-CLI - Used in conjunction with LocalStack to set required permission to send emails
|
|
aws-cli:
|
|
image: amazon/aws-cli
|
|
container_name: aws-cli
|
|
hostname: aws-cli
|
|
networks:
|
|
- redis-cluster-net
|
|
depends_on:
|
|
localstack:
|
|
condition: service_healthy
|
|
volumes:
|
|
- './localstack:/tmp/localstack'
|
|
- './certs:/tmp/certs'
|
|
|
|
environment:
|
|
- AWS_ACCESS_KEY_ID=test
|
|
- AWS_SECRET_ACCESS_KEY=test
|
|
- AWS_DEFAULT_REGION=ca-central-1
|
|
entrypoint: /bin/sh -c
|
|
command: >
|
|
"
|
|
aws --endpoint-url=http://localstack:4566 ses verify-domain-identity --domain imex.online --region ca-central-1
|
|
aws --endpoint-url=http://localstack:4566 ses verify-email-identity --email-address noreply@imex.online --region ca-central-1
|
|
aws --endpoint-url=http://localstack:4566 secretsmanager create-secret --name CHATTER_PRIVATE_KEY --secret-string file:///tmp/certs/id_rsa
|
|
"
|
|
# Node App: The Main IMEX API
|
|
node-app:
|
|
build:
|
|
context: .
|
|
container_name: node-app
|
|
hostname: imex-api
|
|
networks:
|
|
- redis-cluster-net
|
|
env_file:
|
|
- .env.development
|
|
depends_on:
|
|
redis-node-1:
|
|
condition: service_healthy
|
|
redis-node-2:
|
|
condition: service_healthy
|
|
redis-node-3:
|
|
condition: service_healthy
|
|
localstack:
|
|
condition: service_healthy
|
|
aws-cli:
|
|
condition: service_completed_successfully
|
|
ports:
|
|
- "4000:4000"
|
|
- "9229:9229"
|
|
volumes:
|
|
- .:/app
|
|
- node-app-npm-cache:/app/node_modules
|
|
|
|
# ## Optional Container to Observe SocketIO data
|
|
# socketio-admin-ui:
|
|
# image: maitrungduc1410/socket.io-admin-ui
|
|
# container_name: socketio-admin-ui
|
|
# networks:
|
|
# - redis-cluster-net
|
|
# ports:
|
|
# - "3333:80"
|
|
|
|
# ##Optional Container to Observe Redis Cluster Data
|
|
# redis-insight:
|
|
# image: redislabs/redisinsight:latest
|
|
# container_name: redis-insight
|
|
# hostname: redis-insight
|
|
# restart: unless-stopped
|
|
# ports:
|
|
# - "3334:5540"
|
|
# networks:
|
|
# - redis-cluster-net
|
|
# volumes:
|
|
# - redis-insight-data:/db
|
|
|
|
networks:
|
|
redis-cluster-net:
|
|
driver: bridge
|
|
|
|
volumes:
|
|
node-app-npm-cache:
|
|
redis-node-1-data:
|
|
redis-node-2-data:
|
|
redis-node-3-data:
|
|
redis-lock:
|
|
redis-insight-data:
|