Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .devcontainer/devcontainer.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
KAFKA_BROKERS=kafka1:9092,kafka2:9093,kafka3:9094
ZOOKEEPER=zookeeper:2181
16 changes: 16 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "Kafka Proxy DevContainer",
"dockerComposeFile": [
"docker-compose.yml"
],
"service": "dev",
"workspaceFolder": "/workspace",
"extensions": [
"golang.Go",
"ms-azuretools.vscode-docker"
],
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
},
"postCreateCommand": "go mod tidy"
}
73 changes: 73 additions & 0 deletions .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
version: '3.8'
services:
zookeeper:
image: confluentinc/cp-zookeeper:7.5.0
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ports:
- "2181:2181"
kafka1:
image: confluentinc/cp-kafka:7.5.0
depends_on:
- zookeeper
ports:
- "9092:9092"
environment:
KAFKA_BROKER_ID: 1
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka1:9092,PLAINTEXT_HOST://localhost:19092
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 2
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 3
extra_hosts:
- "host.docker.internal:host-gateway"
kafka2:
image: confluentinc/cp-kafka:7.5.0
depends_on:
- zookeeper
ports:
- "9093:9093"
environment:
KAFKA_BROKER_ID: 2
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka2:9093,PLAINTEXT_HOST://localhost:19093
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 2
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 3
extra_hosts:
- "host.docker.internal:host-gateway"
kafka3:
image: confluentinc/cp-kafka:7.5.0
depends_on:
- zookeeper
ports:
- "9094:9094"
environment:
KAFKA_BROKER_ID: 3
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka3:9094,PLAINTEXT_HOST://localhost:19094
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 3
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 2
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 3
extra_hosts:
- "host.docker.internal:host-gateway"
dev:
image: mcr.microsoft.com/devcontainers/go:1.22
volumes:
- ..:/workspace:cached
command: sleep infinity
depends_on:
- kafka1
- kafka2
- kafka3
environment:
- KAFKA_BROKERS=kafka1:9092,kafka2:9093,kafka3:9094
working_dir: /workspace
network_mode: service:zookeeper
28 changes: 28 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Debug Kafka Proxy Server",
"type": "go",
"request": "launch",
"mode": "auto",
"preLaunchTask": "Start Kafka DevContainer",
"postDebugTask": "Stop Kafka DevContainer",
"program": "${workspaceFolder}",
"env": {
"KAFKA_BROKERS": "kafka1:9092,kafka2:9093,kafka3:9094",
"ZOOKEEPER": "zookeeper:2181"
},
"args": [
"server",
"--bootstrap-server-mapping", "kafka1:9092,0.0.0.0:30001",
"--bootstrap-server-mapping", "kafka2:9093,0.0.0.0:30002",
"--bootstrap-server-mapping", "kafka3:9094,0.0.0.0:30003",
"--debug-enable"
]
}
]
}
27 changes: 27 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Start Kafka DevContainer",
"type": "shell",
"command": "docker compose -f ${workspaceFolder}/.devcontainer/docker-compose.yml up -d",
"presentation": {
"reveal": "always",
"panel": "new"
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "Stop Kafka DevContainer",
"type": "shell",
"command": "docker compose -f ${workspaceFolder}/.devcontainer/docker-compose.yml down",
"presentation": {
"reveal": "always",
"panel": "new"
}
}
]
}
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ GOPKGS = $(shell go list ./... | grep -v /vendor/)
BUILD_FLAGS ?=
LDFLAGS ?= -X github.com/grepplabs/kafka-proxy/config.Version=$(VERSION) -w -s
TAG ?= "v0.4.3"
REPO ?= "grepplabs/kafka-proxy"

PROTOC_GO_VERSION ?= v1.33
PROTOC_GRPC_VERSION ?= v1.2
Expand Down Expand Up @@ -55,6 +56,14 @@ docker.build:
docker.build.all:
docker build --build-arg VERSION=$(VERSION) -t local/kafka-proxy -f Dockerfile.all .

docker.build.multiarch:
docker buildx build \
--platform linux/amd64,linux/arm64 \
--push \
--build-arg VERSION=$(VERSION) \
-t $(REPO):$(TAG) \
.

tag:
git tag $(TAG)

Expand Down