diff --git a/ct/prometheus.sh b/ct/prometheus.sh index 1d9bc1e69e..476acac7a3 100644 --- a/ct/prometheus.sh +++ b/ct/prometheus.sh @@ -28,23 +28,18 @@ function update_script() { exit fi RELEASE=$(curl -fsSL https://api.github.com/repos/prometheus/prometheus/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') - if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + if [[ ! -f ~/.prometheus ]] || [[ "${RELEASE}" != "$(cat ~/.prometheus 2>/dev/null)" ]]; then msg_info "Stopping ${APP}" systemctl stop prometheus msg_ok "Stopped ${APP}" - msg_info "Updating ${APP} to v${RELEASE}" - cd /opt - curl -fsSL "https://github.com/prometheus/prometheus/releases/download/v${RELEASE}/prometheus-${RELEASE}.linux-amd64.tar.gz" -o $(basename "https://github.com/prometheus/prometheus/releases/download/v${RELEASE}/prometheus-${RELEASE}.linux-amd64.tar.gz") - tar -xf prometheus-${RELEASE}.linux-amd64.tar.gz - cp -rf prometheus-${RELEASE}.linux-amd64/prometheus prometheus-${RELEASE}.linux-amd64/promtool /usr/local/bin/ - rm -rf prometheus-${RELEASE}.linux-amd64 prometheus-${RELEASE}.linux-amd64.tar.gz - echo "${RELEASE}" >/opt/${APP}_version.txt - msg_ok "Updated ${APP} to v${RELEASE}" + fetch_and_deploy_gh_release "prometheus" "prometheus/prometheus" "prebuild" "latest" "/usr/local/bin" "*linux-amd64.tar.gz" + rm -f /usr/local/bin/prometheus.yml msg_info "Starting ${APP}" systemctl start prometheus msg_ok "Started ${APP}" + msg_ok "Updated Successfully" else msg_ok "No update required. ${APP} is already at v${RELEASE}" diff --git a/frontend/public/json/prometheus.json b/frontend/public/json/prometheus.json index 8b38ffdd3f..4e342ea297 100644 --- a/frontend/public/json/prometheus.json +++ b/frontend/public/json/prometheus.json @@ -9,7 +9,7 @@ "updateable": true, "privileged": false, "interface_port": 9090, - "documentation": null, + "documentation": "https://prometheus.io/docs/introduction/overview/", "website": "https://prometheus.io/", "logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/prometheus.webp", "config_path": "/etc/prometheus/prometheus.yml", diff --git a/install/prometheus-install.sh b/install/prometheus-install.sh index 4a7eccecb2..afbaa7ba0b 100644 --- a/install/prometheus-install.sh +++ b/install/prometheus-install.sh @@ -13,19 +13,17 @@ setting_up_container network_check update_os +fetch_and_deploy_gh_release "prometheus" "prometheus/prometheus" "prebuild" "latest" "/usr/local/bin" "*linux-amd64.tar.gz" + msg_info "Installing Prometheus" -RELEASE=$(curl -fsSL https://api.github.com/repos/prometheus/prometheus/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') mkdir -p /etc/prometheus mkdir -p /var/lib/prometheus -curl -fsSL "https://github.com/prometheus/prometheus/releases/download/v${RELEASE}/prometheus-${RELEASE}.linux-amd64.tar.gz" -o "prometheus-${RELEASE}.linux-amd64.tar.gz" -tar -xf prometheus-${RELEASE}.linux-amd64.tar.gz -mv prometheus-${RELEASE}.linux-amd64/prometheus prometheus-${RELEASE}.linux-amd64/promtool /usr/local/bin/ -mv prometheus-${RELEASE}.linux-amd64/prometheus.yml /etc/prometheus/prometheus.yml +mv /usr/local/bin/prometheus.yml /etc/prometheus/prometheus.yml echo "${RELEASE}" >/opt/${APPLICATION}_version.txt msg_ok "Installed Prometheus" msg_info "Creating Service" -cat </etc/systemd/system/prometheus.service +cat <<'EOF' >/etc/systemd/system/prometheus.service [Unit] Description=Prometheus Wants=network-online.target @@ -53,5 +51,4 @@ customize msg_info "Cleaning up" $STD apt-get -y autoremove $STD apt-get -y autoclean -rm -rf prometheus-${RELEASE}.linux-amd64 prometheus-${RELEASE}.linux-amd64.tar.gz msg_ok "Cleaned"