From ddfc9ab13f694023ad458b6931ca33eb111f6c54 Mon Sep 17 00:00:00 2001 From: dellthePROgrammer Date: Fri, 5 Sep 2025 09:27:00 -0400 Subject: [PATCH 01/15] Update Traefik install to show available commands --- ct/traefik.sh | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 ct/traefik.sh diff --git a/ct/traefik.sh b/ct/traefik.sh new file mode 100644 index 000000000..fe4d80f92 --- /dev/null +++ b/ct/traefik.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 tteck +# Author: tteck (tteckster) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://traefik.io/ + +APP="Traefik" +var_tags="${var_tags:-proxy}" +var_cpu="${var_cpu:-1}" +var_ram="${var_ram:-512}" +var_disk="${var_disk:-2}" +var_os="${var_os:-debian}" +var_version="${var_version:-12}" +var_unprivileged="${var_unprivileged:-1}" + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -f /etc/systemd/system/traefik.service ]]; then + 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" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:8080${CL}" +echo -e "Commands available are as below:" +echo -e "addsite - creating a config" +echo -e "ensite - enables a config" +echo -e "dissite - disables a config" +echo -e "editsite - edits a config" From c7a7df587e2fe6bebadf1d0da42e5ed8bc162ff4 Mon Sep 17 00:00:00 2001 From: dellthePROgrammer Date: Fri, 5 Sep 2025 09:28:04 -0400 Subject: [PATCH 02/15] Add 4 helper scripts and defaults for cloudflare Adds 4 helper scripts which allow users to quickly create, edit, delete, or disable a site --- install/traefik-install.sh | 263 +++++++++++++++++++++++++++++++++++++ 1 file changed, 263 insertions(+) create mode 100644 install/traefik-install.sh diff --git a/install/traefik-install.sh b/install/traefik-install.sh new file mode 100644 index 000000000..7507a8a85 --- /dev/null +++ b/install/traefik-install.sh @@ -0,0 +1,263 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 tteck +# Author: tteck (tteckster) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://traefik.io/ + +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +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}" +mkdir -p /etc/traefik/{conf.d,ssl,sites-available} +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 </etc/traefik/traefik.yaml +providers: + file: + directory: /etc/traefik/conf.d/ + watch: true + +entryPoints: + web: + address: ':80' + http: + redirections: + entryPoint: + to: websecure + scheme: https + websecure: + address: ':443' + http: + tls: + certResolver: letsencrypt + # Uncomment below if using cloudflare + /* + forwardedHeaders: + trustedIPs: + - 173.245.48.0/20 + - 103.21.244.0/22 + - 103.22.200.0/22 + - 103.31.101.64/22 + - 141.101.64.0/18 + - 108.162.192.0/18 + - 190.93.240.0/20 + - 188.114.96.0/20 + - 197.234.240.0/22 + - 198.41.128.0/17 + - 162.158.0.0/15 + - 104.16.0.0/13 + - 104.16.0.0/13 + - 172.64.0.0/13 + - 131.0.72.0/22 + */ + asDefault: true + traefik: + address: ':8080' + +certificatesResolvers: + letsencrypt: + acme: + email: "foo@bar.com" + storage: /etc/traefik/ssl/acme.json + tlsChallenge: {} + +# Uncomment below if you are using self signed or no certificate +#serversTransport: +# insecureSkipVerify: true + +api: + dashboard: true + insecure: true + +log: + filePath: /var/log/traefik/traefik.log + format: json + level: INFO + +accessLog: + filePath: /var/log/traefik/traefik-access.log + format: json + filters: + statusCodes: + - "200" + - "400-599" + retryAttempts: true + minDuration: "10ms" + bufferingSize: 0 + fields: + headers: + defaultMode: drop + names: + User-Agent: keep +EOF +msg_ok "Created Traefik configuration" + +msg_info "Creating Service" +cat </etc/systemd/system/traefik.service +[Unit] +Description=Traefik is an open-source Edge Router that makes publishing your services a fun and easy experience + +[Service] +Type=notify +ExecStart=/usr/bin/traefik --configFile=/etc/traefik/traefik.yaml +Restart=on-failure +ExecReload=/bin/kill -USR1 \$MAINPID + +[Install] +WantedBy=multi-user.target +EOF + +systemctl enable -q --now traefik +msg_ok "Created Service" + +msg_info "Creating site templates" +cat </etc/traefik/template.yaml.tpl +http: + routers: + ${hostname}: + rule: Host(`${FQDN}`) + service: ${hostname} + tls: + certResolver: letsencrypt + services: + ${hostname}: + loadbalancer: + servers: + - url: "${URL}" +EOF +msg_ok: "Template Created" +msg_info: "Creating Helper Scripts" +cat </usr/bin/addsite +#!/bin/bash + +function setup_site() { + hostname="$(whiptail --inputbox "Enter the hostname of the Site" 8 78 --title "Hostname" 3>&1 1>&2 2>&3)" + exitstatus=$? + [[ "$exitstatus" = 1 ]] && return; + FQDN="$(whiptail --inputbox "Enter the FQDN of the Site" 8 78 --title "FQDN" 3>&1 1>&2 2>&3)" + exitstatus=$? + [[ "$exitstatus" = 1 ]] && return; + URL="$(whiptail --inputbox "Enter the URL of the Site (For example http://192.168.x.x:8080)" 8 78 --title "URL" 3>&1 1>&2 2>&3)" + exitstatus=$? + [[ "$exitstatus" = 1 ]] && return; + filename="/etc/traefik/sites-available/${hostname}.yaml" + export hostname FQDN URL + envsubst '${hostname} ${FQDN} ${URL}' < /etc/traefik/template.yaml.tpl > ${filename} +} + +setup_site +EOF +cat </usr/bin/ensite +#!/bin/bash + +function ensite() { + DIR="/etc/traefik/sites-available" + files=( "$DIR"/* ) + + opts=() + for f in "${files[@]}"; do + name="${f##*/}" + opts+=( "$name" "" ) + done + + choice=$(whiptail \ + --title "Select an entry" \ + --menu "Choose a site" \ + 20 60 12 \ + "${opts[@]}" \ + 3>&1 1>&2 2>&3) + + if [ $? -eq 0 ]; then + ln -s $DIR/$choice /etc/traefik/conf.d + else + return + fi +} + +ensite +EOF +cat </usr/bin/dissite +#!/bin/bash + +function dissite() { + DIR="/etc/traefik/conf.d" + files=( "$DIR"/* ) + + opts=() + for f in "${files[@]}"; do + name="${f##*/}" + opts+=( "$name" "" ) + done + + choice=$(whiptail \ + --title "Select an entry" \ + --menu "Choose a site" \ + 20 60 12 \ + "${opts[@]}" \ + 3>&1 1>&2 2>&3) + + if [ $? -eq 0 ]; then + rm $DIR/$choice + else + return + fi +} + +dissite +EOF + +cat </usr/bin/editsite +#!/bin/bash + +function edit_site() { + DIR="/etc/traefik/sites-available" + files=( "$DIR"/* ) + + opts=() + for f in "${files[@]}"; do + name="${f##*/}" + opts+=( "$name" "" ) + done + + choice=$(whiptail \ + --title "Select an entry" \ + --menu "Choose a site" \ + 20 60 12 \ + "${opts[@]}" \ + 3>&1 1>&2 2>&3) + + if [ $? -eq 0 ]; then + nano $DIR/$choice + else + return + fi +} + +edit_site +EOF +msg_ok "Helper Scripts Created" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" From 3999c0506b956fc569dea33a8949a798aeaa0407 Mon Sep 17 00:00:00 2001 From: dellthePROgrammer Date: Fri, 5 Sep 2025 09:35:40 -0400 Subject: [PATCH 03/15] change source build func to dev branch --- ct/traefik.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/traefik.sh b/ct/traefik.sh index fe4d80f92..6e7f6960c 100644 --- a/ct/traefik.sh +++ b/ct/traefik.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) # Copyright (c) 2021-2025 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE From 655637abfdcc0d5e02fbf2b6fd43b21e1978886b Mon Sep 17 00:00:00 2001 From: dellthePROgrammer Date: Fri, 5 Sep 2025 09:40:37 -0400 Subject: [PATCH 04/15] switch back to VE build --- ct/traefik.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ct/traefik.sh b/ct/traefik.sh index 6e7f6960c..fe4d80f92 100644 --- a/ct/traefik.sh +++ b/ct/traefik.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) # Copyright (c) 2021-2025 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE From d26afc598e65abbd19ad93f318b0e786c58e5281 Mon Sep 17 00:00:00 2001 From: dellthePROgrammer Date: Fri, 5 Sep 2025 09:53:37 -0400 Subject: [PATCH 05/15] ensure you run the install script --- ct/traefik.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ct/traefik.sh b/ct/traefik.sh index fe4d80f92..16342aedf 100644 --- a/ct/traefik.sh +++ b/ct/traefik.sh @@ -47,6 +47,9 @@ start build_container description +msg_info "Installing ${APP} LXC" +pct exec $CTID -- bash -c "curl -fsSL https://raw.githubusercontent.com/dellthePROgrammer/ProxmoxVED/main/install/traefik-install.sh | bash" + msg_ok "Completed Successfully!\n" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}" From aba1417f5810862d322a7d60ee60ddf239e39a5a Mon Sep 17 00:00:00 2001 From: dellthePROgrammer Date: Fri, 5 Sep 2025 10:03:21 -0400 Subject: [PATCH 06/15] Correctly make the files for traefik-install --- ct/traefik.sh | 3 --- install/traefik-install.sh | 10 +++++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/ct/traefik.sh b/ct/traefik.sh index 16342aedf..fe4d80f92 100644 --- a/ct/traefik.sh +++ b/ct/traefik.sh @@ -47,9 +47,6 @@ start build_container description -msg_info "Installing ${APP} LXC" -pct exec $CTID -- bash -c "curl -fsSL https://raw.githubusercontent.com/dellthePROgrammer/ProxmoxVED/main/install/traefik-install.sh | bash" - msg_ok "Completed Successfully!\n" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}" diff --git a/install/traefik-install.sh b/install/traefik-install.sh index 7507a8a85..4e7080a28 100644 --- a/install/traefik-install.sh +++ b/install/traefik-install.sh @@ -128,7 +128,7 @@ systemctl enable -q --now traefik msg_ok "Created Service" msg_info "Creating site templates" -cat </etc/traefik/template.yaml.tpl +cat <<'EOF' >/etc/traefik/template.yaml.tpl http: routers: ${hostname}: @@ -144,7 +144,7 @@ http: EOF msg_ok: "Template Created" msg_info: "Creating Helper Scripts" -cat </usr/bin/addsite +cat <<'EOF' >/usr/bin/addsite #!/bin/bash function setup_site() { @@ -164,7 +164,7 @@ function setup_site() { setup_site EOF -cat </usr/bin/ensite +cat <<'EOF' >/usr/bin/ensite #!/bin/bash function ensite() { @@ -193,7 +193,7 @@ function ensite() { ensite EOF -cat </usr/bin/dissite +cat <<'EOF' >/usr/bin/dissite #!/bin/bash function dissite() { @@ -223,7 +223,7 @@ function dissite() { dissite EOF -cat </usr/bin/editsite +cat <<'EOF' >/usr/bin/editsite #!/bin/bash function edit_site() { From b245c3fb7dfc60192b0005e6d7c63d4b33649344 Mon Sep 17 00:00:00 2001 From: dellthePROgrammer Date: Fri, 5 Sep 2025 10:07:12 -0400 Subject: [PATCH 07/15] ensure install script is run --- ct/traefik.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ct/traefik.sh b/ct/traefik.sh index fe4d80f92..16342aedf 100644 --- a/ct/traefik.sh +++ b/ct/traefik.sh @@ -47,6 +47,9 @@ start build_container description +msg_info "Installing ${APP} LXC" +pct exec $CTID -- bash -c "curl -fsSL https://raw.githubusercontent.com/dellthePROgrammer/ProxmoxVED/main/install/traefik-install.sh | bash" + msg_ok "Completed Successfully!\n" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}" From 25dd721728c651a1bab3165ed06dc95b8bc387f9 Mon Sep 17 00:00:00 2001 From: dellthePROgrammer Date: Fri, 5 Sep 2025 10:13:32 -0400 Subject: [PATCH 08/15] make the build func use my repo temporarily --- ct/traefik.sh | 3 --- misc/build.func | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/ct/traefik.sh b/ct/traefik.sh index 16342aedf..fe4d80f92 100644 --- a/ct/traefik.sh +++ b/ct/traefik.sh @@ -47,9 +47,6 @@ start build_container description -msg_info "Installing ${APP} LXC" -pct exec $CTID -- bash -c "curl -fsSL https://raw.githubusercontent.com/dellthePROgrammer/ProxmoxVED/main/install/traefik-install.sh | bash" - msg_ok "Completed Successfully!\n" echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" echo -e "${INFO}${YW} Access it using the following URL:${CL}" diff --git a/misc/build.func b/misc/build.func index 766aab331..c6439cf94 100644 --- a/misc/build.func +++ b/misc/build.func @@ -1968,7 +1968,7 @@ EOF' fi msg_ok "Customized LXC Container" install_ssh_keys_into_ct - lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/${var_install}.sh)" + lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/dellthePROgrammer/ProxmoxVED/main/install/${var_install}.sh)" } destroy_lxc() { From 38abba69e4344e456dd72b9ff0287c2454f872c2 Mon Sep 17 00:00:00 2001 From: dellthePROgrammer Date: Fri, 5 Sep 2025 10:17:47 -0400 Subject: [PATCH 09/15] change url to match file location --- misc/build.func | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/build.func b/misc/build.func index c6439cf94..7c0ab62f9 100644 --- a/misc/build.func +++ b/misc/build.func @@ -1968,7 +1968,7 @@ EOF' fi msg_ok "Customized LXC Container" install_ssh_keys_into_ct - lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/dellthePROgrammer/ProxmoxVED/main/install/${var_install}.sh)" + lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/dellthePROgrammer/ProxmoxVED/install/${var_install}.sh)" } destroy_lxc() { From 96df5bfc5f4c8ee89c5246f0543f9e1fe6f10927 Mon Sep 17 00:00:00 2001 From: dellthePROgrammer Date: Fri, 5 Sep 2025 10:25:14 -0400 Subject: [PATCH 10/15] correct link again... --- misc/build.func | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/misc/build.func b/misc/build.func index 7c0ab62f9..c6439cf94 100644 --- a/misc/build.func +++ b/misc/build.func @@ -1968,7 +1968,7 @@ EOF' fi msg_ok "Customized LXC Container" install_ssh_keys_into_ct - lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/dellthePROgrammer/ProxmoxVED/install/${var_install}.sh)" + lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/dellthePROgrammer/ProxmoxVED/main/install/${var_install}.sh)" } destroy_lxc() { From 3259a0ea9bbadc0506361b5da53f14fd1eb8783d Mon Sep 17 00:00:00 2001 From: dellthePROgrammer Date: Fri, 5 Sep 2025 10:35:27 -0400 Subject: [PATCH 11/15] look for logs --- ct/traefik.sh | 1 + install/traefik-install.sh | 1 + misc/build.func | 1 + 3 files changed, 3 insertions(+) diff --git a/ct/traefik.sh b/ct/traefik.sh index fe4d80f92..336d26cbb 100644 --- a/ct/traefik.sh +++ b/ct/traefik.sh @@ -44,6 +44,7 @@ function update_script() { } start +set -x build_container description diff --git a/install/traefik-install.sh b/install/traefik-install.sh index 4e7080a28..c42f85660 100644 --- a/install/traefik-install.sh +++ b/install/traefik-install.sh @@ -5,6 +5,7 @@ # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Source: https://traefik.io/ +set -x source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" color verb_ip6 diff --git a/misc/build.func b/misc/build.func index c6439cf94..f9298f65e 100644 --- a/misc/build.func +++ b/misc/build.func @@ -1968,6 +1968,7 @@ EOF' fi msg_ok "Customized LXC Container" install_ssh_keys_into_ct + set -x lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/dellthePROgrammer/ProxmoxVED/main/install/${var_install}.sh)" } From d9838afdfbcd11651549b65ba9104f0c05905444 Mon Sep 17 00:00:00 2001 From: dellthePROgrammer Date: Fri, 5 Sep 2025 10:42:19 -0400 Subject: [PATCH 12/15] fix URL --- ct/traefik.sh | 3 +-- install/traefik-install.sh | 1 - misc/build.func | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/ct/traefik.sh b/ct/traefik.sh index 336d26cbb..0537f0d1d 100644 --- a/ct/traefik.sh +++ b/ct/traefik.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +source <(curl -fsSL https://raw.githubusercontent.com/dellthePROgrammer/ProxmoxVED/main/misc/build.func) # Copyright (c) 2021-2025 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE @@ -44,7 +44,6 @@ function update_script() { } start -set -x build_container description diff --git a/install/traefik-install.sh b/install/traefik-install.sh index c42f85660..4e7080a28 100644 --- a/install/traefik-install.sh +++ b/install/traefik-install.sh @@ -5,7 +5,6 @@ # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE # Source: https://traefik.io/ -set -x source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" color verb_ip6 diff --git a/misc/build.func b/misc/build.func index f9298f65e..c6439cf94 100644 --- a/misc/build.func +++ b/misc/build.func @@ -1968,7 +1968,6 @@ EOF' fi msg_ok "Customized LXC Container" install_ssh_keys_into_ct - set -x lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/dellthePROgrammer/ProxmoxVED/main/install/${var_install}.sh)" } From 74a4d39a055c38a173e28348545e438d658f4374 Mon Sep 17 00:00:00 2001 From: dellthePROgrammer Date: Fri, 5 Sep 2025 10:53:46 -0400 Subject: [PATCH 13/15] update escape values --- install/traefik-install.sh | 78 +++++++++++++++++++------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/install/traefik-install.sh b/install/traefik-install.sh index 4e7080a28..6c2bf6114 100644 --- a/install/traefik-install.sh +++ b/install/traefik-install.sh @@ -124,68 +124,68 @@ ExecReload=/bin/kill -USR1 \$MAINPID WantedBy=multi-user.target EOF -systemctl enable -q --now traefik +systemctl enable traefik.service msg_ok "Created Service" msg_info "Creating site templates" -cat <<'EOF' >/etc/traefik/template.yaml.tpl +cat </etc/traefik/template.yaml.tpl http: routers: - ${hostname}: - rule: Host(`${FQDN}`) - service: ${hostname} + \${hostname}: + rule: Host(`\${FQDN}`) + service: \${hostname} tls: certResolver: letsencrypt services: - ${hostname}: + \${hostname}: loadbalancer: servers: - - url: "${URL}" + - url: "\${URL}" EOF -msg_ok: "Template Created" -msg_info: "Creating Helper Scripts" -cat <<'EOF' >/usr/bin/addsite +msg_ok "Template Created" +msg_info "Creating Helper Scripts" +cat </usr/bin/addsite #!/bin/bash function setup_site() { hostname="$(whiptail --inputbox "Enter the hostname of the Site" 8 78 --title "Hostname" 3>&1 1>&2 2>&3)" exitstatus=$? - [[ "$exitstatus" = 1 ]] && return; + [[ "\$exitstatus" = 1 ]] && return; FQDN="$(whiptail --inputbox "Enter the FQDN of the Site" 8 78 --title "FQDN" 3>&1 1>&2 2>&3)" exitstatus=$? - [[ "$exitstatus" = 1 ]] && return; + [[ "\$exitstatus" = 1 ]] && return; URL="$(whiptail --inputbox "Enter the URL of the Site (For example http://192.168.x.x:8080)" 8 78 --title "URL" 3>&1 1>&2 2>&3)" exitstatus=$? - [[ "$exitstatus" = 1 ]] && return; - filename="/etc/traefik/sites-available/${hostname}.yaml" + [[ "\$exitstatus" = 1 ]] && return; + filename="/etc/traefik/sites-available/\${hostname}.yaml" export hostname FQDN URL - envsubst '${hostname} ${FQDN} ${URL}' < /etc/traefik/template.yaml.tpl > ${filename} + envsubst '\${hostname} \${FQDN} \${URL}' < /etc/traefik/template.yaml.tpl > \${filename} } setup_site EOF -cat <<'EOF' >/usr/bin/ensite +cat </usr/bin/ensite #!/bin/bash function ensite() { DIR="/etc/traefik/sites-available" - files=( "$DIR"/* ) + files=( "\$DIR"/* ) opts=() - for f in "${files[@]}"; do - name="${f##*/}" - opts+=( "$name" "" ) + for f in "\${files[@]}"; do + name="\${f##*/}" + opts+=( "\$name" "" ) done choice=$(whiptail \ --title "Select an entry" \ --menu "Choose a site" \ 20 60 12 \ - "${opts[@]}" \ + "\${opts[@]}" \ 3>&1 1>&2 2>&3) - if [ $? -eq 0 ]; then - ln -s $DIR/$choice /etc/traefik/conf.d + if [ \$? -eq 0 ]; then + ln -s \$DIR/\$choice /etc/traefik/conf.d else return fi @@ -193,28 +193,28 @@ function ensite() { ensite EOF -cat <<'EOF' >/usr/bin/dissite +cat </usr/bin/dissite #!/bin/bash function dissite() { DIR="/etc/traefik/conf.d" - files=( "$DIR"/* ) + files=( "\$DIR"/* ) opts=() - for f in "${files[@]}"; do - name="${f##*/}" - opts+=( "$name" "" ) + for f in "\${files[@]}"; do + name="\${f##*/}" + opts+=( "\$name" "" ) done choice=$(whiptail \ --title "Select an entry" \ --menu "Choose a site" \ 20 60 12 \ - "${opts[@]}" \ + "\${opts[@]}" \ 3>&1 1>&2 2>&3) - if [ $? -eq 0 ]; then - rm $DIR/$choice + if [ \$? -eq 0 ]; then + rm \$DIR/\$choice else return fi @@ -223,28 +223,28 @@ function dissite() { dissite EOF -cat <<'EOF' >/usr/bin/editsite +cat </usr/bin/editsite #!/bin/bash function edit_site() { DIR="/etc/traefik/sites-available" - files=( "$DIR"/* ) + files=( "\$DIR"/* ) opts=() - for f in "${files[@]}"; do - name="${f##*/}" - opts+=( "$name" "" ) + for f in "\${files[@]}"; do + name="\${f##*/}" + opts+=( "\$name" "" ) done choice=$(whiptail \ --title "Select an entry" \ --menu "Choose a site" \ 20 60 12 \ - "${opts[@]}" \ + "\${opts[@]}" \ 3>&1 1>&2 2>&3) - if [ $? -eq 0 ]; then - nano $DIR/$choice + if [ \$? -eq 0 ]; then + nano \$DIR/\$choice else return fi From 967033a180383ed94b1ee7bff85aa0d4484414ff Mon Sep 17 00:00:00 2001 From: dellthePROgrammer Date: Fri, 5 Sep 2025 11:01:14 -0400 Subject: [PATCH 14/15] set permissions for helper scripts --- install/traefik-install.sh | 76 ++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 36 deletions(-) diff --git a/install/traefik-install.sh b/install/traefik-install.sh index 6c2bf6114..d98e808f1 100644 --- a/install/traefik-install.sh +++ b/install/traefik-install.sh @@ -128,64 +128,64 @@ systemctl enable traefik.service msg_ok "Created Service" msg_info "Creating site templates" -cat </etc/traefik/template.yaml.tpl +cat <<'EOF' >/etc/traefik/template.yaml.tpl http: routers: - \${hostname}: - rule: Host(`\${FQDN}`) - service: \${hostname} + ${hostname}: + rule: Host(`${FQDN}`) + service: ${hostname} tls: certResolver: letsencrypt services: - \${hostname}: + ${hostname}: loadbalancer: servers: - - url: "\${URL}" + - url: "${URL}" EOF msg_ok "Template Created" msg_info "Creating Helper Scripts" -cat </usr/bin/addsite +cat <<'EOF' >/usr/bin/addsite #!/bin/bash function setup_site() { hostname="$(whiptail --inputbox "Enter the hostname of the Site" 8 78 --title "Hostname" 3>&1 1>&2 2>&3)" exitstatus=$? - [[ "\$exitstatus" = 1 ]] && return; + [[ "$exitstatus" = 1 ]] && return; FQDN="$(whiptail --inputbox "Enter the FQDN of the Site" 8 78 --title "FQDN" 3>&1 1>&2 2>&3)" exitstatus=$? - [[ "\$exitstatus" = 1 ]] && return; + [[ "$exitstatus" = 1 ]] && return; URL="$(whiptail --inputbox "Enter the URL of the Site (For example http://192.168.x.x:8080)" 8 78 --title "URL" 3>&1 1>&2 2>&3)" exitstatus=$? - [[ "\$exitstatus" = 1 ]] && return; - filename="/etc/traefik/sites-available/\${hostname}.yaml" + [[ "$exitstatus" = 1 ]] && return; + filename="/etc/traefik/sites-available/${hostname}.yaml" export hostname FQDN URL - envsubst '\${hostname} \${FQDN} \${URL}' < /etc/traefik/template.yaml.tpl > \${filename} + envsubst '${hostname} ${FQDN} ${URL}' < /etc/traefik/template.yaml.tpl > ${filename} } setup_site EOF -cat </usr/bin/ensite +cat <<'EOF' >/usr/bin/ensite #!/bin/bash function ensite() { DIR="/etc/traefik/sites-available" - files=( "\$DIR"/* ) + files=( "$DIR"/* ) opts=() - for f in "\${files[@]}"; do - name="\${f##*/}" - opts+=( "\$name" "" ) + for f in "${files[@]}"; do + name="${f##*/}" + opts+=( "$name" "" ) done choice=$(whiptail \ --title "Select an entry" \ --menu "Choose a site" \ 20 60 12 \ - "\${opts[@]}" \ + "${opts[@]}" \ 3>&1 1>&2 2>&3) - if [ \$? -eq 0 ]; then - ln -s \$DIR/\$choice /etc/traefik/conf.d + if [ $? -eq 0 ]; then + ln -s $DIR/$choice /etc/traefik/conf.d else return fi @@ -193,28 +193,28 @@ function ensite() { ensite EOF -cat </usr/bin/dissite +cat <<'EOF' >/usr/bin/dissite #!/bin/bash function dissite() { DIR="/etc/traefik/conf.d" - files=( "\$DIR"/* ) + files=( "$DIR"/* ) opts=() - for f in "\${files[@]}"; do - name="\${f##*/}" - opts+=( "\$name" "" ) + for f in "${files[@]}"; do + name="${f##*/}" + opts+=( "$name" "" ) done choice=$(whiptail \ --title "Select an entry" \ --menu "Choose a site" \ 20 60 12 \ - "\${opts[@]}" \ + "${opts[@]}" \ 3>&1 1>&2 2>&3) - if [ \$? -eq 0 ]; then - rm \$DIR/\$choice + if [ $? -eq 0 ]; then + rm $DIR/$choice else return fi @@ -223,28 +223,28 @@ function dissite() { dissite EOF -cat </usr/bin/editsite +cat <<'EOF' >/usr/bin/editsite #!/bin/bash function edit_site() { DIR="/etc/traefik/sites-available" - files=( "\$DIR"/* ) + files=( "$DIR"/* ) opts=() - for f in "\${files[@]}"; do - name="\${f##*/}" - opts+=( "\$name" "" ) + for f in "${files[@]}"; do + name="${f##*/}" + opts+=( "$name" "" ) done choice=$(whiptail \ --title "Select an entry" \ --menu "Choose a site" \ 20 60 12 \ - "\${opts[@]}" \ + "${opts[@]}" \ 3>&1 1>&2 2>&3) - if [ \$? -eq 0 ]; then - nano \$DIR/\$choice + if [ $? -eq 0 ]; then + nano $DIR/$choice else return fi @@ -252,6 +252,10 @@ function edit_site() { edit_site EOF +chmod +x /usr/bin/addsite +chmod +x /usr/bin/ensite +chmod +x /usr/bin/dissite +chmod +x /usr/bin/editsite msg_ok "Helper Scripts Created" motd_ssh From 35e078bbe09e9ce8cab0fddd725805d846682a25 Mon Sep 17 00:00:00 2001 From: dellthePROgrammer Date: Fri, 5 Sep 2025 11:07:00 -0400 Subject: [PATCH 15/15] fix scripts to work in VED Repo --- ct/traefik.sh | 2 +- misc/build.func | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ct/traefik.sh b/ct/traefik.sh index 0537f0d1d..6e7f6960c 100644 --- a/ct/traefik.sh +++ b/ct/traefik.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -source <(curl -fsSL https://raw.githubusercontent.com/dellthePROgrammer/ProxmoxVED/main/misc/build.func) +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func) # Copyright (c) 2021-2025 tteck # Author: tteck (tteckster) # License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE diff --git a/misc/build.func b/misc/build.func index c6439cf94..766aab331 100644 --- a/misc/build.func +++ b/misc/build.func @@ -1968,7 +1968,7 @@ EOF' fi msg_ok "Customized LXC Container" install_ssh_keys_into_ct - lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/dellthePROgrammer/ProxmoxVED/main/install/${var_install}.sh)" + lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/${var_install}.sh)" } destroy_lxc() {