diff --git a/README.md b/README.md index 23c6eeb9786dddc513d193e40ffff964231971c4..b7cccfd8dfe5d15d5f4d4edeb2154344f0b694db 100644 --- a/README.md +++ b/README.md @@ -235,6 +235,16 @@ 可以通过修改 docker/sysom_base_dockerfile 使能不同的微服务 +### 3.2 基础服务+hotfix 部署 + 在 sysom 的基础服务上使能 hotfix 功能,需要在 sysom_base_dockerfile 文件的基础上新增安装 sysom_hotfix,sysom_hotfix_builder 两个微服务,详见 /docker/sysom_with_hotfix_enable_dockerfile + + 启动使能 hotfix 功能的 sysom 时需要注意,首先要在宿主系统上新建 hotfix-nfs 目录,用于挂载至容器中,使得容器中的 nfs 服务能够正常启动。具体执行命令如下: + + ```bash + docker build -t sysom-with-hotfix -f docker/sysom_with_hotfix_enable_dockerfile . + mkdir -p /data/sysom/server/hotfix_builder/hotfix-nfs + docker run -idt --privileged=true --restart=always -p 8080:80 -v /data/sysom/server/hotfix_builder/hotfix-nfs:/usr/local/sysom/server/hotfix_builder/hotfix-nfs --name sysom-with-hotfix sysom-with-hotfix + ``` ## 4. 通过 WEB 前端访问 diff --git a/deps/4_grafana/install.sh b/deps/4_grafana/install.sh index f10bd76ee4a2d5e50e036bcd27bacc45c838e4b0..750e698215d85429d0d7b815babf779cbdac6db1 100644 --- a/deps/4_grafana/install.sh +++ b/deps/4_grafana/install.sh @@ -30,6 +30,7 @@ install_grafana() wget ${GRAFANA_PLUGIN_OSS_URL}/sysom-network-topology-panel-0.0.1.zip fi if [ ! -d sysom-network-topology-panel ]; then + rpm -q --quiet unzip || yum install -y unzip unzip sysom-network-topology-panel-0.0.1.zip rm -rf sysom-network-topology-panel-0.0.1.zip fi diff --git a/docker/sysom_with_hotfix_enable_dockerfile b/docker/sysom_with_hotfix_enable_dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..9c4329bf6750e3129494e2b318f48abeecade4f5 --- /dev/null +++ b/docker/sysom_with_hotfix_enable_dockerfile @@ -0,0 +1,53 @@ + +FROM node:16.20.1 as web_builder +COPY sysom_web /root/sysom_web +WORKDIR /root/sysom_web +RUN npm config set registry https://registry.npmmirror.com +RUN yarn config set registry https://registry.npmmirror.com +RUN yarn +RUN yarn build + + +FROM openanolis/anolisos:8.8 as prod + +# Add epel +RUN yum install -y https://mirrors.aliyun.com/epel/epel-release-latest-8.noarch.rpm +RUN bash -c "sed -i 's|^#baseurl=https://download.example/pub|baseurl=https://mirrors.aliyun.com|' /etc/yum.repos.d/epel*" +RUN bash -c "sed -i 's|^metalink|#metalink|' /etc/yum.repos.d/epel*" + +# Add required yum packages +RUN yum makecache +RUN yum install -y supervisor cronie net-tools +RUN systemctl enable crond +RUN yum install -y python3 +RUN yum install -y nginx +RUN yum install -y redis +RUN yum install -y wget +RUN systemctl enable supervisord +RUN systemctl enable nginx + +# Init sysom-diagnosis +ARG SYSOM_HOME=/usr/local/sysom +ARG SYSOM_SERVER_HOME=${SYSOM_HOME}/server + +RUN mkdir /root/sysom +RUN mkdir -p /usr/local/sysom +COPY conf /root/sysom/conf +COPY script /root/sysom/script +COPY deps /root/sysom/deps +COPY environment /root/sysom/environment +COPY sysom_server /root/sysom/sysom_server + +COPY --from=web_builder /root/sysom_web/dist /usr/local/sysom/web + +RUN bash -x /root/sysom/script/sysom.sh install deps ALL +RUN bash -x /root/sysom/script/sysom.sh install env ALL +RUN bash -x /root/sysom/script/sysom.sh install ms sysom_api,sysom_diagnosis,sysom_channel,sysom_monitor_server,sysom_log,sysom_alarm,sysom_hotfix,sysom_hotfix_builder + +RUN yum clean all + +COPY docker/sysom-init.service /usr/lib/systemd/system/sysom-init.service +RUN systemctl enable sysom-init.service + +# # 环境准备 +ENTRYPOINT [ "/usr/sbin/init" ] \ No newline at end of file diff --git a/script/server/sysom_hotfix/init.sh b/script/server/sysom_hotfix/init.sh index 6839466a24249ef37b6804d7aed8c484941da5d2..d9979880105d9c737b2e768ae72e1c0291b2606c 100644 --- a/script/server/sysom_hotfix/init.sh +++ b/script/server/sysom_hotfix/init.sh @@ -10,7 +10,7 @@ init_conf() { ###change the install dir base on param $1### sed -i "s;/usr/local/sysom;${APP_HOME};g" /etc/supervisord.d/${SERVICE_NAME}.ini cpu_num=`cat /proc/cpuinfo | grep processor | wc -l` - sed -i "s/threads = 3/threads = $cpu_num/g" ${SERVICE_HOME}/conf/hotfix_gunicorn.py + sed -i "s/threads = 3/threads = $cpu_num/g" ${SERVICE_HOME}/conf/gunicorn.py } init_nfs() diff --git a/script/server/sysom_hotfix_builder/install.sh b/script/server/sysom_hotfix_builder/install.sh index 1110d5615c83586c3a6dd92ceb1af724b1d686f1..3f4a690aeb78f799a7dd1e330f1301d0ba927a05 100644 --- a/script/server/sysom_hotfix_builder/install.sh +++ b/script/server/sysom_hotfix_builder/install.sh @@ -17,7 +17,7 @@ install_requirement() { } install_package() { - rpm -q --quiet make gcc patch bison flex openssl-devel elfutils elfutils-devel dwarves || yum install -y make gcc patch bison flex openssl-devel elfutils elfutils-devel dwarves || exit 1 + rpm -q --quiet make gcc patch bison flex openssl-devel elfutils elfutils-devel dwarves sudo || yum install -y make gcc patch bison flex openssl-devel elfutils elfutils-devel dwarves sudo || exit 1 rpm -q --quiet docker git || yum install -y docker git || echo "Warngin : Docker is not installed in this machine!" }