Skip to content

Instantly share code, notes, and snippets.

@graymic
Created March 19, 2017 22:09
Show Gist options
  • Save graymic/cf5f43921e9dd1df49539cf533161978 to your computer and use it in GitHub Desktop.
Save graymic/cf5f43921e9dd1df49539cf533161978 to your computer and use it in GitHub Desktop.
Python & Kafka through Docker
version: '2'
services:
## Apache zookeeper
zookeeper:
image: wurstmeister/zookeeper
ports:
- "2181:2181"
## Apache Kafka for real-time data streams
kafka:
image: wurstmeister/kafka:latest
ports:
- "9092:9092"
environment:
KAFKA_ADVERTISED_HOST_NAME: "192.168.99.100"
KAFKA_CREATE_TOPICS: "test:1:1"
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
volumes:
- /var/run/docker.sock:/var/run/docker.sock
## This is where our codebase resides, locally mounted and then volume mounted into the flask directive.
volumes_source:
image: tianon/true:latest
volumes:
- ./app:/app
## To reflect the changes you make within /app/main.py ensure that you leave the
## command: python /app/main.py directive. In production, we can drop this and supervisord will run
## the python app separately.
flask:
build: tiangolo/uwsgi-nginx-flask:flask-python3.5
command: python /app/main.py
restart: always
links:
- kafka
ports:
- "80:80"
volumes_from:
- volumes_source
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment