Merge branch 'main' of https://github.com/community-scripts/ProxmoxVED
This commit is contained in:
commit
840a667720
@ -1,105 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/misc/build.func)
|
|
||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
|
||||||
# Author: CrazyWolf13
|
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
||||||
# Source: https://github.com/RayLabsHQ/gitea-mirror
|
|
||||||
|
|
||||||
APP="gitea-mirror"
|
|
||||||
var_tags="${var_tags:-mirror;gitea}"
|
|
||||||
var_cpu="${var_cpu:-2}"
|
|
||||||
var_ram="${var_ram:-2048}"
|
|
||||||
var_disk="${var_disk:-6}"
|
|
||||||
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 [[ ! -d /opt/gitea-mirror ]]; then
|
|
||||||
msg_error "No ${APP} Installation Found!"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
APP_VERSION=$(grep -o '"version": *"[^"]*"' /opt/gitea-mirror/package.json | cut -d'"' -f4)
|
|
||||||
if [[ $APP_VERSION =~ ^2\. ]]; then
|
|
||||||
if ! whiptail --backtitle "Gitea Mirror Update" --title "⚠️ VERSION 2.x DETECTED" --yesno \
|
|
||||||
"WARNING: Version $APP_VERSION detected!\n\nUpdating from version 2.x will CLEAR ALL CONFIGURATION.\n\nThis includes:\n• API tokens\n• User settings\n• Repository configurations\n• All custom settings\n\nDo you want to continue with the update process?" 15 70 --defaultno
|
|
||||||
then
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! whiptail --backtitle "Gitea Mirror Update" --title "⚠️ FINAL CONFIRMATION" --yesno \
|
|
||||||
"FINAL WARNING: This update WILL clear all configuration!\n\nBEFORE PROCEEDING, please:\n\n• Copy API tokens to a safe location\n• Backup any custom configurations\n• Note down repository settings\n\nThis action CANNOT be undone!" 18 70 --defaultno
|
|
||||||
then
|
|
||||||
whiptail --backtitle "Gitea Mirror Update" --title "Update Cancelled" --msgbox "Update process cancelled. Please backup your configuration before proceeding." 8 60
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
whiptail --backtitle "Gitea Mirror Update" --title "Proceeding with Update" --msgbox \
|
|
||||||
"Proceeding with version $APP_VERSION update.\n\nAll configuration will be cleared as warned." 8 50
|
|
||||||
rm -rf /opt/gitea-mirror
|
|
||||||
fi
|
|
||||||
|
|
||||||
RELEASE=$(curl -fsSL https://api.github.com/repos/RayLabsHQ/gitea-mirror/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }')
|
|
||||||
if [[ "${RELEASE}" != "$(cat ~/.${APP} 2>/dev/null || cat /opt/${APP}_version.txt 2>/dev/null)" ]]; then
|
|
||||||
|
|
||||||
msg_info "Stopping Services"
|
|
||||||
systemctl stop gitea-mirror
|
|
||||||
msg_ok "Services Stopped"
|
|
||||||
|
|
||||||
if [[ -d /opt/gitea-mirror/data ]]; then
|
|
||||||
msg_info "Backing up Data"
|
|
||||||
mkdir -p /opt/gitea-mirror-backup/data
|
|
||||||
cp /opt/gitea-mirror/data/* /opt/gitea-mirror-backup/data/
|
|
||||||
msg_ok "Backed up Data"
|
|
||||||
fi
|
|
||||||
|
|
||||||
msg_info "Installing Bun"
|
|
||||||
export BUN_INSTALL=/opt/bun
|
|
||||||
curl -fsSL https://bun.sh/install | $STD bash
|
|
||||||
ln -sf /opt/bun/bin/bun /usr/local/bin/bun
|
|
||||||
ln -sf /opt/bun/bin/bun /usr/local/bin/bunx
|
|
||||||
msg_ok "Installed Bun"
|
|
||||||
|
|
||||||
rm -rf /opt/gitea-mirror
|
|
||||||
fetch_and_deploy_gh_release "gitea-mirror" "RayLabsHQ/gitea-mirror" "tarball" "v3.0.2"
|
|
||||||
|
|
||||||
msg_info "Updating and rebuilding ${APP} to v${RELEASE}"
|
|
||||||
cd /opt/gitea-mirror
|
|
||||||
$STD bun run setup
|
|
||||||
$STD bun run build
|
|
||||||
APP_VERSION=$(grep -o '"version": *"[^"]*"' package.json | cut -d'"' -f4)
|
|
||||||
sudo sed -i.bak "s|^Environment=npm_package_version=.*|Environment=npm_package_version=${APP_VERSION}|" /etc/systemd/system/gitea-mirror.service
|
|
||||||
msg_ok "Updated and rebuilt ${APP} to v${RELEASE}"
|
|
||||||
|
|
||||||
msg_info "Restoring Data"
|
|
||||||
cp /opt/gitea-mirror-backup/data/* /opt/gitea-mirror/data || true
|
|
||||||
msg_ok "Restored Data"
|
|
||||||
|
|
||||||
msg_info "Starting Service"
|
|
||||||
systemctl daemon-reload
|
|
||||||
systemctl start gitea-mirror
|
|
||||||
msg_ok "Service Started"
|
|
||||||
else
|
|
||||||
msg_ok "No update required. ${APP} is already at v${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}:4321${CL}"
|
|
@ -1,6 +0,0 @@
|
|||||||
_ __ _
|
|
||||||
____ _(_) /____ ____ _ ____ ___ (_)_____________ _____
|
|
||||||
/ __ `/ / __/ _ \/ __ `/_____/ __ `__ \/ / ___/ ___/ __ \/ ___/
|
|
||||||
/ /_/ / / /_/ __/ /_/ /_____/ / / / / / / / / / / /_/ / /
|
|
||||||
\__, /_/\__/\___/\__,_/ /_/ /_/ /_/_/_/ /_/ \____/_/
|
|
||||||
/____/
|
|
6
ct/headers/traefik
Normal file
6
ct/headers/traefik
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
______ _____ __
|
||||||
|
/_ __/________ ____ / __(_) /__
|
||||||
|
/ / / ___/ __ `/ _ \/ /_/ / //_/
|
||||||
|
/ / / / / /_/ / __/ __/ / ,<
|
||||||
|
/_/ /_/ \__,_/\___/_/ /_/_/|_|
|
||||||
|
|
1
ct/tracktor.sh
Normal file
1
ct/tracktor.sh
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
58
ct/traefik.sh
Normal file
58
ct/traefik.sh
Normal file
@ -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"
|
@ -1,35 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "Gitea-Mirror",
|
|
||||||
"slug": "gitea-mirror",
|
|
||||||
"categories": [
|
|
||||||
7
|
|
||||||
],
|
|
||||||
"date_created": "2025-06-05",
|
|
||||||
"type": "ct",
|
|
||||||
"updateable": true,
|
|
||||||
"privileged": false,
|
|
||||||
"interface_port": 4321,
|
|
||||||
"documentation": "https://github.com/arunavo4/gitea-mirror/",
|
|
||||||
"config_path": "/etc/systemd/system/gitea-mirror.service",
|
|
||||||
"website": "https://github.com/arunavo4/gitea-mirror/",
|
|
||||||
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/gitea-mirror.webp",
|
|
||||||
"description": "Gitea Mirror auto-syncs GitHub repos to your self-hosted Gitea, with a sleek Web UI and easy Docker deployment. ",
|
|
||||||
"install_methods": [
|
|
||||||
{
|
|
||||||
"type": "default",
|
|
||||||
"script": "ct/gitea-mirror.sh",
|
|
||||||
"resources": {
|
|
||||||
"cpu": 2,
|
|
||||||
"ram": 2048,
|
|
||||||
"hdd": 6,
|
|
||||||
"os": "Debian",
|
|
||||||
"version": "12"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"default_credentials": {
|
|
||||||
"username": null,
|
|
||||||
"password": null
|
|
||||||
},
|
|
||||||
"notes": []
|
|
||||||
}
|
|
35
frontend/public/json/tracktor.json
Normal file
35
frontend/public/json/tracktor.json
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
{
|
||||||
|
"name": "Tracktor",
|
||||||
|
"slug": "tracktor",
|
||||||
|
"categories": [
|
||||||
|
9
|
||||||
|
],
|
||||||
|
"date_created": "2025-08-06",
|
||||||
|
"type": "ct",
|
||||||
|
"updateable": true,
|
||||||
|
"privileged": false,
|
||||||
|
"interface_port": 5173,
|
||||||
|
"documentation": "https://tracktor.bytedge.in/introduction.html",
|
||||||
|
"config_path": "/etc/system/systemd/tracktor.service",
|
||||||
|
"website": "https://tracktor.bytedge.in/",
|
||||||
|
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/svg/tracktor.svg",
|
||||||
|
"description": "Tracktor is an open-source web application for comprehensive vehicle management.\nEasily track ⛽ fuel consumption, 🛠️ maintenance, 🛡️ insurance, and 📄 regulatory documents for all your vehicles in one place. ",
|
||||||
|
"install_methods": [
|
||||||
|
{
|
||||||
|
"type": "default",
|
||||||
|
"script": "ct/tracktor.sh",
|
||||||
|
"resources": {
|
||||||
|
"cpu": 1,
|
||||||
|
"ram": 1024,
|
||||||
|
"hdd": 6,
|
||||||
|
"os": "Debian",
|
||||||
|
"version": "12"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"default_credentials": {
|
||||||
|
"username": null,
|
||||||
|
"password": null
|
||||||
|
},
|
||||||
|
"notes": []
|
||||||
|
}
|
@ -1,70 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Copyright (c) 2021-2025 community-scripts ORG
|
|
||||||
# Author: CrazyWolf13
|
|
||||||
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
||||||
# Source: https://github.com/RayLabsHQ/gitea-mirror
|
|
||||||
|
|
||||||
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 \
|
|
||||||
build-essential \
|
|
||||||
openssl \
|
|
||||||
sqlite3 \
|
|
||||||
unzip
|
|
||||||
msg_ok "Installed Dependencies"
|
|
||||||
|
|
||||||
msg_info "Installing Bun"
|
|
||||||
export BUN_INSTALL=/opt/bun
|
|
||||||
curl -fsSL https://bun.sh/install | $STD bash
|
|
||||||
ln -sf /opt/bun/bin/bun /usr/local/bin/bun
|
|
||||||
ln -sf /opt/bun/bin/bun /usr/local/bin/bunx
|
|
||||||
msg_ok "Installed Bun"
|
|
||||||
|
|
||||||
fetch_and_deploy_gh_release "gitea-mirror" "RayLabsHQ/gitea-mirror" "tarball" "v3.0.2"
|
|
||||||
|
|
||||||
msg_info "Installing gitea-mirror"
|
|
||||||
cd /opt/gitea-mirror
|
|
||||||
$STD bun run setup
|
|
||||||
$STD bun run build
|
|
||||||
msg_ok "Installed gitea-mirror"
|
|
||||||
|
|
||||||
msg_info "Creating Services"
|
|
||||||
JWT_SECRET=$(openssl rand -hex 32)
|
|
||||||
APP_VERSION=$(grep -o '"version": *"[^"]*"' package.json | cut -d'"' -f4)
|
|
||||||
cat <<EOF >/etc/systemd/system/gitea-mirror.service
|
|
||||||
[Unit]
|
|
||||||
Description=Gitea Mirror
|
|
||||||
After=network.target
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
WorkingDirectory=/opt/gitea-mirror
|
|
||||||
ExecStart=/usr/local/bin/bun dist/server/entry.mjs
|
|
||||||
Restart=on-failure
|
|
||||||
RestartSec=10
|
|
||||||
Environment=NODE_ENV=production
|
|
||||||
Environment=HOST=0.0.0.0
|
|
||||||
Environment=PORT=4321
|
|
||||||
Environment=DATABASE_URL=file:/opt/gitea-mirror/data/gitea-mirror.db
|
|
||||||
Environment=JWT_SECRET=${JWT_SECRET}
|
|
||||||
Environment=npm_package_version=${APP_VERSION}
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
EOF
|
|
||||||
systemctl enable -q --now gitea-mirror
|
|
||||||
msg_ok "Created Service"
|
|
||||||
|
|
||||||
motd_ssh
|
|
||||||
customize
|
|
||||||
|
|
||||||
msg_info "Cleaning up"
|
|
||||||
$STD apt-get -y autoremove
|
|
||||||
$STD apt-get -y autoclean
|
|
||||||
msg_ok "Cleaned"
|
|
1
install/tracktor-install.sh
Normal file
1
install/tracktor-install.sh
Normal file
@ -0,0 +1 @@
|
|||||||
|
|
263
install/traefik-install.sh
Normal file
263
install/traefik-install.sh
Normal file
@ -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 <<EOF >/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 <<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
|
||||||
|
|
||||||
|
[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 <<EOF >/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 <<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;
|
||||||
|
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 <<EOF >/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 <<EOF >/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 <<EOF >/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"
|
6
tools/headers/copyparty
Normal file
6
tools/headers/copyparty
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
______ ____ __
|
||||||
|
/ ____/___ ____ __ __/ __ \____ ______/ /___ __
|
||||||
|
/ / / __ \/ __ \/ / / / /_/ / __ `/ ___/ __/ / / /
|
||||||
|
/ /___/ /_/ / /_/ / /_/ / ____/ /_/ / / / /_/ /_/ /
|
||||||
|
\____/\____/ .___/\__, /_/ \__,_/_/ \__/\__, /
|
||||||
|
/_/ /____/ /____/
|
84
tools/pve/execute.sh
Normal file
84
tools/pve/execute.sh
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
|
# Author: jeroenzwart
|
||||||
|
# License: MIT
|
||||||
|
# https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
|
||||||
|
function header_info() {
|
||||||
|
clear
|
||||||
|
cat <<"EOF"
|
||||||
|
______ __ __ _ ________
|
||||||
|
/ ____/ _____ _______ __/ /____ / / | |/ / ____/
|
||||||
|
/ __/ | |/_/ _ \/ ___/ / / / __/ _ \ / / | / /
|
||||||
|
/ /____> </ __/ /__/ /_/ / /_/ __/ / /___/ / /___
|
||||||
|
/_____/_/|_|\___/\___/\__,_/\__/\___/ /_____/_/|_\____/
|
||||||
|
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
set -eEuo pipefail
|
||||||
|
BL=$(echo "\033[36m")
|
||||||
|
RD=$(echo "\033[01;31m")
|
||||||
|
CM='\xE2\x9C\x94\033'
|
||||||
|
GN=$(echo "\033[1;92m")
|
||||||
|
CL=$(echo "\033[m")
|
||||||
|
header_info
|
||||||
|
echo "Loading..."
|
||||||
|
whiptail --backtitle "Proxmox VE Helper Scripts" --title "Proxmox VE LXC Execute" --yesno "This will execute a command inside selected LXC Containers. Proceed?" 10 58
|
||||||
|
NODE=$(hostname)
|
||||||
|
EXCLUDE_MENU=()
|
||||||
|
MSG_MAX_LENGTH=0
|
||||||
|
while read -r TAG ITEM; do
|
||||||
|
OFFSET=2
|
||||||
|
((${#ITEM} + OFFSET > MSG_MAX_LENGTH)) && MSG_MAX_LENGTH=${#ITEM}+OFFSET
|
||||||
|
EXCLUDE_MENU+=("$TAG" "$ITEM " "OFF")
|
||||||
|
done < <(pct list | awk 'NR>1')
|
||||||
|
excluded_containers=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Containers on $NODE" --checklist "\nSelect containers to skip from executing:\n" \
|
||||||
|
16 $((MSG_MAX_LENGTH + 23)) 6 "${EXCLUDE_MENU[@]}" 3>&1 1>&2 2>&3 | tr -d '"')
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
read -r -p "Enter here command for inside the containers: " custom_command
|
||||||
|
|
||||||
|
header_info
|
||||||
|
echo "One moment please...\n"
|
||||||
|
|
||||||
|
function execute_in() {
|
||||||
|
container=$1
|
||||||
|
name=$(pct exec "$container" hostname)
|
||||||
|
echo -e "${BL}[Info]${GN} Execute inside${BL} ${name}${GN} with output: ${CL}"
|
||||||
|
pct exec "$container" -- bash -c "${custom_command}" | tee
|
||||||
|
}
|
||||||
|
|
||||||
|
for container in $(pct list | awk '{if(NR>1) print $1}'); do
|
||||||
|
if [[ " ${excluded_containers[@]} " =~ " $container " ]]; then
|
||||||
|
echo -e "${BL}[Info]${GN} Skipping ${BL}$container${CL}"
|
||||||
|
else
|
||||||
|
os=$(pct config "$container" | awk '/^ostype/ {print $2}')
|
||||||
|
if [ "$os" != "debian" ] && [ "$os" != "ubuntu" ]; then
|
||||||
|
echo -e "${BL}[Info]${GN} Skipping ${name} ${RD}$container is not Debian or Ubuntu ${CL}"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
status=$(pct status "$container")
|
||||||
|
template=$(pct config "$container" | grep -q "template:" && echo "true" || echo "false")
|
||||||
|
if [ "$template" == "false" ] && [ "$status" == "status: stopped" ]; then
|
||||||
|
echo -e "${BL}[Info]${GN} Starting${BL} $container ${CL}"
|
||||||
|
pct start "$container"
|
||||||
|
echo -e "${BL}[Info]${GN} Waiting For${BL} $container${CL}${GN} To Start ${CL}"
|
||||||
|
sleep 5
|
||||||
|
execute_in "$container"
|
||||||
|
echo -e "${BL}[Info]${GN} Shutting down${BL} $container ${CL}"
|
||||||
|
pct shutdown "$container" &
|
||||||
|
elif [ "$status" == "status: running" ]; then
|
||||||
|
execute_in "$container"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
wait
|
||||||
|
|
||||||
|
echo -e "${GN} Finished, execute command inside selected containers. ${CL} \n"
|
Loading…
x
Reference in New Issue
Block a user