Skip to content

Instantly share code, notes, and snippets.

@dkarchmer
Created February 25, 2016 01:38
Show Gist options
  • Save dkarchmer/b0c54f3bbbe646eda63e to your computer and use it in GitHub Desktop.
Save dkarchmer/b0c54f3bbbe646eda63e to your computer and use it in GitHub Desktop.
This shows a V2 Docker Compose example with a Django server/worker, redis, postgres, elasticcache and local dynamodb (for development)
version: '2'
services:
# Data
dbdata:
image: busybox
command: "true"
volumes:
- /var/lib/postgresql/data
- /data
db:
image: postgres:9.4
ports:
- "5432:5432"
volumes_from:
- dbdata
redis:
restart: always
image: redis:latest
ports:
- "6379:6379"
volumes_from:
- dbdata
elasticsearch:
image: elasticsearch
hostname: elasticsearch
environment:
- HAYSTACK_PORT=9200
ports:
- "9200:9200"
dynamodb:
image: deangiberson/aws-dynamodb-local
ports:
- "7777:8000"
volumes:
- ./data/dynamodb:/var/dynamodb_local
command: -port 8000 -sharedDb
nginx:
restart: always
build: ./nginx/
ports:
- "80:80"
volumes_from:
- web
links:
- web:web
web:
build: server
volumes:
- ./logs/server:/var/app/logs
- ./server:/var/app
- ./staticfiles:/www/static
ports:
- "5000:8080"
links:
- db:db
- redis:redis
- dynamodb:dynamodb
- elasticsearch:elasticsearch
environment:
- DJANGO_SETTINGS_MODULE=config.settings.docker
- RDS_DB_NAME=db_name
- RDS_USERNAME=db_user
- RDS_PASSWORD=''
- RDS_HOSTNAME=db
- RDS_PORT=5432
- DYNAMODB_ADDR=${DOCKER_ADDR}
- DYNAMODB_PORT=7777
- REDIS_ADDR=${DOCKER_ADDR}
- REDIS_PORT=6379
- DJANGO_SECRET_KEY=changeme-for-production1
vps:
build: vps
volumes:
- ./logs/worker:/var/app/logs
- ./vps:/var/app
ports:
- "3000:8080"
links:
- db:db
- redis:redis
- dynamodb:dynamodb
environment:
- DJANGO_SETTINGS_MODULE=config.settings.docker
- RDS_DB_NAME=db_name
- RDS_USERNAME=db_user
- RDS_PASSWORD=''
- RDS_HOSTNAME=db
- RDS_PORT=5432
- DYNAMODB_ADDR=${DOCKER_ADDR}
- DYNAMODB_PORT=7777
- REDIS_ADDR=${DOCKER_ADDR}
- REDIS_PORT=6379
- DJANGO_SECRET_KEY=changeme-for-production2
- SQSLOOP_SUFFIX=queue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment