From ef2983469b9a54203dbf70e773b77711b8d5e781 Mon Sep 17 00:00:00 2001 From: Phoeniix Zhao Date: Thu, 29 Feb 2024 09:16:45 +0800 Subject: [PATCH] chore: mount LOG_PATH as xline container log dir Signed-off-by: Phoeniix Zhao --- scripts/quick_start.sh | 11 ++++++++--- scripts/validation_test.sh | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/scripts/quick_start.sh b/scripts/quick_start.sh index 4a4361ac7..1185bdbf2 100755 --- a/scripts/quick_start.sh +++ b/scripts/quick_start.sh @@ -39,8 +39,8 @@ run_xline() { --client-advertise-urls=http://${SERVERS[$1]}:2379 \ --peer-advertise-urls=http://${SERVERS[$1]}:2380,http://${SERVERS[$1]}:2381" - if [ -n "$LOG_PATH" ]; then - cmd="${cmd} --log-file ${LOG_PATH}/node${1} --log-level debug" + if [ -n "$LOG_LEVEL" ]; then + cmd="${cmd} --log-level ${LOG_LEVEL}" fi if [ ${1} -eq 1 ]; then @@ -69,9 +69,14 @@ run_container() { size=${1} image="ghcr.io/xline-kv/xline:latest" for ((i = 1; i <= ${size}; i++)); do + mount_point="-v ${DIR}:/mnt" + if [ -n "$LOG_PATH" ]; then + mkdir -p ${LOG_PATH}/node${i} + mount_point="${mount_point} -v ${LOG_PATH}/node${i}:/var/log/xline" + fi docker run -d -it --rm --name=node${i} --net=xline_net \ --ip=${SERVERS[$i]} --cap-add=NET_ADMIN --cpu-shares=1024 \ - -m=512M -v ${DIR}:/mnt ${image} bash & + -m=512M ${mount_point} ${image} bash & done docker run -d -it --rm --name=client \ --net=xline_net --ip=${SERVERS[0]} --cap-add=NET_ADMIN \ diff --git a/scripts/validation_test.sh b/scripts/validation_test.sh index 0ef27a43a..a40357b89 100755 --- a/scripts/validation_test.sh +++ b/scripts/validation_test.sh @@ -2,10 +2,10 @@ DIR="$(dirname $0)" QUICK_START="${DIR}/quick_start.sh" ETCDCTL="docker exec -i client etcdctl --endpoints=http://172.20.0.3:2379,http://172.20.0.4:2379" -LOCK_CLIENT="docker exec -i client /mnt/validation_lock_client --endpoints=http://172.20.0.3:2379" +LOCK_CLIENT="docker exec -i client /mnt/validation_lock_client --endpoints=http://172.20.0.3:2379,http://172.20.0.4:2379,http://172.20.0.5:2379" -LOG_PATH=/mnt/logs bash ${QUICK_START} +LOG_PATH=${DIR}/logs LOG_LEVEL=debug bash ${QUICK_START} source $DIR/log.sh stop() {