Skip to content

Commit

Permalink
chore: mount LOG_PATH as xline container log dir
Browse files Browse the repository at this point in the history
Signed-off-by: Phoeniix Zhao <[email protected]>
  • Loading branch information
Phoenix500526 committed Mar 14, 2024
1 parent 72f3cf9 commit ef29834
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions scripts/quick_start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \
Expand Down
4 changes: 2 additions & 2 deletions scripts/validation_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit ef29834

Please sign in to comment.