From 407363a15fd2232b85f8f2eac5c70c6c17bb1bfa Mon Sep 17 00:00:00 2001 From: aronchanisme Date: Wed, 25 Oct 2023 23:35:05 +0800 Subject: [PATCH] enhance: support extra options for docker mode --- bin/start.sh | 11 ++++++++++- conf/env.sh | 1 + conf/env.sh.default | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/bin/start.sh b/bin/start.sh index e4343bc..3879e98 100644 --- a/bin/start.sh +++ b/bin/start.sh @@ -33,10 +33,17 @@ function start() # host data path mkdir -p ${MO_CONTAINER_DATA_HOST_PATH} + + if [[ "${MO_CONTAINER_EXTRA_MOUNT_OPTION}" != "" ]]; then + cmd_params="-d -v ${MO_CONTAINER_EXTRA_MOUNT_OPTION} -v ${MO_CONTAINER_DATA_HOST_PATH}:/mo-data:rw -p ${MO_DEBUG_PORT}:${MO_CONTAINER_DEBUG_PORT} -p ${MO_PORT}:${MO_CONTAINER_PORT} --name ${MO_CONTAINER_NAME}" + else + cmd_params="-d -v ${MO_CONTAINER_DATA_HOST_PATH}:/mo-data:rw -p ${MO_DEBUG_PORT}:${MO_CONTAINER_DEBUG_PORT} -p ${MO_PORT}:${MO_CONTAINER_PORT} --name ${MO_CONTAINER_NAME}" + fi - cmd_params="-d -v ${MO_CONTAINER_DATA_HOST_PATH}:/mo-data:rw -p ${MO_DEBUG_PORT}:${MO_CONTAINER_DEBUG_PORT} -p ${MO_PORT}:${MO_CONTAINER_PORT} --name ${MO_CONTAINER_NAME}" docker_init_cmd="docker run" + + if [[ "${total_mem}" != "" ]]; then let docker_mem_limit=total_mem*${MO_CONTAINER_MEMORY_RATIO}/100 let go_mem_limit=docker_mem_limit*${GO_MEM_LIMIT_RATIO}/100 @@ -83,6 +90,8 @@ function start() docker_init_cmd="docker run ${cmd_params} ${MO_IMAGE_FULL}" fi + + #docker_init_cmd="${docker_init_cmd} --hostname ${MO_CONTAINER_HOSTNAME} -v ${MO_CONTAINER_DATA_HOST_PATH}:/mo-data:rw -v ${MO_CONTAINER_CONF_HOST_PATH}:/etc:rw --entrypoint /mo-service ${MO_IMAGE_FULL} -launch ${MO_CONTAINER_CONF_CON_FILE}" diff --git a/conf/env.sh b/conf/env.sh index 407622e..b13bd18 100644 --- a/conf/env.sh +++ b/conf/env.sh @@ -41,6 +41,7 @@ MO_CONTAINER_CONF_CON_FILE="/etc/quickstart/launch.toml" MO_CONTAINER_DATA_HOST_PATH="/data/mo/" MO_CONTAINER_HOSTNAME="705203be8a9e" MO_CONTAINER_MEMORY_RATIO=90 +MO_CONTAINER_EXTRA_MOUNT_OPTION="" ########################################### # no need to set below conf for most cases diff --git a/conf/env.sh.default b/conf/env.sh.default index 407622e..b13bd18 100644 --- a/conf/env.sh.default +++ b/conf/env.sh.default @@ -41,6 +41,7 @@ MO_CONTAINER_CONF_CON_FILE="/etc/quickstart/launch.toml" MO_CONTAINER_DATA_HOST_PATH="/data/mo/" MO_CONTAINER_HOSTNAME="705203be8a9e" MO_CONTAINER_MEMORY_RATIO=90 +MO_CONTAINER_EXTRA_MOUNT_OPTION="" ########################################### # no need to set below conf for most cases