mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-04-28 06:19:20 +08:00
docs: add openim cluster helm chart (#1291)
* docs: add openim cluster helm chart Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * docs: add openim scripts deployment system Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * docs: add all openim helm chart deployment Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * docs: add all openim helm chart deployment Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim install scripts docs Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim kubernetes deployment Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim kubernetes deployment Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim kubernetes deployment Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim kubernetes deployment Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * fix: openim images version Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * fix: make image Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim helm charts Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim helm charts Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> * feat: add openim config docs Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com> --------- Signed-off-by: Xinwei Xiong(cubxxw) <3293172751nss@gmail.com>
This commit is contained in:
@@ -33,8 +33,9 @@ openim::log::info "\n# Begin to check all openim service"
|
||||
# OpenIM status
|
||||
# Elegant printing function
|
||||
print_services_and_ports() {
|
||||
local -n service_names=$1
|
||||
local -n service_ports=$2
|
||||
# 获取数组
|
||||
declare -g service_names=("${!1}")
|
||||
declare -g service_ports=("${!2}")
|
||||
|
||||
echo "+-------------------------+----------+"
|
||||
echo "| Service Name | Port |"
|
||||
|
||||
@@ -69,7 +69,7 @@ def "ENV_FILE" ""${OPENIM_ROOT}"/scripts/install/environment.sh"
|
||||
def "CHAT_BRANCH" "main"
|
||||
def "SERVER_BRANCH" "main"
|
||||
|
||||
# Choose the appropriate image address, the default is GITHUB image,
|
||||
# Choose the appropriate image address, the default is GITHUB image,
|
||||
# you can choose docker hub, for Chinese users can choose Ali Cloud
|
||||
# export IMAGE_REGISTRY="ghcr.io/openimsdk"
|
||||
# export IMAGE_REGISTRY="openim"
|
||||
@@ -78,6 +78,9 @@ def "IMAGE_REGISTRY" "ghcr.io/openimsdk"
|
||||
# def "IMAGE_REGISTRY" "openim"
|
||||
# def "IMAGE_REGISTRY" "registry.cn-hangzhou.aliyuncs.com/openimsdk"
|
||||
|
||||
# Choose the appropriate image tag, the default is the latest version
|
||||
def "SERVER_IMAGE_TAG" "latest"
|
||||
|
||||
###################### OpenIM Docker Network ######################
|
||||
# 设置 Docker 网络的网段
|
||||
readonly DOCKER_BRIDGE_SUBNET=${DOCKER_BRIDGE_SUBNET:-'172.28.0.0/16'}
|
||||
@@ -115,10 +118,10 @@ LAST_OCTET=$((LAST_OCTET + 1))
|
||||
GRAFANA_NETWORK_ADDRESS=$(generate_ip)
|
||||
|
||||
###################### openim 配置 ######################
|
||||
# read: https://github.com/openimsdk/open-im-server/blob/main/deployment/init/README.md
|
||||
# read: https://github.com/openimsdk/open-im-server/blob/main/deployment/README.md
|
||||
def "OPENIM_DATA_DIR" "/data/openim"
|
||||
def "OPENIM_INSTALL_DIR" "/opt/openim"
|
||||
def "OPENIM_CONFIG_DIR" "/etc/openim"
|
||||
def "OPENIM_CONFIG_DIR" "/etc/openim/config"
|
||||
def "OPENIM_LOG_DIR" "/var/log/openim"
|
||||
def "CA_FILE" "${OPENIM_CONFIG_DIR}/cert/ca.pem"
|
||||
|
||||
@@ -138,14 +141,14 @@ def "OPENIM_CHAT_ADDRESS" "${DOCKER_BRIDGE_GATEWAY}" # OpenIM服务地址
|
||||
def "OPENIM_CHAT_API_PORT" "10008" # OpenIM API端口
|
||||
def "CHAT_API_LISTEN_IP" "" # OpenIM API的监听IP
|
||||
|
||||
def "OPENIM_ADMIN_API_PORT" "10009" # OpenIM Admin API端口
|
||||
def "ADMIN_API_LISTEN_IP" "" # OpenIM Admin API的监听IP
|
||||
def "OPENIM_ADMIN_API_PORT" "10009" # OpenIM Admin API端口
|
||||
def "ADMIN_API_LISTEN_IP" "" # OpenIM Admin API的监听IP
|
||||
|
||||
def "OPENIM_ADMIN_PORT" "30200" # OpenIM chat Admin端口
|
||||
def "OPENIM_CHAT_PORT" "30300" # OpenIM chat Admin的监听IP
|
||||
def "OPENIM_ADMIN_PORT" "30200" # OpenIM chat Admin端口
|
||||
def "OPENIM_CHAT_PORT" "30300" # OpenIM chat Admin的监听IP
|
||||
|
||||
def "OPENIM_ADMIN_NAME" "admin" # openim-chat Admin用户名
|
||||
def "OPENIM_CHAT_NAME" "chat" # openim-chat chat用户名
|
||||
def "OPENIM_ADMIN_NAME" "admin" # openim-chat Admin用户名
|
||||
def "OPENIM_CHAT_NAME" "chat" # openim-chat chat用户名
|
||||
|
||||
# TODO 注意: 一般的配置都可以使用 def 函数来定义,如果是包含特殊字符,比如说:
|
||||
# TODO readonly MSG_DESTRUCT_TIME=${MSG_DESTRUCT_TIME:-'0 2 * * *'}
|
||||
@@ -306,10 +309,10 @@ def "GETUI_INTENT" "" # GeTui推送意图
|
||||
def "GETUI_CHANNEL_ID" "" # GeTui渠道ID
|
||||
def "GETUI_CHANNEL_NAME" "" # GeTui渠道名称
|
||||
def "FCM_SERVICE_ACCOUNT" "x.json" # FCM服务账户
|
||||
def "JPNS_APP_KEY" "" # JPNS应用密钥
|
||||
def "JPNS_MASTER_SECRET" "" # JPNS主密钥
|
||||
def "JPNS_PUSH_URL" "" # JPNS推送URL
|
||||
def "JPNS_PUSH_INTENT" "" # JPNS推送意图
|
||||
def "JPNS_APP_KEY" "" # JPNS应用密钥
|
||||
def "JPNS_MASTER_SECRET" "" # JPNS主密钥
|
||||
def "JPNS_PUSH_URL" "" # JPNS推送URL
|
||||
def "JPNS_PUSH_INTENT" "" # JPNS推送意图
|
||||
def "MANAGER_USERID_1" "openIM123456" # 管理员ID 1
|
||||
def "MANAGER_USERID_2" "openIM654321" # 管理员ID 2
|
||||
def "MANAGER_USERID_3" "openIMAdmin" # 管理员ID 3
|
||||
|
||||
+36
-27
@@ -51,15 +51,9 @@
|
||||
OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")"/../.. && pwd -P)
|
||||
[[ -z ${COMMON_SOURCED} ]] && source "${OPENIM_ROOT}"/scripts/install/common.sh
|
||||
|
||||
source "${OPENIM_ROOT}"/scripts/install/openim-msggateway.sh
|
||||
source "${OPENIM_ROOT}"/scripts/install/openim-msgtransfer.sh
|
||||
source "${OPENIM_ROOT}"/scripts/install/openim-push.sh
|
||||
source "${OPENIM_ROOT}"/scripts/install/openim-rpc.sh
|
||||
source "${OPENIM_ROOT}"/scripts/install/openim-crontask.sh
|
||||
source "${OPENIM_ROOT}"/scripts/install/openim-api.sh
|
||||
source "${OPENIM_ROOT}"/scripts/install/openim-man.sh
|
||||
source "${OPENIM_ROOT}"/scripts/install/openim-tools.sh
|
||||
source "${OPENIM_ROOT}"/scripts/install/test.sh
|
||||
${OPENIM_ROOT}/scripts/install/openim-man.sh
|
||||
${OPENIM_ROOT}/scripts/install/openim-tools.sh
|
||||
${OPENIM_ROOT}/scripts/install/test.sh
|
||||
|
||||
# Detailed help function
|
||||
function openim::install::show_help() {
|
||||
@@ -79,16 +73,26 @@ function openim::install::show_help() {
|
||||
|
||||
function openim::install::install_openim()
|
||||
{
|
||||
openim::common::sudo "mkdir -p ${OPENIM_DATA_DIR} ${OPENIM_INSTALL_DIR} ${OPENIM_CONFIG_DIR} ${OPENIM_LOG_DIR}"
|
||||
openim::log::info "check openim dependency"
|
||||
openim::common::sudo "cp -r ${OPENIM_ROOT}/config/* ${OPENIM_CONFIG_DIR}/"
|
||||
|
||||
echo ${LINUX_PASSWORD} | sudo -S bash -c \
|
||||
"${OPENIM_ROOT}/scripts/genconfig.sh ${ENV_FILE} deployments/templates/openim.yaml > ${OPENIM_CONFIG_DIR}/config.yaml"
|
||||
|
||||
openim::util::check_ports ${OPENIM_DEPENDENCY_PORT_LISTARIES[@]}
|
||||
|
||||
openim::msggateway::install || return 1
|
||||
openim::msgtransfer::install || return 1
|
||||
openim::push::install || return 1
|
||||
openim::rpc::install || return 1
|
||||
openim::crontask::install || return 1
|
||||
openim::api::install || return 1
|
||||
${OPENIM_ROOT}/scripts/install/openim-msggateway.sh openim::msggateway::install || return 1
|
||||
${OPENIM_ROOT}/scripts/install/openim-msgtransfer.sh openim::msgtransfer::install || return 1
|
||||
${OPENIM_ROOT}/scripts/install/openim-push.sh openim::push::install || return 1
|
||||
${OPENIM_ROOT}/scripts/install/openim-crontask.sh openim::crontask::install || return 1
|
||||
${OPENIM_ROOT}/scripts/install/openim-rpc.sh openim::rpc::install || return 1
|
||||
${OPENIM_ROOT}/scripts/install/openim-api.sh openim::api::install || return 1
|
||||
|
||||
openim::common::sudo "cp -r ${OPENIM_ROOT}/deployments/templates/openim.target /etc/systemd/system/openim.target"
|
||||
openim::common::sudo "systemctl daemon-reload"
|
||||
openim::common::sudo "systemctl restart openim.target"
|
||||
openim::common::sudo "systemctl enable openim.target"
|
||||
openim::log::success "openim install success"
|
||||
}
|
||||
|
||||
@@ -96,13 +100,18 @@ function openim::uninstall::uninstall_openim()
|
||||
{
|
||||
openim::log::info "uninstall openim"
|
||||
|
||||
openim::msggateway::uninstall || return 1
|
||||
openim::msgtransfer::uninstall || return 1
|
||||
openim::push::uninstall || return 1
|
||||
openim::rpc::uninstall || return 1
|
||||
openim::crontask::uninstall || return 1
|
||||
openim::api::uninstall || return 1
|
||||
${OPENIM_ROOT}/scripts/install/openim-msggateway.sh openim::msggateway::uninstall || return 1
|
||||
${OPENIM_ROOT}/scripts/install/openim-msgtransfer.sh openim::msgtransfer::uninstall || return 1
|
||||
${OPENIM_ROOT}/scripts/install/openim-push.sh openim::push::uninstall || return 1
|
||||
${OPENIM_ROOT}/scripts/install/openim-crontask.sh openim::crontask::uninstall || return 1
|
||||
${OPENIM_ROOT}/scripts/install/openim-rpc.sh openim::rpc::uninstall || return 1
|
||||
${OPENIM_ROOT}/scripts/install/openim-api.sh openim::api::uninstall || return 1
|
||||
|
||||
set +o errexit
|
||||
openim::common::sudo "systemctl stop openim.target"
|
||||
openim::common::sudo "systemctl disable openim.target"
|
||||
openim::common::sudo "rm -f /etc/systemd/system/openim.target"
|
||||
set -o errexit
|
||||
openim::log::success "openim uninstall success"
|
||||
}
|
||||
|
||||
@@ -110,12 +119,12 @@ function openim::install::status()
|
||||
{
|
||||
openim::log::info "check openim status"
|
||||
|
||||
openim::msggateway::status || return 1
|
||||
openim::msgtransfer::status || return 1
|
||||
openim::push::status || return 1
|
||||
openim::rpc::status || return 1
|
||||
openim::crontask::status || return 1
|
||||
openim::api::status || return 1
|
||||
${OPENIM_ROOT}/scripts/install/openim-msggateway.sh openim::msggateway::status || return 1
|
||||
${OPENIM_ROOT}/scripts/install/openim-msgtransfer.sh openim::msgtransfer::status || return 1
|
||||
${OPENIM_ROOT}/scripts/install/openim-push.sh openim::push::status || return 1
|
||||
${OPENIM_ROOT}/scripts/install/openim-crontask.sh openim::crontask::status || return 1
|
||||
${OPENIM_ROOT}/scripts/install/openim-rpc.sh openim::rpc::status || return 1
|
||||
${OPENIM_ROOT}/scripts/install/openim-api.sh openim::api::status || return 1
|
||||
|
||||
openim::log::success "openim status success"
|
||||
}
|
||||
|
||||
@@ -92,21 +92,70 @@ function openim::api::start_service() {
|
||||
###################################### Linux Systemd ######################################
|
||||
SYSTEM_FILE_PATH="/etc/systemd/system/${SERVER_NAME}.service"
|
||||
|
||||
function openim::api::install() {
|
||||
openim::log::info "Installing ${SERVER_NAME} ..."
|
||||
# Print the necessary information after installation
|
||||
function openim::api::info() {
|
||||
cat << EOF
|
||||
openim-api listen on: ${OPENIM_API_HOST}:${API_OPENIM_PORT}
|
||||
EOF
|
||||
}
|
||||
|
||||
# install openim-api
|
||||
function openim::api::install() {
|
||||
openim::log::info "Installing ${SERVER_NAME} ..."
|
||||
|
||||
pushd "${OPENIM_ROOT}"
|
||||
|
||||
# 1. Build openim-api
|
||||
make build BINS=${SERVER_NAME}
|
||||
openim::common::sudo "cp -r ${OPENIM_OUTPUT_HOSTBIN}/${SERVER_NAME} ${OPENIM_INSTALL_DIR}/${SERVER_NAME}"
|
||||
openim::log::status "${SERVER_NAME} binary: ${OPENIM_INSTALL_DIR}/${SERVER_NAME}/${SERVER_NAME}"
|
||||
|
||||
# 2. Generate and install the openim-api configuration file (config)
|
||||
openim::log::status "${SERVER_NAME} config file: ${OPENIM_CONFIG_DIR}/config.yaml"
|
||||
|
||||
# 3. Create and install the ${SERVER_NAME} systemd unit file
|
||||
echo ${LINUX_PASSWORD} | sudo -S bash -c \
|
||||
"SERVER_NAME=${SERVER_NAME} ./scripts/genconfig.sh ${ENV_FILE} deployments/templates/openim.service > ${SYSTEM_FILE_PATH}"
|
||||
openim::log::status "${SERVER_NAME} systemd file: ${SYSTEM_FILE_PATH}"
|
||||
|
||||
# 4. Start the openim-api service
|
||||
openim::common::sudo "systemctl daemon-reload"
|
||||
openim::common::sudo "systemctl restart ${SERVER_NAME}"
|
||||
openim::common::sudo "systemctl enable ${SERVER_NAME}"
|
||||
openim::api::status || return 1
|
||||
openim::api::info
|
||||
|
||||
openim::log::info "install ${SERVER_NAME} successfully"
|
||||
popd
|
||||
}
|
||||
|
||||
# Unload
|
||||
function openim::api::uninstall() {
|
||||
openim::log::info "Uninstalling ${SERVER_NAME} ..."
|
||||
|
||||
set +o errexit
|
||||
openim::common::sudo "systemctl stop ${SERVER_NAME}"
|
||||
openim::common::sudo "systemctl disable ${SERVER_NAME}"
|
||||
openim::common::sudo "rm -f ${OPENIM_INSTALL_DIR}/${SERVER_NAME}"
|
||||
openim::common::sudo "rm -f ${OPENIM_CONFIG_DIR}/${SERVER_NAME}.yaml"
|
||||
openim::common::sudo "rm -f /etc/systemd/system/${SERVER_NAME}.service"
|
||||
set -o errexit
|
||||
openim::log::info "uninstall ${SERVER_NAME} successfully"
|
||||
}
|
||||
|
||||
# Status Check
|
||||
function openim::api::status() {
|
||||
openim::log::info "Checking ${SERVER_NAME} status ..."
|
||||
|
||||
# Check the running status of the ${SERVER_NAME}. If active (running) is displayed, the ${SERVER_NAME} is started successfully.
|
||||
systemctl status ${SERVER_NAME}|grep -q 'active' || {
|
||||
openim::log::error "${SERVER_NAME} failed to start, maybe not installed properly"
|
||||
return 1
|
||||
}
|
||||
|
||||
openim::util::check_ports ${OPENIM_API_PORT_LISTARIES[@]}
|
||||
}
|
||||
|
||||
if [[ "$*" =~ openim::api:: ]];then
|
||||
eval $*
|
||||
fi
|
||||
eval $*
|
||||
fi
|
||||
|
||||
@@ -51,7 +51,7 @@ function openim::crontask::start()
|
||||
openim::util::stop_services_with_name ${OPENIM_CRONTASK_BINARY}
|
||||
|
||||
openim::log::status "start cron_task process, path: ${OPENIM_CRONTASK_BINARY}"
|
||||
nohup ${OPENIM_CRONTASK_BINARY} >> ${LOG_FILE} 2>&1 &
|
||||
nohup ${OPENIM_CRONTASK_BINARY} -c ${OPENIM_PUSH_CONFIG} >> ${LOG_FILE} 2>&1 &
|
||||
openim::util::check_process_names ${SERVER_NAME}
|
||||
}
|
||||
|
||||
@@ -72,18 +72,16 @@ function openim::crontask::install()
|
||||
|
||||
# 1. Build openim-crontask
|
||||
make build BINS=${SERVER_NAME}
|
||||
openim::common::sudo "cp ${OPENIM_OUTPUT_HOSTBIN}/${SERVER_NAME} ${OPENIM_INSTALL_DIR}/bin"
|
||||
|
||||
openim::log::status "${SERVER_NAME} binary: ${OPENIM_INSTALL_DIR}/bin/${SERVER_NAME}"
|
||||
openim::common::sudo "cp -r ${OPENIM_OUTPUT_HOSTBIN}/${SERVER_NAME} ${OPENIM_INSTALL_DIR}/${SERVER_NAME}"
|
||||
openim::log::status "${SERVER_NAME} binary: ${OPENIM_INSTALL_DIR}/${SERVER_NAME}/${SERVER_NAME}"
|
||||
|
||||
# 2. Generate and install the openim-crontask configuration file (openim-crontask.yaml)
|
||||
echo ${LINUX_PASSWORD} | sudo -S bash -c \
|
||||
"./scripts/genconfig.sh ${ENV_FILE} deployments/templates/${SERVER_NAME}.yaml > ${OPENIM_CONFIG_DIR}/${SERVER_NAME}.yaml"
|
||||
openim::log::status "${SERVER_NAME} config file: ${OPENIM_CONFIG_DIR}/${SERVER_NAME}.yaml"
|
||||
openim::log::status "${SERVER_NAME} config file: ${OPENIM_CONFIG_DIR}/config.yaml"
|
||||
|
||||
# 3. Create and install the ${SERVER_NAME} systemd unit file
|
||||
echo ${LINUX_PASSWORD} | sudo -S bash -c \
|
||||
"./scripts/genconfig.sh ${ENV_FILE} deployments/templates/init/${SERVER_NAME}.service > ${SYSTEM_FILE_PATH}"
|
||||
"SERVER_NAME=${SERVER_NAME} ./scripts/genconfig.sh ${ENV_FILE} deployments/templates/openim.service > ${SYSTEM_FILE_PATH}"
|
||||
openim::log::status "${SERVER_NAME} systemd file: ${SYSTEM_FILE_PATH}"
|
||||
|
||||
# 4. Start the openim-crontask service
|
||||
@@ -104,7 +102,7 @@ function openim::crontask::uninstall()
|
||||
set +o errexit
|
||||
openim::common::sudo "systemctl stop ${SERVER_NAME}"
|
||||
openim::common::sudo "systemctl disable ${SERVER_NAME}"
|
||||
openim::common::sudo "rm -f ${OPENIM_INSTALL_DIR}/bin/${SERVER_NAME}"
|
||||
openim::common::sudo "rm -f ${OPENIM_INSTALL_DIR}/${SERVER_NAME}"
|
||||
openim::common::sudo "rm -f ${OPENIM_CONFIG_DIR}/${SERVER_NAME}.yaml"
|
||||
openim::common::sudo "rm -f /etc/systemd/system/${SERVER_NAME}.service"
|
||||
set -o errexit
|
||||
@@ -115,15 +113,11 @@ function openim::crontask::uninstall()
|
||||
function openim::crontask::status()
|
||||
{
|
||||
# Check the running status of the ${SERVER_NAME}. If active (running) is displayed, the ${SERVER_NAME} is started successfully.
|
||||
systemctl status ${SERVER_NAME}|grep -q 'active' || {
|
||||
if systemctl is-active --quiet "${SERVER_NAME}"; then
|
||||
openim::log::info "${SERVER_NAME} is running successfully."
|
||||
else
|
||||
openim::log::error "${SERVER_NAME} failed to start, maybe not installed properly"
|
||||
return 1
|
||||
}
|
||||
|
||||
# The listening port is hardcode in the configuration file
|
||||
if echo | telnet 127.0.0.1 7070 2>&1|grep refused &>/dev/null;then
|
||||
openim::log::error "cannot access health check port, ${SERVER_NAME} maybe not startup"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ OPENIM_ROOT=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)
|
||||
function openim::man::info() {
|
||||
cat <<- EOF
|
||||
Usage:
|
||||
man openim-server # Display the man page for openim-server
|
||||
man openim-server to see openim-server help # Display the man page for openim-server
|
||||
EOF
|
||||
}
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ SYSTEM_FILE_PATH="/etc/systemd/system/${SERVER_NAME}.service"
|
||||
# Print the necessary information after installation
|
||||
function openim::msggateway::info() {
|
||||
cat << EOF
|
||||
openim-msggateway listen on: ${OPENIM_MSGGATEWAY_HOST}
|
||||
openim-msggateway listen on: ${OPENIM_MSGGATEWAY_HOST}:${OPENIM_MESSAGE_GATEWAY_PORT}
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -85,18 +85,15 @@ function openim::msggateway::install()
|
||||
|
||||
# 1. Build openim-msggateway
|
||||
make build BINS=${SERVER_NAME}
|
||||
openim::common::sudo "cp ${OPENIM_OUTPUT_HOSTBIN}/${SERVER_NAME} ${OPENIM_INSTALL_DIR}/bin"
|
||||
|
||||
openim::log::status "${SERVER_NAME} binary: ${OPENIM_INSTALL_DIR}/bin/${SERVER_NAME}"
|
||||
openim::common::sudo "cp -r ${OPENIM_OUTPUT_HOSTBIN}/${SERVER_NAME} ${OPENIM_INSTALL_DIR}/${SERVER_NAME}"
|
||||
openim::log::status "${SERVER_NAME} binary: ${OPENIM_INSTALL_DIR}/${SERVER_NAME}"
|
||||
|
||||
# 2. Generate and install the openim-msggateway configuration file (openim-msggateway.yaml)
|
||||
echo ${LINUX_PASSWORD} | sudo -S bash -c \
|
||||
"./scripts/genconfig.sh ${ENV_FILE} deployments/templates/${SERVER_NAME}.yaml > ${OPENIM_CONFIG_DIR}/${SERVER_NAME}.yaml"
|
||||
openim::log::status "${SERVER_NAME} config file: ${OPENIM_CONFIG_DIR}/${SERVER_NAME}.yaml"
|
||||
# nono
|
||||
|
||||
# 3. Create and install the ${SERVER_NAME} systemd unit file
|
||||
echo ${LINUX_PASSWORD} | sudo -S bash -c \
|
||||
"./scripts/genconfig.sh ${ENV_FILE} deployments/templates/init/${SERVER_NAME}.service > ${SYSTEM_FILE_PATH}"
|
||||
"SERVER_NAME=${SERVER_NAME} ./scripts/genconfig.sh ${ENV_FILE} deployments/templates/openim.service > ${SYSTEM_FILE_PATH}"
|
||||
openim::log::status "${SERVER_NAME} systemd file: ${SYSTEM_FILE_PATH}"
|
||||
|
||||
# 4. Start the openim-msggateway service
|
||||
@@ -117,7 +114,7 @@ function openim::msggateway::uninstall()
|
||||
set +o errexit
|
||||
openim::common::sudo "systemctl stop ${SERVER_NAME}"
|
||||
openim::common::sudo "systemctl disable ${SERVER_NAME}"
|
||||
openim::common::sudo "rm -f ${OPENIM_INSTALL_DIR}/bin/${SERVER_NAME}"
|
||||
openim::common::sudo "rm -f ${OPENIM_INSTALL_DIR}/${SERVER_NAME}"
|
||||
openim::common::sudo "rm -f ${OPENIM_CONFIG_DIR}/${SERVER_NAME}.yaml"
|
||||
openim::common::sudo "rm -f /etc/systemd/system/${SERVER_NAME}.service"
|
||||
set -o errexit
|
||||
@@ -134,7 +131,7 @@ function openim::msggateway::status()
|
||||
}
|
||||
|
||||
# The listening port is hardcode in the configuration file
|
||||
if echo | telnet 127.0.0.1 7070 2>&1|grep refused &>/dev/null;then
|
||||
if echo | telnet ${OPENIM_MSGGATEWAY_HOST} ${OPENIM_MESSAGE_GATEWAY_PORT} 2>&1|grep refused &>/dev/null;then
|
||||
openim::log::error "cannot access health check port, ${SERVER_NAME} maybe not startup"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -95,18 +95,18 @@ function openim::msgtransfer::install()
|
||||
|
||||
# 1. Build openim-msgtransfer
|
||||
make build BINS=${SERVER_NAME}
|
||||
openim::common::sudo "cp ${OPENIM_OUTPUT_HOSTBIN}/${SERVER_NAME} ${OPENIM_INSTALL_DIR}/bin"
|
||||
|
||||
openim::common::sudo "cp -r ${OPENIM_OUTPUT_HOSTBIN}/${SERVER_NAME} ${OPENIM_INSTALL_DIR}/${SERVER_NAME}"
|
||||
openim::log::status "${SERVER_NAME} binary: ${OPENIM_INSTALL_DIR}/${SERVER_NAME}/${SERVER_NAME}"
|
||||
|
||||
openim::log::status "${SERVER_NAME} binary: ${OPENIM_INSTALL_DIR}/bin/${SERVER_NAME}"
|
||||
|
||||
# 2. Generate and install the openim-msgtransfer configuration file (openim-msgtransfer.yaml)
|
||||
echo ${LINUX_PASSWORD} | sudo -S bash -c \
|
||||
"./scripts/genconfig.sh ${ENV_FILE} deployments/templates/${SERVER_NAME}.yaml > ${OPENIM_CONFIG_DIR}/${SERVER_NAME}.yaml"
|
||||
openim::log::status "${SERVER_NAME} config file: ${OPENIM_CONFIG_DIR}/${SERVER_NAME}.yaml"
|
||||
# nono
|
||||
|
||||
# 3. Create and install the ${SERVER_NAME} systemd unit file
|
||||
echo ${LINUX_PASSWORD} | sudo -S bash -c \
|
||||
"./scripts/genconfig.sh ${ENV_FILE} deployments/templates/init/${SERVER_NAME}.service > ${SYSTEM_FILE_PATH}"
|
||||
"SERVER_NAME=${SERVER_NAME} ./scripts/genconfig.sh ${ENV_FILE} deployments/templates/openim.service > ${SYSTEM_FILE_PATH}"
|
||||
openim::log::status "${SERVER_NAME} systemd file: ${SYSTEM_FILE_PATH}"
|
||||
|
||||
# 4. Start the openim-msgtransfer service
|
||||
@@ -127,7 +127,7 @@ function openim::msgtransfer::uninstall()
|
||||
set +o errexit
|
||||
openim::common::sudo "systemctl stop ${SERVER_NAME}"
|
||||
openim::common::sudo "systemctl disable ${SERVER_NAME}"
|
||||
openim::common::sudo "rm -f ${OPENIM_INSTALL_DIR}/bin/${SERVER_NAME}"
|
||||
openim::common::sudo "rm -f ${OPENIM_INSTALL_DIR}/${SERVER_NAME}"
|
||||
openim::common::sudo "rm -f ${OPENIM_CONFIG_DIR}/${SERVER_NAME}.yaml"
|
||||
openim::common::sudo "rm -f /etc/systemd/system/${SERVER_NAME}.service"
|
||||
set -o errexit
|
||||
@@ -138,15 +138,11 @@ function openim::msgtransfer::uninstall()
|
||||
function openim::msgtransfer::status()
|
||||
{
|
||||
# Check the running status of the ${SERVER_NAME}. If active (running) is displayed, the ${SERVER_NAME} is started successfully.
|
||||
systemctl status ${SERVER_NAME}|grep -q 'active' || {
|
||||
if systemctl is-active --quiet "${SERVER_NAME}"; then
|
||||
openim::log::info "${SERVER_NAME} is running successfully."
|
||||
else
|
||||
openim::log::error "${SERVER_NAME} failed to start, maybe not installed properly"
|
||||
return 1
|
||||
}
|
||||
|
||||
# The listening port is hardcode in the configuration file
|
||||
if echo | telnet 127.0.0.1 7070 2>&1|grep refused &>/dev/null;then
|
||||
openim::log::error "cannot access health check port, ${SERVER_NAME} maybe not startup"
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ SYSTEM_FILE_PATH="/etc/systemd/system/${SERVER_NAME}.service"
|
||||
# Print the necessary information after installation
|
||||
function openim::push::info() {
|
||||
cat << EOF
|
||||
openim-push listen on: ${OPENIM_PUSH_HOST}
|
||||
openim-push listen on: ${OPENIM_PUSH_HOST}:${OPENIM_PUSH_PORT}
|
||||
EOF
|
||||
}
|
||||
|
||||
@@ -94,18 +94,15 @@ function openim::push::install()
|
||||
|
||||
# 1. Build openim-push
|
||||
make build BINS=${SERVER_NAME}
|
||||
openim::common::sudo "cp -r ${OPENIM_OUTPUT_HOSTBIN}/${SERVER_NAME} ${OPENIM_INSTALL_DIR}/bin"
|
||||
openim::common::sudo "cp -r ${OPENIM_OUTPUT_HOSTBIN}/${SERVER_NAME} ${OPENIM_INSTALL_DIR}/${SERVER_NAME}"
|
||||
openim::log::status "${SERVER_NAME} binary: ${OPENIM_INSTALL_DIR}/${SERVER_NAME}/${SERVER_NAME}"
|
||||
|
||||
openim::log::status "${SERVER_NAME} binary: ${OPENIM_INSTALL_DIR}/bin/${SERVER_NAME}"
|
||||
|
||||
# 2. Generate and install the openim-push configuration file (openim-push.yaml)
|
||||
echo ${LINUX_PASSWORD} | sudo -S bash -c \
|
||||
"./scripts/genconfig.sh ${ENV_FILE} deployments/templates/${SERVER_NAME}.yaml > ${OPENIM_CONFIG_DIR}/${SERVER_NAME}.yaml"
|
||||
openim::log::status "${SERVER_NAME} config file: ${OPENIM_CONFIG_DIR}/${SERVER_NAME}.yaml"
|
||||
# 2. Generate and install the openim-push configuration file (config)
|
||||
openim::log::status "${SERVER_NAME} config file: ${OPENIM_CONFIG_DIR}/config.yaml"
|
||||
|
||||
# 3. Create and install the ${SERVER_NAME} systemd unit file
|
||||
echo ${LINUX_PASSWORD} | sudo -S bash -c \
|
||||
"./scripts/genconfig.sh ${ENV_FILE} deployments/templates/init/${SERVER_NAME}.service > ${SYSTEM_FILE_PATH}"
|
||||
"SERVER_NAME=${SERVER_NAME} ./scripts/genconfig.sh ${ENV_FILE} deployments/templates/openim.service > ${SYSTEM_FILE_PATH}"
|
||||
openim::log::status "${SERVER_NAME} systemd file: ${SYSTEM_FILE_PATH}"
|
||||
|
||||
# 4. Start the openim-push service
|
||||
@@ -125,7 +122,7 @@ function openim::push::uninstall()
|
||||
set +o errexit
|
||||
openim::common::sudo "systemctl stop ${SERVER_NAME}"
|
||||
openim::common::sudo "systemctl disable ${SERVER_NAME}"
|
||||
openim::common::sudo "rm -f ${OPENIM_INSTALL_DIR}/bin/${SERVER_NAME}"
|
||||
openim::common::sudo "rm -f ${OPENIM_INSTALL_DIR}/${SERVER_NAME}"
|
||||
openim::common::sudo "rm -f ${OPENIM_CONFIG_DIR}/${SERVER_NAME}.yaml"
|
||||
openim::common::sudo "rm -f /etc/systemd/system/${SERVER_NAME}.service"
|
||||
set -o errexit
|
||||
@@ -142,7 +139,7 @@ function openim::push::status()
|
||||
}
|
||||
|
||||
# The listening port is hardcode in the configuration file
|
||||
if echo | telnet 127.0.0.1 7071 2>&1|grep refused &>/dev/null;then # Assuming a different port for push
|
||||
if echo | telnet ${OPENIM_MSGGATEWAY_HOST} ${OPENIM_PUSH_PORT} 2>&1|grep refused &>/dev/null;then # Assuming a different port for push
|
||||
openim::log::error "cannot access health check port, ${SERVER_NAME} maybe not startup"
|
||||
return 1
|
||||
fi
|
||||
|
||||
@@ -160,26 +160,86 @@ function openim::rpc::start_service() {
|
||||
}
|
||||
|
||||
###################################### Linux Systemd ######################################
|
||||
SYSTEM_FILE_PATH="/etc/systemd/system/${SERVER_NAME}.service"
|
||||
declare -A SYSTEM_FILE_PATHS
|
||||
for service in "${OPENIM_RPC_SERVICE_LISTARIES[@]}"; do
|
||||
SYSTEM_FILE_PATHS["$service"]="/etc/systemd/system/${service}.service"
|
||||
done
|
||||
|
||||
function openim::rpc::install() {
|
||||
openim::log::info "Installing ${SERVER_NAME} ..."
|
||||
# Print the necessary information after installation
|
||||
function openim::rpc::info() {
|
||||
for service in "${OPENIM_RPC_SERVICE_LISTARIES[@]}"; do
|
||||
echo "${service} listen on: ${OPENIM_RPC_PORT_LISTARIES[@]}"
|
||||
done
|
||||
}
|
||||
|
||||
function openim::rpc::uninstall() {
|
||||
openim::log::info "Uninstalling ${SERVER_NAME} ..."
|
||||
# install openim-rpc
|
||||
function openim::rpc::install()
|
||||
{
|
||||
pushd "${OPENIM_ROOT}"
|
||||
|
||||
# 1. Build openim-rpc
|
||||
for service in "${OPENIM_RPC_SERVICE_LISTARIES[@]}"; do
|
||||
make build BINS=${service}
|
||||
openim::common::sudo "cp -r ${OPENIM_OUTPUT_HOSTBIN}/${service} ${OPENIM_INSTALL_DIR}/${service}"
|
||||
openim::log::status "${service} binary: ${OPENIM_INSTALL_DIR}/${service}/${service}"
|
||||
done
|
||||
|
||||
# 2. Generate and install the openim-rpc configuration file (config)
|
||||
openim::log::status "openim-rpc config file: ${OPENIM_CONFIG_DIR}/config.yaml"
|
||||
|
||||
# 3. Create and install the systemd unit files
|
||||
for service in "${OPENIM_RPC_SERVICE_LISTARIES[@]}"; do
|
||||
echo ${LINUX_PASSWORD} | sudo -S bash -c \
|
||||
"SERVER_NAME=${service} ./scripts/genconfig.sh ${ENV_FILE} deployments/templates/openim.service > ${SYSTEM_FILE_PATHS[$service]}"
|
||||
openim::log::status "${service} systemd file: ${SYSTEM_FILE_PATHS[$service]}"
|
||||
done
|
||||
|
||||
# 4. Start the openim-rpc services
|
||||
openim::common::sudo "systemctl daemon-reload"
|
||||
for service in "${OPENIM_RPC_SERVICE_LISTARIES[@]}"; do
|
||||
openim::common::sudo "systemctl restart ${service}"
|
||||
openim::common::sudo "systemctl enable ${service}"
|
||||
done
|
||||
openim::rpc::status || return 1
|
||||
openim::rpc::info
|
||||
|
||||
openim::log::info "install openim-rpc successfully"
|
||||
popd
|
||||
}
|
||||
|
||||
function openim::rpc::status() {
|
||||
openim::log::info "Checking ${SERVER_NAME} status ..."
|
||||
# Unload
|
||||
function openim::rpc::uninstall()
|
||||
{
|
||||
set +o errexit
|
||||
for service in "${OPENIM_RPC_SERVICE_LISTARIES[@]}"; do
|
||||
openim::common::sudo "systemctl stop ${service}"
|
||||
openim::common::sudo "systemctl disable ${service}"
|
||||
openim::common::sudo "rm -f ${OPENIM_INSTALL_DIR}/${service}"
|
||||
openim::common::sudo "rm -f ${OPENIM_CONFIG_DIR}/${service}.yaml"
|
||||
openim::common::sudo "rm -f ${SYSTEM_FILE_PATHS[$service]}"
|
||||
done
|
||||
set -o errexit
|
||||
openim::log::info "uninstall openim-rpc successfully"
|
||||
}
|
||||
|
||||
openim::util::check_ports ${OPENIM_RPC_PORT_TARGETS[@]}
|
||||
# openim::util::check_ports ${OPENIM_RPC_PROM_PORT_TARGETS[@]}
|
||||
# Status Check
|
||||
function openim::rpc::status()
|
||||
{
|
||||
for service in "${OPENIM_RPC_SERVICE_LISTARIES[@]}"; do
|
||||
# Check the running status of the ${service}. If active (running) is displayed, the ${service} is started successfully.
|
||||
systemctl status ${service}|grep -q 'active' || {
|
||||
openim::log::error "${service} failed to start, maybe not installed properly"
|
||||
return 1
|
||||
}
|
||||
|
||||
openim::util::check_process_names ${SERVER_NAME}
|
||||
# The listening port is hardcoded in the configuration file
|
||||
if echo | telnet ${OPENIM_MSGGATEWAY_HOST} ${OPENIM_RPC_PORT_LISTARIES[@]} 2>&1|grep refused &>/dev/null;then
|
||||
openim::log::error "cannot access health check port, ${service} maybe not startup"
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
if [[ "$*" =~ openim::rpc:: ]];then
|
||||
eval $*
|
||||
fi
|
||||
eval $*
|
||||
fi
|
||||
|
||||
@@ -1,300 +0,0 @@
|
||||
" learn: https://github.com/cubxxw/awesome-cs-course/tree/master/linux
|
||||
" Read: https://github.com/cubxxw/awesome-cs-course/blob/master/linux/markdown/my_vim.md
|
||||
|
||||
"vim的配置关于鼠标滚动滑动"""
|
||||
if has("autocmd")
|
||||
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
|
||||
set mouse=a
|
||||
endif
|
||||
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
"C,C++ 按F5编译运行
|
||||
map <F5> :call CompileRunGcc()<CR>
|
||||
func! CompileRunGcc()
|
||||
exec "w"
|
||||
if &filetype == 'c'
|
||||
exec "!g++ % -o %<"
|
||||
exec "! ./%<"
|
||||
elseif &filetype == 'cpp'
|
||||
exec "!g++ % -o %<"
|
||||
exec "! ./%<"
|
||||
elseif &filetype == 'java'
|
||||
exec "!javac %"
|
||||
exec "!java %<"
|
||||
elseif &filetype == 'sh'
|
||||
:!./%
|
||||
endif
|
||||
endfunc
|
||||
"配置命令"
|
||||
"C,C++的调试
|
||||
"''''''''''''''''""""""""""""""""""""""""""""""""""'''''''''''''''''''''
|
||||
map <F8> :call Rungdb()<CR>
|
||||
func! Rungdb()
|
||||
exec "w"
|
||||
exec "!g++ % -g -o %<"
|
||||
exec "!gdb ./%<"
|
||||
endfunc
|
||||
|
||||
""实用设置
|
||||
" 设置当文件被改动时自动载入
|
||||
set autoread
|
||||
" quickfix模式
|
||||
autocmd FileType c,cpp map <buffer> <leader><space> :w<cr>:make<cr>
|
||||
"代码补全
|
||||
set completeopt=preview,menu
|
||||
|
||||
" common configure
|
||||
"set noswapfile
|
||||
set mouse=a " 激活鼠标使用
|
||||
set wrap " 自动换行
|
||||
set sw=4 " 设置软宽度
|
||||
set gdefault " 行内替换
|
||||
set nu
|
||||
set showmatch " 高亮显示括号匹配
|
||||
set expandtab " 使用空格来替换 Tab
|
||||
set tabstop=4 " 设置 Tab 长度为 4 空格
|
||||
set shiftwidth=4 " 设置自动缩进长度为 4 空格
|
||||
set autoindent " 继承前一行的缩进方式,适用于多行注释"
|
||||
set autowrite " 自动保存
|
||||
set nocompatible " 关闭 vi 兼容模式
|
||||
set history=1000 " 设置历史记录步数
|
||||
set confirm " 在处理未保存或只读文件时,弹出确认
|
||||
|
||||
" 搜索逐字符高亮
|
||||
set hlsearch
|
||||
set incsearch
|
||||
|
||||
" 从不备份
|
||||
set nobackup
|
||||
set noswapfile
|
||||
|
||||
let g:indentLine_enabled=0
|
||||
|
||||
" golang configure ====> start
|
||||
let g:go_highlight_methods = 1
|
||||
let g:go_highlight_operators = 1
|
||||
let g:go_highlight_build_constraints = 1
|
||||
let g:go_fmt_autosave = 1
|
||||
let g:go_version_warning = 1
|
||||
let g:go_autodetect_gopath = 1
|
||||
let g:go_highlight_types = 1
|
||||
let g:go_highlight_fields = 1
|
||||
let g:go_highlight_functions = 1
|
||||
let g:go_highlight_function_calls = 1
|
||||
let g:go_highlight_extra_types = 1
|
||||
let g:go_highlight_generate_tags = 1
|
||||
let g:go_def_mode = 'gopls'
|
||||
let g:go_gopls_enabled = 1
|
||||
let g:go_guru_enabled = 1
|
||||
let g:go_fmt_experimental = 1
|
||||
let g:go_def_mapping_enabled = 1
|
||||
let g:go_build_tags = '-v'
|
||||
let g:go_fmt_command = "goimports"
|
||||
let g:go_list_type = "quickfix"
|
||||
let g:go_def_mapping_enable = 1
|
||||
|
||||
map <2-LeftMouse> :GoDef <CR>
|
||||
map <RightMouse> :GoDefPop <CR>
|
||||
map <C-N> :GoCallers <CR>
|
||||
map <C-M> :GoCallees <CR>
|
||||
map <ScrollWheelUp> <C-Y>
|
||||
map <ScrollWheelDown> <C-E>
|
||||
unmap <CR>
|
||||
map <CR> :GoDef <CR>
|
||||
map <C-I> :GoDefPop <CR>
|
||||
map <S-K> :GoDoc<cr>
|
||||
map <S-M> :GoInfo<cr>
|
||||
map <S-T> :GoDefType<cr>
|
||||
map <S-L> :GoAddTag<cr>
|
||||
map <S-P> :GoImplements<cr>
|
||||
map <S-R> :GoRename<cr>
|
||||
map <S-F> :GoFillStruct<cr>
|
||||
map <S-C> :GoCallers<cr>
|
||||
map <S-H> :GoSameIdsToggle<cr>
|
||||
|
||||
augroup go
|
||||
autocmd!
|
||||
|
||||
" Show by default 4 spaces for a tab
|
||||
autocmd BufNewFile,BufRead *.go setlocal noexpandtab tabstop=4 shiftwidth=4
|
||||
|
||||
" :GoDef but opens in a vertical split
|
||||
autocmd FileType go nmap <Leader>v <Plug>(go-def-vertical)
|
||||
" :GoDef but opens in a horizontal split
|
||||
autocmd FileType go nmap <Leader>s <Plug>(go-def-split)
|
||||
|
||||
" :GoAlternate commands :A, :AV, :AS and :AT
|
||||
autocmd Filetype go command! -bang A call go#alternate#Switch(<bang>0, 'edit')
|
||||
autocmd Filetype go command! -bang AV call go#alternate#Switch(<bang>0, 'vsplit')
|
||||
autocmd Filetype go command! -bang AS call go#alternate#Switch(<bang>0, 'split')
|
||||
autocmd Filetype go command! -bang AT call go#alternate#Switch(<bang>0, 'tabe')
|
||||
augroup END
|
||||
|
||||
" build_go_files is a custom function that builds or compiles the test file.
|
||||
" It calls :GoBuild if its a Go file, or :GoTestCompile if it's a test file
|
||||
function! s:build_go_files()
|
||||
let l:file = expand('%')
|
||||
if l:file =~# '^\f\+_test\.go$'
|
||||
call go#test#Test(0, 1)
|
||||
elseif l:file =~# '^\f\+\.go$'
|
||||
call go#cmd#Build(0)
|
||||
endif
|
||||
endfunction
|
||||
" golang configure ====> end
|
||||
|
||||
:inoremap ( ()<ESC>i
|
||||
:inoremap ) <c-r>=ClosePair(')')<CR>
|
||||
:inoremap { {<CR>}<ESC>O
|
||||
:inoremap } <c-r>=ClosePair('}')<CR>
|
||||
:inoremap [ []<ESC>i
|
||||
:inoremap ] <c-r>=ClosePair(']')<CR>
|
||||
:inoremap " ""<ESC>i
|
||||
:inoremap ' ''<ESC>i
|
||||
function! ClosePair(char)
|
||||
if getline('.')[col('.') - 1] == a:char
|
||||
return "\<Right>"
|
||||
else
|
||||
return a:char
|
||||
endif
|
||||
endfunction
|
||||
filetype plugin indent on
|
||||
"打开文件类型检测, 加了这句才可以用智能补全
|
||||
|
||||
set completeopt=longest,menu
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""
|
||||
noremap <F6> :set nu
|
||||
noremap <F4> :!python3 a
|
||||
noremap <F7> :set ai
|
||||
noremap <F8> :syntax on
|
||||
set cursorline " 突出显示当前行
|
||||
set magic " 设置魔术
|
||||
"" noremap <F5> :! g++ -o a
|
||||
nnoremap <C-J> <C-W><C-J>
|
||||
nnoremap <C-K> <C-W><C-K>
|
||||
nnoremap <C-L> <C-W><C-L>
|
||||
nnoremap <C-H> <C-W><C-H>
|
||||
nmap wj :resize -3<CR>
|
||||
nmap wk :resize +3<CR>
|
||||
nmap wh :vertical resize -3<CR>
|
||||
nmap wl :vertical resize +3<CR>
|
||||
set guifont=Droid\ Sans\ Mono\ Nerd\ Font\ Complete:h18 " 设置字体
|
||||
set guicursor=n-v-c:ver5 " 设置光标为竖线
|
||||
set number ""# 显示行号
|
||||
set autowrite "" # 自动保存
|
||||
set ruler ""# 显示打开状态栏标尺
|
||||
set cursorline "" # 突出显示当前行
|
||||
|
||||
set showmatch "" # 匹配光标所经过的括号等.
|
||||
set showcmd ""# 命令行显示输入的命令
|
||||
set showmode ""命令行显示vim当前模式
|
||||
set showtabline=0 " 隐藏Tab栏
|
||||
set laststatus=2 """"'vim 窗口底部显示永久状态栏,显示文件名,行号,列号等.
|
||||
let mapleader = "," " 定义<leader>键
|
||||
set nocompatible " 设置不兼容原始vi模式
|
||||
filetype on " 设置开启文件类型侦测
|
||||
filetype plugin on " 设置加载对应文件类型的插件
|
||||
set noeb " 关闭错误的提示
|
||||
syntax enable " 开启语法高亮功能
|
||||
syntax on " 自动语法高亮
|
||||
set cmdheight=2 " 设置命令行的高度
|
||||
set showcmd " select模式下显示选中的行数
|
||||
set ruler " 总是显示光标位置
|
||||
set laststatus=2 " 总是显示状态栏
|
||||
set number " 开启行号显示
|
||||
set cursorline " 高亮显示当前行
|
||||
set whichwrap+=<,>,h,l " 设置光标键跨行
|
||||
set ttimeoutlen=0 " 设置<ESC>键响应时间
|
||||
set virtualedit=block,onemore " 允许光标出现在最后一个字符的后面
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" 代码缩进和排版
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
set autoindent " 设置自动缩进
|
||||
set cindent " 设置使用C/C++语言的自动缩进方式
|
||||
set cinoptions=g0,:0,N-s,(0 " 设置C/C++语言的具体缩进方式
|
||||
set smartindent " 智能的选择对其方式
|
||||
filetype indent on " 自适应不同语言的智能缩进
|
||||
set expandtab " 将制表符扩展为空格
|
||||
set tabstop=4 " 设置编辑时制表符占用空格数
|
||||
set shiftwidth=4 " 设置格式化时制表符占用空格数
|
||||
set softtabstop=4 " 设置4个空格为制表符
|
||||
set smarttab " 在行和段开始处使用制表符
|
||||
set nowrap " 禁止折行
|
||||
set backspace=2 " 使用回车键正常处理indent,eol,start等
|
||||
set sidescroll=10 " 设置向右滚动字符数
|
||||
set nofoldenable " 禁用折叠代码
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" 代码补全
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
set wildmenu " vim自身命名行模式智能补全
|
||||
set completeopt-=preview " 补全时不显示窗口,只显示补全列表
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" 搜索设置
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
set hlsearch " 高亮显示搜索结果
|
||||
set incsearch " 开启实时搜索功能
|
||||
set ignorecase " 搜索时大小写不敏感
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
" 缓存设置
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
set nobackup " 设置不备份
|
||||
set noswapfile " 禁止生成临时文件
|
||||
set autoread " 文件在vim之外修改过,自动重新读入
|
||||
set autowrite " 设置自动保存
|
||||
set confirm " 在处理未保存或只读文件的时候,弹出确认
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
"调整窗
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
nmap wj :resize -3<CR>
|
||||
nmap wk :resize +3<CR>
|
||||
nmap wh :vertical resize -3<CR>
|
||||
nmap wl :vertical resize +3<CR>
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
"编码"
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
set langmenu=zh_CN.UTF-8
|
||||
set helplang=cn
|
||||
set termencoding=utf-8
|
||||
set encoding=utf8
|
||||
set fileencodings=utf8,ucs-bom,gbk,cp936,gb2312,gb18030
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
"代码补全“
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
inoremap ' ''<ESC>i
|
||||
inoremap " ""<ESC>i
|
||||
inoremap ( ()<ESC>i
|
||||
inoremap [ []<ESC>i
|
||||
inoremap { {<CR>}<ESC>O
|
||||
: set nu
|
||||
: set ai
|
||||
: syntax on
|
||||
: filetype on
|
||||
set tabstop=4
|
||||
set ignorecase
|
||||
noremap <C-h> <C -w>h
|
||||
noremap <C-j> <C -w>j
|
||||
noremap <C-k> <C -w>r
|
||||
noremap <C-l> <C -w>l
|
||||
" Specify a directory for plugins
|
||||
" - For Neovim: stdpath('data') . '/plugged'
|
||||
" - Avoid using standard Vim directory names like 'plugin'
|
||||
let g:coc_disable_startup_warning = 1
|
||||
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
"tmux"
|
||||
"复用终端、分屏"
|
||||
"let g:EasyMotion_startofline = 0 " keep cursor colum when JK motion
|
||||
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
|
||||
map <Leader><leader>h <Plug>(easymotion-linebackward)
|
||||
map <Leader><Leader>j <Plug>(easymotion-j)
|
||||
map <Leader><Leader>k <Plug>(easymotion-k)
|
||||
map <Leader><leader>l <Plug>(easymotion-lineforward)
|
||||
" 重复上一次操作, 类似repeat插件, 很强大
|
||||
map <Leader><leader>. <Plug>(easymotion-repeat)
|
||||
nmap s <Plug>(easymotion-s)
|
||||
@@ -268,6 +268,7 @@ openim::util::check_docker_and_compose_versions() {
|
||||
# Check if the docker compose sub-command is available
|
||||
if ! docker compose version &> /dev/null; then
|
||||
echo "Docker does not support the docker compose sub-command"
|
||||
echo "You need to upgrade Docker to the right version"
|
||||
return 1
|
||||
fi
|
||||
|
||||
|
||||
@@ -137,6 +137,7 @@ ifneq ($(shell $(GO) version | grep -q -E '\bgo($(GO_SUPPORTED_VERSIONS))\b' &&
|
||||
endif
|
||||
|
||||
## go.build.%: Build binaries for a specific platform
|
||||
# CGO_ENABLED=0 https://wiki.musl-libc.org/functional-differences-from-glibc.html
|
||||
.PHONY: go.build.%
|
||||
go.build.%:
|
||||
$(eval COMMAND := $(word 2,$(subst ., ,$*)))
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
DOCKER := docker
|
||||
|
||||
# read: https://github.com/openimsdk/open-im-server/blob/main/docs/conversions/images.md
|
||||
REGISTRY_PREFIX ?= ghcr.io/openimsdk
|
||||
REGISTRY_PREFIX ?= registry.cn-hangzhou.aliyuncs.com/openimsdk
|
||||
# REGISTRY_PREFIX ?= ghcr.io/openimsdk
|
||||
|
||||
BASE_IMAGE ?= ghcr.io/openim-sigs/openim-bash-image
|
||||
|
||||
@@ -43,6 +44,7 @@ endif
|
||||
# Determine image files by looking into build/images/*/Dockerfile
|
||||
IMAGES_DIR ?= $(wildcard ${ROOT_DIR}/build/images/*)
|
||||
# Determine images names by stripping out the dir names, and filter out the undesired directories
|
||||
# IMAGES ?= $(filter-out Dockerfile,$(foreach image,${IMAGES_DIR},$(notdir ${image})))
|
||||
IMAGES ?= $(filter-out Dockerfile openim-tools openim-cmdutils,$(foreach image,${IMAGES_DIR},$(notdir ${image})))
|
||||
|
||||
ifeq (${IMAGES},)
|
||||
@@ -105,6 +107,7 @@ image.build.%: go.build.%
|
||||
| sed "s#BINARY_NAME#$(IMAGE)#g" >$(TMP_DIR)/$(IMAGE)/Dockerfile
|
||||
@cp $(BIN_DIR)/platforms/$(IMAGE_PLAT)/$(IMAGE) $(TMP_DIR)/$(IMAGE)
|
||||
$(eval BUILD_SUFFIX := $(_DOCKER_BUILD_EXTRA_ARGS) --pull -t $(REGISTRY_PREFIX)/$(IMAGE)-$(ARCH):$(VERSION) $(TMP_DIR)/$(IMAGE))
|
||||
@echo $(DOCKER) build --platform $(IMAGE_PLAT) $(BUILD_SUFFIX)
|
||||
@if [ $(shell $(GO) env GOARCH) != $(ARCH) ] ; then \
|
||||
$(MAKE) image.daemon.verify ;\
|
||||
$(DOCKER) build --platform $(IMAGE_PLAT) $(BUILD_SUFFIX) ; \
|
||||
|
||||
@@ -16,7 +16,7 @@ Learn more about versions of OpenIM:
|
||||
<a href="https://github.com/kubbot" style="float: left; margin-right: 10px;">
|
||||
<img src="https://github.com/openimbot/openimbot/blob/main/assets/icon/blue%E9%80%8F%E6%98%8E.png" width="50" height="50" />
|
||||
</a>
|
||||
<a href="https://www.openim.online">
|
||||
<a href="https://openim.io">
|
||||
<img src="https://github.com/{{ .Env.USERNAME }}/{{ .ProjectName }}/blob/main/assets/logo/openim-logo.png" />
|
||||
</a>
|
||||
<a href="https://github.com/openimbot" style="float: right; margin-left: 10px;">
|
||||
|
||||
@@ -28,10 +28,10 @@ source "${OPENIM_ROOT}/hack/lib/init.sh"
|
||||
openim::golang::setup_env
|
||||
|
||||
BINS=(
|
||||
cmd/gendocs
|
||||
cmd/genopenimdocs
|
||||
cmd/genman
|
||||
cmd/genyaml
|
||||
gendocs
|
||||
genopenimdocs
|
||||
genman
|
||||
genyaml
|
||||
)
|
||||
make -C "${OPENIM_ROOT}" WHAT="${BINS[*]}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user