Kafka - a working docker-compose

 

 

 Here's a working docker-compose that runs zookeeper, kafka and kafka-ui in same network.

 

 

version: '3'
services:
zookeeper1:
image: zookeeper:3.4.9
hostname: zookeeper1
ports:
- "2181:2181"
environment:
ZOO_MY_ID: 1
ZOO_PORT: 2181
ZOO_SERVERS: server.1=zookeeper1:2888:3888
volumes:
- ./data/zookeeper1/data:/data
- ./data/zookeeper1/datalog:/datalog
networks:
- appnetwork
kafka1:
image: confluentinc/cp-kafka:5.4.3
hostname: kafka1
ports:
- "9093:9093"
environment:
KAFKA_LISTENERS: OUTSIDE://0.0.0.0:9093,INTERNAL://0.0.0.0:9092
KAFKA_ADVERTISED_LISTENERS: 'OUTSIDE://localhost:9093,INTERNAL://kafka1:9092'
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: INTERNAL:PLAINTEXT,OUTSIDE:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: INTERNAL
KAFKA_ZOOKEEPER_CONNECT: "zookeeper1:2181"
KAFKA_BROKER_ID: 1
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
KAFKA_OFFSETS_TOPIC_NUM_PARTITIONS: 1
KAFKA_LOG_FLUSH_INTERVAL_MESSAGES: 100000000000
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
volumes:
- ./data/kafka1/data:/var/lib/kafka/data
depends_on:
- zookeeper1
networks:
- appnetwork

kafka-ui:
image: provectuslabs/kafka-ui:latest
ports:
- "8089:8080"
environment:
KAFKA_CLUSTERS_0_NAME: kafka1
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka1:9092 # internal access
KAFKA_CLUSTERS_0_ZOOKEEPER: zookeeper1:2181
networks:
- appnetwork
volumes:
esdata1:
driver: local
networks:
appnetwork:
driver: bridge

 

git reset/revert to previous commit

Sometimes we "accidentally" merge something that's not ready for release/qa  and need to rollback/reset/revert the commits to a cleaner state.

Here's how you can safely reset your git to previous commit:

1) find the older commit id to where you want to reset.

2) do git status to confirm there are no uncommitted changes on the current branch  

3) reset to a commit,

git reset --hard COMMIT_ID
git reset HEAD@{1}
git add .
git commit -m "reverting to commit COMMIT_ID"

4) cherry pick or patch any other commit that you like to add