Im implementing a go app for producing events to kafka.
I need to test them using local kafka test serrver.
So, I wrote a bash script to install and start zookeeper and kafka inside a go docker build which will be used only for a testing stage.
apt-get install software-properties-common -y; apt-add-repository 'deb http://security.debian.org/debian-security stretch/updates main'; apt-get update; apt-get install openjdk-8-jdk -y; apt-get install zookeeperd -y; apt-get install ca-certificates; service zookeeper start sleep 1m wget --no-check-certificate https://apache.claz.org/kafka/2.6.0/kafka_2.13-2.6.0.tgz tar xvzf kafka_2.13-2.6.0.tgz sleep 1m kafka_2.13-2.6.0/bin/kafka-server-start.sh kafka_2.13-2.6.0/config/server.properties kafka_2.13-2.6.0/bin/kafka-topics.sh --create --zookeeper zookeeper:2181 --replication-factor 1 --partitions 1 --topic test
service zookeeper start is not able to start zookeeper
Is there a better way to start zookeeper?
We have embedded kafka test servers in Java. I tried finding something similar to them for GO but unfortunately i could not find any. So I followed this approach.
Do we have any alternatives ?
Source: Docker Questions