Skip to content

Commit

Permalink
fix: some bugs in start and build_image
Browse files Browse the repository at this point in the history
  • Loading branch information
aronchanisme committed Aug 13, 2024
1 parent de77664 commit 200aa90
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
6 changes: 4 additions & 2 deletions bin/build_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,15 @@ function build_image()
if [[ "${MO_CONTAINER_DEPIMAGE_REPLACE_REPO}" == "yes" ]]; then
add_log "D" "Repace repo for some images"

add_log "D" "s#FROM golang:1.22.3-bookworm as builder#FROM ccr.ccs.tencentyun.com/mo-infra/golang:1.22.3-bookworm as builder#g' optools/images/Dockerfile"
add_log "D" "sed -i 's#FROM golang:1.22.3-bookworm as builder#FROM ccr.ccs.tencentyun.com/mo-infra/golang:1.22.3-bookworm as builder#g' optools/images/Dockerfile"
sed -i 's#FROM golang:1.22.3-bookworm as builder#FROM ccr.ccs.tencentyun.com/mo-infra/golang:1.22.3-bookworm as builder#g' optools/images/Dockerfile

add_log "D" "s#FROM ubuntu:22.04#FROM ccr.ccs.tencentyun.com/mo-infra/ubuntu:22.04#g' optools/images/Dockerfile"
add_log "D" "sed -i 's#FROM ubuntu:22.04#FROM ccr.ccs.tencentyun.com/mo-infra/ubuntu:22.04#g' optools/images/Dockerfile"
sed -i 's#FROM ubuntu:22.04#FROM ccr.ccs.tencentyun.com/mo-infra/ubuntu:22.04#g' optools/images/Dockerfile
fi


add_log "D" "Cmd: docker build -f optools/images/Dockerfile -t ${image_name}:${branch}_${commitid_less} . --build-arg GOPROXY=\"${GOPROXY}\""
if docker build -f optools/images/Dockerfile -t ${image_name}:${branch}_${commitid_less} . --build-arg GOPROXY="${GOPROXY}" ; then
:
else
Expand Down
35 changes: 29 additions & 6 deletions bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,23 @@ function start()
cmd_params="${cmd_params} --privileged=true"
fi

debug_option=""
if [[ "${MO_CONTAINER_DEBUG_PORT}" != "" ]]; then
debug_option="-debug-http :${MO_CONTAINER_DEBUG_PORT}"
fi

pprof_option=""
if [[ "${PPROF_INTERVAL}" != "" ]]; then
pprof_option="-profile-interval ${PPROF_INTERVAL}s"
fi

# if conf path exists
if [[ -d ${MO_CONTAINER_CONF_HOST_PATH} ]]; then
docker_init_cmd="docker run ${cmd_params} -v ${MO_CONTAINER_CONF_HOST_PATH}:/etc:rw --entrypoint /mo-service ${MO_CONTAINER_IMAGE} -debug-http :${MO_CONTAINER_DEBUG_PORT} -launch ${MO_CONTAINER_CONF_CON_FILE}"
docker_init_cmd="docker run ${cmd_params} -v ${MO_CONTAINER_CONF_HOST_PATH}:/etc:rw --entrypoint /mo-service ${MO_CONTAINER_IMAGE} ${debug_option} ${pprof_option} -launch ${MO_CONTAINER_CONF_CON_FILE}"
else
docker_init_cmd="docker run ${cmd_params} ${MO_CONTAINER_IMAGE}"
#docker_init_cmd="docker run ${cmd_params} ${MO_CONTAINER_IMAGE}"
docker_init_cmd="docker run ${cmd_params} --entrypoint /mo-service ${MO_CONTAINER_IMAGE} ${debug_option} ${pprof_option} -launch ${MO_CONTAINER_CONF_CON_FILE}"

fi


Expand Down Expand Up @@ -140,14 +152,25 @@ function start()
exit 1
fi

debug_option=""
if [[ "${MO_CONTAINER_DEBUG_PORT}" != "" ]]; then
debug_option="-debug-http :${MO_CONTAINER_DEBUG_PORT}"
fi

pprof_option=""
if [[ "${PPROF_INTERVAL}" != "" ]]; then
pprof_option="-profile-interval ${PPROF_INTERVAL}s"
fi


