From 7bf19db2c89fdda3bfa3377749c9b1db5a4d5705 Mon Sep 17 00:00:00 2001 From: "Xu Han@AutoMQ" Date: Thu, 5 Dec 2024 18:48:41 +0800 Subject: [PATCH] fix(docker): fix docker compose quick start (#2212) Signed-off-by: Robin Han --- docker/docker-compose.yaml | 20 ++++++++++---------- docker/scripts/start.sh | 6 +++++- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/docker/docker-compose.yaml b/docker/docker-compose.yaml index 2a76be1988..4066f4ea5a 100644 --- a/docker/docker-compose.yaml +++ b/docker/docker-compose.yaml @@ -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 @@ -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 @@ -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 @@ -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: @@ -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 @@ -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: @@ -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 @@ -135,8 +135,8 @@ volumes: driver: local networks: - afk_net: - name: afk_net + automq_net: + name: automq_net driver: bridge ipam: driver: default diff --git a/docker/scripts/start.sh b/docker/scripts/start.sh index 1f33da4d42..f6ce57665d 100644 --- a/docker/scripts/start.sh +++ b/docker/scripts/start.sh @@ -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 @@ -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"