Skip to content

Commit

Permalink
Added action to install Bitnami Kafka and Zookeeper
Browse files Browse the repository at this point in the history
  • Loading branch information
BBC committed Nov 9, 2020
1 parent dd95cba commit a59640c
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 1 deletion.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM docker:stable

COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
# kafka-actions
Action to install kafka

This [GitHub Action](https://github.com/features/actions) sets up Bitnami Kafka instance.

Inspired by https://github.com/getong/rabbitmq-action, @getong Thanks!

---------
## Usage

See [action.yml](action.yml)


---------
## License

The scripts and documentation in this project are released under the [MIT License](LICENSE)
23 changes: 23 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: 'Setup Bitnami Kafka'
description: 'Setup Bitnami Kafka'
author: 'bbccorp'
inputs:
kafka version:
description: 'Version of Bitnami Kafka to use'
required: false
default: 'latest'
zookeeper version:
description: 'Version of Bitnami Zookeeper to use'
required: false
default: 'latest'
kafka port:
description: 'The port of Kafka host'
required: false
default: 9092
zookeeper port:
description: 'The port of Zookeeper host'
required: false
default: 2181
runs:
using: 'docker'
image: 'Dockerfile'
9 changes: 9 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

docker_run="docker run"

run_zookeeper="$docker_run -d -p $INPUT_ZOOKEEPER_PORT:2181 -e ALLOW_ANONYMOUS_LOGIN=yes bitnami/zookeeper:$INPUT_ZOOKEEPER_VERSION"
sh -c "$run_zookeeper"

run_kafka="$docker_run -d -p $INPUT_KAFKA_PORT:9092 -e KAFKA_BROKER_ID=1 -e KAFKA_LISTENERS=PLAINTEXT://:9092 -e KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://127.0.0.1:9092 -e ALLOW_PLAINTEXT_LISTENER=yes -e KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181 bitnami/kafka:$INPUT_KAFKA_VERSION"
sh -c "$run_kafka"

0 comments on commit a59640c

Please sign in to comment.