Skip to content

Commit ebcc8a6

Browse files
authored
installer: fix docker-compose detection logic (#428)
1 parent c4d8b63 commit ebcc8a6

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<br>
55
<small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small>
66
<br><br>
7-
<img alt="GitHub release (with filter)" src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&style=for-the-badge&logo=github&label=Dashboard">&nbsp;<img src="https://img.shields.io/github/v/release/nezhahq/agent?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/actions/workflow/status/nezhahq/agent/agent.yml?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.19.1-brightgreen?style=for-the-badge&logo=linux">
7+
<img alt="GitHub release (with filter)" src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&style=for-the-badge&logo=github&label=Dashboard">&nbsp;<img src="https://img.shields.io/github/v/release/nezhahq/agent?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/actions/workflow/status/nezhahq/agent/agent.yml?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.19.2-brightgreen?style=for-the-badge&logo=linux">
88
<br>
99
<br>
1010
<p>:trollface: <b>Nezha Monitoring: Self-hostable, lightweight, servers and websites monitoring and O&M tool.</b></p>

script/install.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
1212
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
1313
NZ_DASHBOARD_SERVICE="/etc/systemd/system/nezha-dashboard.service"
1414
NZ_DASHBOARD_SERVICERC="/etc/init.d/nezha-dashboard"
15-
NZ_VERSION="v0.19.1"
15+
NZ_VERSION="v0.19.2"
1616

1717
red='\033[0;31m'
1818
green='\033[0;32m'
@@ -170,9 +170,6 @@ installation_check() {
170170
echo "未找到带有 nezha-dashboard 仓库的 Docker 镜像。"
171171
fi
172172
fi
173-
else
174-
err "请手动安装 docker-compose。https://docs.docker.com/compose/install/linux/"
175-
exit 1
176173
fi
177174

178175
if [ -f "$NZ_DASHBOARD_PATH/app" ]; then
@@ -456,11 +453,16 @@ modify_dashboard_config() {
456453
echo "> 修改面板配置"
457454

458455
if [ "$IS_DOCKER_NEZHA" = 1 ]; then
459-
echo "正在下载 Docker 脚本"
460-
wget -t 2 -T 60 -O /tmp/nezha-docker-compose.yaml https://${GITHUB_RAW_URL}/script/docker-compose.yaml >/dev/null 2>&1
461-
if [ $? != 0 ]; then
462-
err "下载脚本失败,请检查本机能否连接 ${GITHUB_RAW_URL}"
463-
return 0
456+
if [ ! -z "$DOCKER_COMPOSE_COMMAND" ]; then
457+
echo "正在下载 Docker 脚本"
458+
wget -t 2 -T 60 -O /tmp/nezha-docker-compose.yaml https://${GITHUB_RAW_URL}/script/docker-compose.yaml >/dev/null 2>&1
459+
if [ $? != 0 ]; then
460+
err "下载脚本失败,请检查本机能否连接 ${GITHUB_RAW_URL}"
461+
return 0
462+
fi
463+
else
464+
err "请手动安装 docker-compose。https://docs.docker.com/compose/install/linux/"
465+
before_show_menu
464466
fi
465467
fi
466468

script/install_en.sh

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
1212
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
1313
NZ_DASHBOARD_SERVICE="/etc/systemd/system/nezha-dashboard.service"
1414
NZ_DASHBOARD_SERVICERC="/etc/init.d/nezha-dashboard"
15-
NZ_VERSION="v0.19.1"
15+
NZ_VERSION="v0.19.2"
1616

1717
red='\033[0;31m'
1818
green='\033[0;32m'
@@ -169,9 +169,6 @@ installation_check() {
169169
echo "No Docker images with the nezha-dashboard repository were found."
170170
fi
171171
fi
172-
else
173-
err "Please install docker-compose manually. https://docs.docker.com/compose/install/linux/"
174-
exit 1
175172
fi
176173

177174
if [ -f "$NZ_DASHBOARD_PATH/app" ]; then
@@ -450,11 +447,16 @@ modify_dashboard_config() {
450447
echo "> Modify Dashboard Configuration"
451448

452449
if [ "$IS_DOCKER_NEZHA" = 1 ]; then
453-
echo "Download Docker Script"
454-
wget -t 2 -T 60 -O /tmp/nezha-docker-compose.yaml https://${GITHUB_RAW_URL}/script/docker-compose.yaml >/dev/null 2>&1
455-
if [ $? != 0 ]; then
456-
err "Script failed to get, please check if the network can link ${GITHUB_RAW_URL}"
457-
return 0
450+
if [ ! -z "$DOCKER_COMPOSE_COMMAND" ]; then
451+
echo "Download Docker Script"
452+
wget -t 2 -T 60 -O /tmp/nezha-docker-compose.yaml https://${GITHUB_RAW_URL}/script/docker-compose.yaml >/dev/null 2>&1
453+
if [ $? != 0 ]; then
454+
err "Script failed to get, please check if the network can link ${GITHUB_RAW_URL}"
455+
return 0
456+
fi
457+
else
458+
err "请手动安装 docker-compose。https://docs.docker.com/compose/install/linux/"
459+
before_show_menu
458460
fi
459461
fi
460462

0 commit comments

Comments
 (0)