gatus: pin Go to gatus's go.mod version, modernize Alpine path to shared helpers (#16893)

This commit is contained in:
CanbiZ (MickLesk)
2026-08-31 09:40:55 +02:00
committed by GitHub
parent ff606af7ba
commit b1edc2722d
2 changed files with 11 additions and 22 deletions
+5 -11
View File
@@ -45,6 +45,7 @@ update_deb_based() {
mv /opt/gatus/config/config.yaml /opt
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "gatus" "TwiN/gatus" "tarball"
GO_VERSION="$(grep -m1 '^go ' /opt/gatus/go.mod | awk '{print $2}')" setup_go
msg_info "Updating Gatus"
cd /opt/gatus
@@ -66,27 +67,20 @@ update_alpine() {
msg_error "No ${APP} Installation Found!"
exit
fi
RELEASE=$(curl -s https://api.github.com/repos/TwiN/gatus/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
if [ "${RELEASE}" != "$(cat /opt/gatus_version.txt)" ] || [ ! -f /opt/gatus_version.txt ]; then
msg_info "Updating ${APP} LXC"
if check_for_gh_release "gatus" "TwiN/gatus"; then
msg_info "Updating ${APP}"
$STD apk -U upgrade
$STD service gatus stop
mv /opt/gatus/config/config.yaml /opt
rm -rf /opt/gatus/*
temp_file=$(mktemp)
curl -fsSL "https://github.com/TwiN/gatus/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
tar zxf "$temp_file" --strip-components=1 -C /opt/gatus
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "gatus" "TwiN/gatus" "tarball"
cd /opt/gatus
$STD go get golang.org/x/net@v0.55.0
$STD go mod tidy
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o gatus .
setcap CAP_NET_RAW+ep gatus
mv /opt/config.yaml config
rm -f "$temp_file"
echo "${RELEASE}" >/opt/gatus_version.txt
$STD service gatus start
msg_ok "Updated successfully!"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
}
+6 -11
View File
@@ -20,8 +20,8 @@ setup_deb_based() {
libcap2-bin
msg_ok "Installed Dependencies"
setup_go
fetch_and_deploy_gh_release "gatus" "TwiN/gatus" "tarball"
GO_VERSION="$(grep -m1 '^go ' /opt/gatus/go.mod | awk '{print $2}')" setup_go
msg_info "Configuring gatus"
cd /opt/gatus
@@ -59,19 +59,16 @@ setup_alpine() {
$STD apk add --no-cache --repository=https://dl-cdn.alpinelinux.org/alpine/edge/community go
msg_ok "Installed dependencies"
RELEASE=$(curl -s https://api.github.com/repos/TwiN/gatus/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
msg_info "Installing gatus v${RELEASE}"
temp_file=$(mktemp)
mkdir -p /opt/gatus
curl -fsSL "https://github.com/TwiN/gatus/archive/refs/tags/v${RELEASE}.tar.gz" -o "$temp_file"
tar zxf "$temp_file" --strip-components=1 -C /opt/gatus
fetch_and_deploy_gh_release "gatus" "TwiN/gatus" "tarball"
msg_info "Configuring gatus"
cd /opt/gatus
$STD go get golang.org/x/net@v0.55.0
$STD go mod tidy
CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o gatus .
setcap CAP_NET_RAW+ep gatus
mv config.yaml config
echo "${RELEASE}" >/opt/gatus_version.txt
msg_ok "Installed gatus v${RELEASE}"
msg_ok "Configured gatus"
msg_info "Enabling gatus Service"
cat <<EOF >/etc/init.d/gatus
@@ -99,8 +96,6 @@ EOF
msg_info "Starting gatus"
$STD service gatus start
msg_ok "Started gatus"
rm -f "$temp_file"
}
run_os_setup