if [[ "${go_mem_limit}" == "" ]]; then
add_log "W" "GO memory limit seems to be empty, thus will not set this limit"
add_log "I" "Starting mo-service: cd ${mo_actual_path}/ && ${mo_actual_path}/mo-service -daemon -debug-http :${MO_DEBUG_PORT} -launch ${MO_CONF_FILE} >${MO_LOG_PATH}/stdout-${RUN_TAG}.log 2>${MO_LOG_PATH}/stderr-${RUN_TAG}.log"
cd ${mo_actual_path}/ && ${mo_actual_path}/mo-service -daemon -debug-http :${MO_DEBUG_PORT} -launch ${MO_CONF_FILE} >${MO_LOG_PATH}/stdout-${RUN_TAG}.log 2>${MO_LOG_PATH}/stderr-${RUN_TAG}.log
add_log "I" "Starting mo-service: cd ${mo_actual_path}/ && ${mo_actual_path}/mo-service -daemon ${debug_option} ${pprof_option} -launch ${MO_CONF_FILE} >${MO_LOG_PATH}/stdout-${RUN_TAG}.log 2>${MO_LOG_PATH}/stderr-${RUN_TAG}.log"
cd ${mo_actual_path}/ && ${mo_actual_path}/mo-service -daemon ${debug_option} ${pprof_option} -launch ${MO_CONF_FILE} >${MO_LOG_PATH}/stdout-${RUN_TAG}.log 2>${MO_LOG_PATH}/stderr-${RUN_TAG}.log
else
add_log "D" "Start command will add GOMEMLIMIT=${go_mem_limit}MiB"
add_log "I" "Starting mo-service: cd ${mo_actual_path}/ && GOMEMLIMIT=${go_mem_limit}MiB ${mo_actual_path}/mo-service -daemon -debug-http :${MO_DEBUG_PORT} -launch ${MO_CONF_FILE} >${MO_LOG_PATH}/stdout-${RUN_TAG}.log 2>${MO_LOG_PATH}/stderr-${RUN_TAG}.log"
cd ${mo_actual_path}/ && GOMEMLIMIT=${go_mem_limit}MiB ${mo_actual_path}/mo-service -daemon -debug-http :${MO_DEBUG_PORT} -launch ${MO_CONF_FILE} >${MO_LOG_PATH}/stdout-${RUN_TAG}.log 2>${MO_LOG_PATH}/stderr-${RUN_TAG}.log
add_log "I" "Starting mo-service: cd ${mo_actual_path}/ && GOMEMLIMIT=${go_mem_limit}MiB ${mo_actual_path}/mo-service -daemon ${debug_option} ${pprof_option} -launch ${MO_CONF_FILE} >${MO_LOG_PATH}/stdout-${RUN_TAG}.log 2>${MO_LOG_PATH}/stderr-${RUN_TAG}.log"
cd ${mo_actual_path}/ && GOMEMLIMIT=${go_mem_limit}MiB ${mo_actual_path}/mo-service -daemon ${debug_option} ${pprof_option} -launch ${MO_CONF_FILE} >${MO_LOG_PATH}/stdout-${RUN_TAG}.log 2>${MO_LOG_PATH}/stderr-${RUN_TAG}.log
fi

add_log "I" "Wait for ${START_INTERVAL} seconds"
Expand Down
5 changes: 4 additions & 1 deletion conf/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ MO_DEBUG_PORT="9876"
MO_CONF_FILE="${MO_PATH}/matrixone/etc/launch/launch.toml"
# GO memory limit ratio, x%. By default, 90% is recommended
GO_MEM_LIMIT_RATIO=90
# time interval (in seconds) of auto profile collecting. Empty by default, meaning will not turn on auto profile collecting
PPROF_INTERVAL=""


# for restart
# interval between stop and start, unit: seconds
Expand Down Expand Up @@ -223,7 +226,7 @@ BACKUP_S3_IS_MINIO="no"
# 2. logical backups
# mo-dump
BACKUP_MODUMP_PATH="/data/tools/mo_dump/mo-dump"
# backup databases, seperated by ',' for each database. Note: 'all' and 'all_no_system' are special settings
# backup databases, seperated by ',' for each database. Note: 'all' and 'all_no_sysdb' are special settings
# all: all databases, including all system and user databases
# all_no_sysdb: (default) all databases, including all user databases, but no system databases
# other settings by user, e.g. db1,db2,db3
Expand Down

0 comments on commit 200aa90

Please sign in to comment.