Skip to content

Commit

Permalink
fix: deploy and start mo-service in binary deploy mode
Browse files Browse the repository at this point in the history
  • Loading branch information
aronchanisme committed Mar 6, 2024
1 parent 42fc7d1 commit cc00f3e
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 37 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ mo_ctl deploy help
Usage : mo_ctl deploy [mo_version] [force] # deploy mo onto the path configured
[mo_version]: optional, specify an mo version to deploy
[force] : optional, if specified will delete all content under MO_PATH and deploy from beginning
Note : 'deploy' is valid only when MO_DEPLOY_MODE is set to 'git' or 'docker'
e.g. : mo_ctl deploy # default, same as mo_ctl deploy 0.8.0
: mo_ctl deploy main # deploy development latest version
: mo_ctl deploy d29764a # deploy development version d29764a
Expand Down Expand Up @@ -272,6 +273,9 @@ Use `mo_ctl start` to startup mo-service, which is built under conf `MO_PATH`.
```bash
mo_ctl start help
Note : when MO_DEPLOY_MODE is set to 'git', mo_ctl finds mo-service under path MO_PATH/matrixone/ (currently set as /data/mo/matrixone/)
: when MO_DEPLOY_MODE is set to 'binary', mo_ctl finds mo-service under path MO_PATH/ (currently set as /data/mo/)
: when MO_DEPLOY_MODE is set to 'docker', mo_ctl creates a container from image MO_CONTAINER_IMAGE (currently set as matrixorigin/matrixone:1.1.1)
Usage : mo_ctl start # start mo-service from the path configured
```
Expand Down
69 changes: 40 additions & 29 deletions bin/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -208,40 +208,51 @@ function deploy()
force="force"
fi

if [[ "${MO_DEPLOY_MODE}" == "docker" ]]; then
deploy_docker ${mo_version}
else
# 0. Precheck
if ! precheck; then
add_log "I" "Precheck failed, exiting"
return 1
else
add_log "I" "Precheck passed, deploying mo now"
fi

# 1. Install
if ! git_clone ${mo_version} ${force}; then
return 1
fi
case "${MO_DEPLOY_MODE}" in
"docker")
deploy_docker ${mo_version}
;;
"binary")
add_log "I" "MO_DEPLOY_MODE is set to 'binary', thus skipping deployment. Please download and decompress mo binary file into a folder and set conf MO_PATH"
;;

"git")
# 0. Precheck
if ! precheck; then
add_log "I" "Precheck failed, exiting"
return 1
else
add_log "I" "Precheck passed, deploying mo now"
fi

# 2. Build
if [[ "${force}" == "nobuild" ]]; then
add_log "W" "Flag \"nobuild\" is set, will skip building mo-service"
:
else
if ! build_all ${force}; then
# 1. Install
if ! git_clone ${mo_version} ${force}; then
return 1
fi
fi

# 3. Create logs folder
add_log "I" "Creating mo logs ${MO_LOG_PATH} path in case it does not exist"
mkdir -p ${MO_LOG_PATH}
add_log "I" "Deoloy succeeded"
# 2. Build
if [[ "${force}" == "nobuild" ]]; then
add_log "W" "Flag \"nobuild\" is set, will skip building mo-service"
:
else
if ! build_all ${force}; then
return 1
fi
fi

# 4. Copy conf file
replace_mo_confs
# 3. Create logs folder
add_log "I" "Creating mo logs ${MO_LOG_PATH} path in case it does not exist"
mkdir -p ${MO_LOG_PATH}
add_log "I" "Deoloy succeeded"

fi
# 4. Copy conf file
replace_mo_confs

;;
*)
add_log "E" "Invalid MO_DEPLOY_MODE, choose from: git | binary | docker"
exit 1
;;
esac

}
5 changes: 5 additions & 0 deletions bin/help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function help_deploy()
echo "Usage : ${TOOL_NAME} ${option} [mo_version] [force] # ${USAGE_DEPLOY}"
echo " [mo_version]: optional: specify an mo version to deploy"
echo " [force] : optional: if specified will delete all content under MO_PATH and deploy from beginning"
echo " Note : 'deploy' is valid only when MO_DEPLOY_MODE is set to 'git' or 'docker'"
echo " e.g. : ${TOOL_NAME} ${option} # default, same as ${TOOL_NAME} ${option} ${MO_DEFAULT_VERSION}"
echo " : ${TOOL_NAME} ${option} main # deploy development latest version"
echo " : ${TOOL_NAME} ${option} d29764a # deploy development version d29764a"
Expand All @@ -78,6 +79,10 @@ function help_start()
{
option="start"
echo "Usage : ${TOOL_NAME} ${option} # ${USAGE_START}"
echo " Note : when MO_DEPLOY_MODE is set to 'git', mo_ctl finds mo-service under path MO_PATH/matrixone/ (currently set as ${MO_PATH}/matrixone/)"
echo " : when MO_DEPLOY_MODE is set to 'binary', mo_ctl finds mo-service under path MO_PATH/ (currently set as ${MO_PATH}/)"
echo " : when MO_DEPLOY_MODE is set to 'docker', mo_ctl creates a container from image MO_CONTAINER_IMAGE (currently set as ${MO_CONTAINER_IMAGE})"

}

function help_stop()
Expand Down
17 changes: 13 additions & 4 deletions bin/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,23 @@ function start()
add_log "I" "GO memory limit(Mi): ${go_mem_limit}"
fi

if [[ "${MO_DEPLOY_MODE}" == "git" ]]; then
mo_actual_path="${MO_PATH}/matrixone"
elif [[ "${MO_DEPLOY_MODE}" == "binary" ]]; then
mo_actual_path="${MO_PATH}"
else
add_log "E" "Invalid MO_DEPLOY_MODE, choose from: git | binary | docker"
exit 1
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_PATH}/matrixone/ && ${MO_PATH}/matrixone/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_PATH}/matrixone/ && ${MO_PATH}/matrixone/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-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
else
add_log "D" "Start command will add GOMEMLIMIT=${go_mem_limit}MiB"
add_log "I" "Starting mo-service: cd ${MO_PATH}/matrixone/ && GOMEMLIMIT=${go_mem_limit}MiB ${MO_PATH}/matrixone/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_PATH}/matrixone/ && GOMEMLIMIT=${go_mem_limit}MiB ${MO_PATH}/matrixone/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-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
fi

add_log "I" "Wait for ${START_INTERVAL} seconds"
Expand Down
4 changes: 2 additions & 2 deletions conf/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ MO_PORT="6001"
MO_USER="root"
# password of the user to connect to mo, please use your own password
MO_PW="111"
# mo deploy mode: docker | host
MO_DEPLOY_MODE="host"
# mo deploy mode: docker | git | binary, default: git
MO_DEPLOY_MODE="git"


# for docker
Expand Down
4 changes: 2 additions & 2 deletions conf/env.sh.default
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ MO_PORT="6001"
MO_USER="root"
# password of the user to connect to mo, please use your own password
MO_PW="111"
# mo deploy mode: docker | host
MO_DEPLOY_MODE="host"
# mo deploy mode: docker | git | binary, default: git
MO_DEPLOY_MODE="git"


# for docker
Expand Down

0 comments on commit cc00f3e

Please sign in to comment.