Refactor: Traefik (#6940)
* Refactor * typo --------- Co-authored-by: Tobias <96661824+CrazyWolf13@users.noreply.github.com>
This commit is contained in:
parent
296f4577d0
commit
9aafb65a98
@ -27,16 +27,20 @@ function update_script() {
|
||||
msg_error "No ${APP} Installation Found!"
|
||||
exit
|
||||
fi
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/traefik/traefik/releases | grep -oP '"tag_name":\s*"v\K[\d.]+?(?=")' | sort -V | tail -n 1)
|
||||
msg_info "Updating $APP LXC"
|
||||
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
|
||||
curl -fsSL "https://github.com/traefik/traefik/releases/download/v${RELEASE}/traefik_v${RELEASE}_linux_amd64.tar.gz" -o $(basename "https://github.com/traefik/traefik/releases/download/v${RELEASE}/traefik_v${RELEASE}_linux_amd64.tar.gz")
|
||||
tar -C /tmp -xzf traefik*.tar.gz
|
||||
mv /tmp/traefik /usr/bin/
|
||||
rm -rf traefik*.tar.gz
|
||||
systemctl restart traefik.service
|
||||
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||
msg_ok "Updated $APP LXC"
|
||||
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/traefik/traefik/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
||||
if [[ "${RELEASE}" != "$(cat ~/.traefik)" ]] || [[ ! -f ~/.traefik ]]; then
|
||||
msg_info "Stopping service"
|
||||
systemctl stop traefik
|
||||
msg_ok "Service stopped"
|
||||
|
||||
fetch_and_deploy_gh_release "traefik" "traefik/traefik" "prebuild" "latest" "/usr/bin" "traefik_v*_linux_amd64.tar.gz"
|
||||
|
||||
msg_info "Starting ${APP}"
|
||||
systemctl start traefik
|
||||
msg_ok "Started ${APP}"
|
||||
|
||||
msg_ok "Successfully updated ${APP}"
|
||||
else
|
||||
msg_ok "No update required. ${APP} is already at ${RELEASE}"
|
||||
fi
|
||||
|
@ -9,7 +9,7 @@
|
||||
"updateable": true,
|
||||
"privileged": false,
|
||||
"interface_port": 8080,
|
||||
"documentation": null,
|
||||
"documentation": "https://doc.traefik.io/",
|
||||
"website": "https://traefik.io/",
|
||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/traefik.webp",
|
||||
"config_path": "/etc/traefik/traefik.yaml",
|
||||
|
@ -17,15 +17,8 @@ msg_info "Installing Dependencies"
|
||||
$STD apt-get install -y apt-transport-https
|
||||
msg_ok "Installed Dependencies"
|
||||
|
||||
RELEASE=$(curl -fsSL https://api.github.com/repos/traefik/traefik/releases | grep -oP '"tag_name":\s*"v\K[\d.]+?(?=")' | sort -V | tail -n 1)
|
||||
msg_info "Installing Traefik v${RELEASE}"
|
||||
fetch_and_deploy_gh_release "traefik" "traefik/traefik" "prebuild" "latest" "/usr/bin" "traefik_v*_linux_amd64.tar.gz"
|
||||
mkdir -p /etc/traefik/{conf.d,ssl}
|
||||
curl -fsSL "https://github.com/traefik/traefik/releases/download/v${RELEASE}/traefik_v${RELEASE}_linux_amd64.tar.gz" -o "traefik_v${RELEASE}_linux_amd64.tar.gz"
|
||||
tar -C /tmp -xzf traefik*.tar.gz
|
||||
mv /tmp/traefik /usr/bin/
|
||||
rm -rf traefik*.tar.gz
|
||||
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||
msg_ok "Installed Traefik v${RELEASE}"
|
||||
|
||||
msg_info "Creating Traefik configuration"
|
||||
cat <<EOF >/etc/traefik/traefik.yaml
|
||||
@ -84,7 +77,7 @@ EOF
|
||||
msg_ok "Created Traefik configuration"
|
||||
|
||||
msg_info "Creating Service"
|
||||
cat <<EOF >/etc/systemd/system/traefik.service
|
||||
cat <<'EOF' >/etc/systemd/system/traefik.service
|
||||
[Unit]
|
||||
Description=Traefik is an open-source Edge Router that makes publishing your services a fun and easy experience
|
||||
|
||||
@ -97,7 +90,6 @@ ExecReload=/bin/kill -USR1 \$MAINPID
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
EOF
|
||||
|
||||
systemctl enable -q --now traefik
|
||||
msg_ok "Created Service"
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user