Skip to content

Commit

Permalink
fix(docker): fix docker compose quick start (#2212)
Browse files Browse the repository at this point in the history
Signed-off-by: Robin Han <[email protected]>
  • Loading branch information
superhx authored Dec 5, 2024
1 parent 0bac03e commit 7bf19db
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
20 changes: 10 additions & 10 deletions docker/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ services:
- /var/run/docker.sock:/var/run/docker.sock
# use a static ip
networks:
afk_net:
automq_net:
ipv4_address: 10.6.0.2

# create needed buckets
Expand All @@ -47,13 +47,13 @@ services:
localstack:
condition: service_healthy
networks:
- afk_net
- automq_net

controller:
container_name: "${CONTROLLER_DOCKER_NAME-controller}"
hostname: "${CONTROLLER_DOCKER_NAME-controller}"
stop_grace_period: 2m
image: automqinc/automq:1.3.0-rc2
image: automqinc/automq:1.3.0
environment:
- KAFKA_S3_ACCESS_KEY=test
- KAFKA_S3_SECRET_KEY=test
Expand All @@ -64,7 +64,7 @@ services:
- |
/opt/automq/scripts/start.sh up --process.roles controller --node.id 0 --controller.quorum.voters 0@controller:9093 --s3.bucket ko3 --s3.endpoint http://10.6.0.2:4566 --s3.region us-east-1
networks:
- afk_net
- automq_net
depends_on:
- localstack
- aws-cli
Expand All @@ -73,7 +73,7 @@ services:
container_name: "${BROKER1_DOCKER_NAME-broker1}"
hostname: "${BROKER1_DOCKER_NAME-broker1}"
stop_grace_period: 2m
image: automqinc/automq:1.3.0-rc2
image: automqinc/automq:1.3.0
ports:
- "9094:9094"
environment:
Expand All @@ -93,7 +93,7 @@ services:
- |
/opt/automq/scripts/start.sh up --process.roles broker --node.id 1 --controller.quorum.voters 0@controller:9093 --s3.bucket ko3 --s3.endpoint http://10.6.0.2:4566 --s3.region us-east-1
networks:
- afk_net
- automq_net
depends_on:
- localstack
- aws-cli
Expand All @@ -103,7 +103,7 @@ services:
container_name: "${BROKER2_DOCKER_NAME-broker2}"
hostname: "${BROKER2_DOCKER_NAME-broker2}"
stop_grace_period: 2m
image: automqinc/automq:1.3.0-rc2
image: automqinc/automq:1.3.0
ports:
- "9095:9095"
environment:
Expand All @@ -123,7 +123,7 @@ services:
- |
/opt/automq/scripts/start.sh up --process.roles broker --node.id 2 --controller.quorum.voters 0@controller:9093 --s3.bucket ko3 --s3.endpoint http://10.6.0.2:4566 --s3.region us-east-1
networks:
- afk_net
- automq_net
depends_on:
- localstack
- aws-cli
Expand All @@ -135,8 +135,8 @@ volumes:
driver: local

networks:
afk_net:
name: afk_net
automq_net:
name: automq_net
driver: bridge
ipam:
driver: default
Expand Down
6 changes: 5 additions & 1 deletion docker/scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ kafka_monitor_ip() {
setup_value "advertised.listeners" "PLAINTEXT://${advertised_ip}:9092" "${kafka_dir}/config/kraft/${process_role}.properties"
elif [[ "${process_role}" == "controller" ]]; then
setup_value "listeners" "CONTROLLER://${local_private_ip}:9093" "${kafka_dir}/config/kraft/${process_role}.properties"
setup_value "advertised.listeners" "CONTROLLER://${local_private_ip}:9093" "${kafka_dir}/config/kraft/${process_role}.properties"
else
die "kafka_monitor_ip: unknown process role ${process_role}"
fi
Expand Down Expand Up @@ -262,9 +263,12 @@ kafka_up() {
[[ -n "${s3_endpoint}" ]] || die "s3_endpoint is empty"
[[ -n "${cluster_id}" ]] || cluster_id="rZdE0DjZSrqy96PXrMUZVw"

quorum_bootstrap_servers=$(echo "${quorum_voters}" | sed 's/[0-9]*@//g')

for role in "broker" "controller" "server"; do
setup_value "node.id" "${node_id}" "${kafka_dir}/config/kraft/${role}.properties"
setup_value "controller.quorum.voters" "${quorum_voters}" "${kafka_dir}/config/kraft/${role}.properties"
add_or_setup_value "controller.quorum.voters" "${quorum_voters}" "${kafka_dir}/config/kraft/${role}.properties"
setup_value "controller.quorum.bootstrap.servers" "${quorum_bootstrap_servers}" "${kafka_dir}/config/kraft/${role}.properties"
setup_value "s3.data.buckets" "0@s3://${s3_bucket}?region=${s3_region}&endpoint=${s3_endpoint}&authType=static" "${kafka_dir}/config/kraft/${role}.properties"
setup_value "s3.ops.buckets" "0@s3://${s3_bucket}?region=${s3_region}&endpoint=${s3_endpoint}&authType=static" "${kafka_dir}/config/kraft/${role}.properties"
setup_value "log.dirs" "${data_path}/kraft-${role}-logs" "${kafka_dir}/config/kraft/${role}.properties"
Expand Down

0 comments on commit 7bf19db

Please sign in to comment.