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
9 changes: 8 additions & 1 deletion docker/docker_build_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@
# limitations under the License.

get_ipv4_address() {
os="$(uname)"

if [[ "$os" == "Darwin" ]]; then
ifconfig | awk '/inet / && $2 != "127.0.0.1" { print $2; exit }'
return 0
fi

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
Expand Down Expand Up @@ -58,7 +65,7 @@ function generateControllerPort() {

# don't change the length as it is expected 16 bytes of a base64-encoded UUID
function randomString() {
echo $(cat /dev/random | env LC_CTYPE=C tr -dc 'a-zA-Z0-9' | fold -w 22 | head -n 1)
openssl rand -base64 16 | tr -dc 'a-zA-Z0-9' | head -c 22
}

function checkDocker() {
Expand Down
4 changes: 2 additions & 2 deletions docker/start_app.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ source $DOCKER_FOLDER/docker_build_common.sh
declare -r VERSION=${REVISION:-${VERSION:-main}}
declare -r ACCOUNT=${ACCOUNT:-opensource4you}
if [[ "$VERSION" == "main" ]]; then
declare -r IMAGE_NAME="ghcr.io/${ACCOUNT,,}/astraea/app:latest"
declare -r IMAGE_NAME="ghcr.io/${ACCOUNT:l}/astraea/app:latest"
else
declare -r IMAGE_NAME="ghcr.io/${ACCOUNT,,}/astraea/app:${VERSION,,}"
declare -r IMAGE_NAME="ghcr.io/${ACCOUNT:l}/astraea/app:${VERSION:l}"
fi
declare -r DOCKERFILE=$DOCKER_FOLDER/app.dockerfile
declare -r JMX_PORT=${JMX_PORT:-"$(getRandomPort)"}
Expand Down
2 changes: 1 addition & 1 deletion docker/start_broker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ declare -r JMX_OPTS="-Dcom.sun.management.jmxremote \
-Djava.rmi.server.hostname=$ADDRESS"
declare -r HEAP_OPTS="${HEAP_OPTS:-"-Xmx2G -Xms2G"}"
declare -r BROKER_PROPERTIES="/tmp/server-${BROKER_PORT}.properties"
declare -r IMAGE_NAME="ghcr.io/${ACCOUNT,,}/astraea/broker:${KAFKA_VERSION,,}"
declare -r IMAGE_NAME="ghcr.io/${ACCOUNT:l}/astraea/broker:${KAFKA_VERSION:l}"
declare -r METADATA_VERSION=${METADATA_VERSION:-""}
# cleanup the file if it is existent
[[ -f "$BROKER_PROPERTIES" ]] && rm -f "$BROKER_PROPERTIES"
Expand Down
4 changes: 2 additions & 2 deletions docker/start_controller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ declare -r JMX_OPTS="-Dcom.sun.management.jmxremote \
-Djava.rmi.server.hostname=$ADDRESS"
declare -r HEAP_OPTS="${HEAP_OPTS:-"-Xmx2G -Xms2G"}"
declare -r CONTROLLER_PROPERTIES="/tmp/controller-${CONTROLLER_PORT}.properties"
declare -r IMAGE_NAME="ghcr.io/${ACCOUNT,,}/astraea/controller:$KAFKA_VERSION"
declare -r IMAGE_NAME="ghcr.io/${ACCOUNT:l}/astraea/controller:$KAFKA_VERSION"
declare -r METADATA_VERSION=${METADATA_VERSION:-""}
# cleanup the file if it is existent
[[ -f "$CONTROLLER_PROPERTIES" ]] && rm -f "$CONTROLLER_PROPERTIES"
Expand Down Expand Up @@ -268,4 +268,4 @@ if [ "$(echo $?)" -eq 0 ]; then
echo "================================================="
else
echo "Start up fail"
fi
fi
2 changes: 1 addition & 1 deletion docker/start_worker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ declare -r JMX_OPTS="-Dcom.sun.management.jmxremote \
declare -r HEAP_OPTS="${HEAP_OPTS:-"-Xmx2G -Xms2G"}"
declare -r WORKER_PROPERTIES="/tmp/worker-${WORKER_PORT}.properties"
declare -r WORKER_PLUGIN_PATH=${WORKER_PLUGIN_PATH:-/tmp/worker-plugins}
declare -r IMAGE_NAME="ghcr.io/${ACCOUNT,,}/astraea/worker:${KAFKA_VERSION,,}"
declare -r IMAGE_NAME="ghcr.io/${ACCOUNT:l}/astraea/worker:${KAFKA_VERSION:l}"
declare -r SCRIPT_LOCATION_IN_CONTAINER="./bin/connect-distributed.sh"
# cleanup the file if it is existent
[[ -f "$WORKER_PROPERTIES" ]] && rm -f "$WORKER_PROPERTIES"
Expand Down