Skip to content

Instantly share code, notes, and snippets.

@mihkels
Created March 29, 2017 12:09
Show Gist options
  • Save mihkels/b7ecca974ace32e45e4eae75f5642c22 to your computer and use it in GitHub Desktop.
Save mihkels/b7ecca974ace32e45e4eae75f5642c22 to your computer and use it in GitHub Desktop.
Run Zookeeper and Kafka with docker-compose. Also support to send app logs to Kafka using elastic Filebeat
version: "3"
services:
sample_app:
# PHP 7 with ZeroMQ installed
build: .
depends_on:
- filebeat
working_dir: /app
command: php index.php
volumes:
- ".:/app"
version: "3"
services:
zookeeper:
image: confluentinc/cp-zookeeper
hostname: zookeeper
ports:
- "2181:2181"
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
broker:
image: confluentinc/cp-kafka
hostname: broker
depends_on:
- zookeeper
ports:
- '9092:9092'
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://broker:9092'
filebeat:
image: prima/filebeat
depends_on:
- broker
volumes:
- "./filebeat.yml:/filebeat.yml"
- "./log:/var/log"
filebeat.prospectors:
- input_type: log
paths:
- /var/log/*.log
output.kafka:
hosts: ["broker:9092"]
topic: '%{[type]}'
required_acks: 1
compression: gzip
max_message_bytes: 1000000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment