Skip to content

Commit

Permalink
revert kafka.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
gongxuanzhang committed Jan 3, 2025
1 parent b88ac9e commit 5432770
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions docker/start_kafka.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.


get_ipv4_address() {
if command -v ip &>/dev/null; then
ip -o -4 address show | awk '!/127.0.0.1/ {gsub(/\/.*/, "", $4); print $4; exit}'
elif command -v ifconfig &>/dev/null; then
ifconfig | awk '/inet / && $2 != "127.0.0.1" { print $2; exit }'
elif command -v networksetup &>/dev/null; then
networksetup -getinfo Wi-Fi | awk '/IP address:/ { print $3; exit }'
else
echo "Error: No supported command found to fetch IP address." >&2
return 1
fi
}

# ===============================[global variables]===============================
declare -r ADDRESS=$(get_ipv4_address)
declare -r ADDRESS=$(ip -o -4 address show | awk ' NR==2 { gsub(/\/.*/, "", $4); print $4 } ')
declare -r KAFKA_VERSION=${KAFKA_VERSION:-2.1.1}
declare -r DOCKERFILE=/tmp/astraea/kafka.dockerfile
declare -r JMX0_OPTS="-Dcom.sun.management.jmxremote \
Expand All @@ -52,7 +38,7 @@ declare -r JMX2_OPTS="-Dcom.sun.management.jmxremote \
-Djava.rmi.server.hostname=$ADDRESS"
declare -r HEAP_OPTS="${HEAP_OPTS:-"-Xmx2G -Xms2G"}"
declare -r BROKER_PROPERTIES="/tmp/kafka-${BROKER_PORT}.properties"
declare -r IMAGE_NAME="ghcr.io/opensource4you/astraea/kafka:$(echo "$KAFKA_VERSION" | tr '[:upper:]' '[:lower:]')"
declare -r IMAGE_NAME="ghcr.io/opensource4you/astraea/kafka:${KAFKA_VERSION,,}"

function generateDockerfileByVersion() {
echo "# this dockerfile is generated dynamically
Expand Down

0 comments on commit 5432770

Please sign in to comment.