mirror of https://github.com/tteck/Proxmox.git
				
				
				
			Merge 9673cb7b7a into 612979a040
				
					
				
			This commit is contained in:
		
						commit
						bf22df3d6f
					
				
							
								
								
									
										30
									
								
								ct/zoraxy.sh
								
								
								
								
							
							
						
						
									
										30
									
								
								ct/zoraxy.sh
								
								
								
								
							| 
						 | 
					@ -1,5 +1,5 @@
 | 
				
			||||||
#!/usr/bin/env bash
 | 
					#!/usr/bin/env bash
 | 
				
			||||||
source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func)
 | 
					source <(curl -s https://raw.githubusercontent.com/dsiebel/Proxmox/zoraxy-prebuilt/misc/build.func)
 | 
				
			||||||
# Copyright (c) 2021-2024 tteck
 | 
					# Copyright (c) 2021-2024 tteck
 | 
				
			||||||
# Author: tteck (tteckster)
 | 
					# Author: tteck (tteckster)
 | 
				
			||||||
# License: MIT
 | 
					# License: MIT
 | 
				
			||||||
| 
						 | 
					@ -20,7 +20,7 @@ header_info
 | 
				
			||||||
echo -e "Loading..."
 | 
					echo -e "Loading..."
 | 
				
			||||||
APP="Zoraxy"
 | 
					APP="Zoraxy"
 | 
				
			||||||
var_disk="6"
 | 
					var_disk="6"
 | 
				
			||||||
var_cpu="4"
 | 
					var_cpu="2"
 | 
				
			||||||
var_ram="2048"
 | 
					var_ram="2048"
 | 
				
			||||||
var_os="debian"
 | 
					var_os="debian"
 | 
				
			||||||
var_version="12"
 | 
					var_version="12"
 | 
				
			||||||
| 
						 | 
					@ -54,20 +54,19 @@ function default_settings() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function update_script() {
 | 
					function update_script() {
 | 
				
			||||||
header_info
 | 
					header_info
 | 
				
			||||||
if [[ ! -d /opt/zoraxy/src ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
 | 
					if [[ ! -f /etc/systemd/system/zoraxy.service ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
 | 
				
			||||||
whiptail --backtitle "Proxmox VE Helper Scripts" --msgbox --title "SET RESOURCES" "Please set the resources in your ${APP} LXC to ${var_cpu}vCPU and ${var_ram}RAM for the build process before continuing" 10 75
 | 
					RELEASE="$(curl -s https://api.github.com/repos/tobychui/zoraxy/releases | grep -oP '"tag_name":\s*"\K[\d.]+?(?=")' | sort -V | tail -n1)"
 | 
				
			||||||
msg_info "Updating $APP"
 | 
					msg_info "Updating ${APP} LXC to ${RELEASE}"
 | 
				
			||||||
systemctl stop zoraxy
 | 
					if [[ "${RELEASE}" != "$(cat "/opt/${APP}_version.txt")" ]] || [[ ! -f "/opt/${APP}_version.txt" ]]; then
 | 
				
			||||||
cd /opt/zoraxy/src
 | 
					  wget -q "https://github.com/tobychui/zoraxy/releases/download/${RELEASE}/zoraxy_linux_amd64"
 | 
				
			||||||
systemctl stop zoraxy
 | 
					  install zoraxy_linux_amd64 /usr/bin/zoraxy
 | 
				
			||||||
if git pull | grep -q 'Already up to date.'; then
 | 
					  rm zoraxy_linux_amd64
 | 
				
			||||||
  msg_ok "Already up to date. No update required."
 | 
					  echo "${RELEASE}" > "/opt/${APP}_version.txt"
 | 
				
			||||||
 | 
					  systemctl restart traefik.service
 | 
				
			||||||
 | 
					  msg_ok "Updated ${APP} LXC"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
  go mod tidy
 | 
					  msg_ok "No update required. ${APP} is already at ${RELEASE}"
 | 
				
			||||||
  go build
 | 
					 | 
				
			||||||
  msg_ok "Updated $APP"
 | 
					 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
systemctl start zoraxy
 | 
					 | 
				
			||||||
exit
 | 
					exit
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -75,9 +74,6 @@ start
 | 
				
			||||||
build_container
 | 
					build_container
 | 
				
			||||||
description
 | 
					description
 | 
				
			||||||
 | 
					
 | 
				
			||||||
msg_info "Setting Container to Normal Resources"
 | 
					 | 
				
			||||||
pct set $CTID -cores 2
 | 
					 | 
				
			||||||
msg_ok "Set Container to Normal Resources"
 | 
					 | 
				
			||||||
msg_ok "Completed Successfully!\n"
 | 
					msg_ok "Completed Successfully!\n"
 | 
				
			||||||
echo -e "${APP} should be reachable by going to the following URL.
 | 
					echo -e "${APP} should be reachable by going to the following URL.
 | 
				
			||||||
         ${BL}http://${IP}:8000${CL} \n"
 | 
					         ${BL}http://${IP}:8000${CL} \n"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -20,20 +20,11 @@ $STD apt-get install -y mc
 | 
				
			||||||
$STD apt-get install -y git
 | 
					$STD apt-get install -y git
 | 
				
			||||||
msg_ok "Installed Dependencies"
 | 
					msg_ok "Installed Dependencies"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
msg_info "Installing Golang"
 | 
					RELEASE="$(curl -s https://api.github.com/repos/tobychui/zoraxy/releases | grep -oP '"tag_name":\s*"\K[\d.]+?(?=")' | sort -V | tail -n1)"
 | 
				
			||||||
set +o pipefail
 | 
					msg_info "Installing Zoraxy v${RELEASE}"
 | 
				
			||||||
RELEASE=$(curl -s https://go.dev/dl/ | grep -o "go.*\linux-amd64.tar.gz" | head -n 1)
 | 
					wget -q "https://github.com/tobychui/zoraxy/releases/download/${RELEASE}/zoraxy_linux_amd64"
 | 
				
			||||||
wget -q https://golang.org/dl/$RELEASE
 | 
					install zoraxy_linux_amd64 /usr/bin/zoraxy
 | 
				
			||||||
$STD tar -xzf $RELEASE -C /usr/local
 | 
					echo "${RELEASE}" > "/opt/${APPLICATION}_version.txt"
 | 
				
			||||||
$STD ln -s /usr/local/go/bin/go /usr/local/bin/go
 | 
					 | 
				
			||||||
set -o pipefail
 | 
					 | 
				
			||||||
msg_ok "Installed Golang"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
msg_info "Installing Zoraxy (Patience)"
 | 
					 | 
				
			||||||
$STD git clone https://github.com/tobychui/zoraxy /opt/zoraxy
 | 
					 | 
				
			||||||
cd /opt/zoraxy/src
 | 
					 | 
				
			||||||
$STD go mod tidy
 | 
					 | 
				
			||||||
$STD go build
 | 
					 | 
				
			||||||
msg_ok "Installed Zoraxy"
 | 
					msg_ok "Installed Zoraxy"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
msg_info "Creating Service"
 | 
					msg_info "Creating Service"
 | 
				
			||||||
| 
						 | 
					@ -43,8 +34,7 @@ Description=General purpose request proxy and forwarding tool
 | 
				
			||||||
After=syslog.target network-online.target
 | 
					After=syslog.target network-online.target
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Service]
 | 
					[Service]
 | 
				
			||||||
ExecStart=/opt/zoraxy/src/./zoraxy
 | 
					ExecStart=/usr/bin/zoraxy
 | 
				
			||||||
WorkingDirectory=/opt/zoraxy/src/
 | 
					 | 
				
			||||||
Restart=always
 | 
					Restart=always
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[Install]
 | 
					[Install]
 | 
				
			||||||
| 
						 | 
					@ -57,7 +47,6 @@ motd_ssh
 | 
				
			||||||
customize
 | 
					customize
 | 
				
			||||||
 | 
					
 | 
				
			||||||
msg_info "Cleaning up"
 | 
					msg_info "Cleaning up"
 | 
				
			||||||
rm -rf $RELEASE
 | 
					 | 
				
			||||||
$STD apt-get -y autoremove
 | 
					$STD apt-get -y autoremove
 | 
				
			||||||
$STD apt-get -y autoclean
 | 
					$STD apt-get -y autoclean
 | 
				
			||||||
msg_ok "Cleaned"
 | 
					msg_ok "Cleaned"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -537,9 +537,9 @@ build_container() {
 | 
				
			||||||
  TEMP_DIR=$(mktemp -d)
 | 
					  TEMP_DIR=$(mktemp -d)
 | 
				
			||||||
  pushd $TEMP_DIR >/dev/null
 | 
					  pushd $TEMP_DIR >/dev/null
 | 
				
			||||||
  if [ "$var_os" == "alpine" ]; then
 | 
					  if [ "$var_os" == "alpine" ]; then
 | 
				
			||||||
    export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/alpine-install.func)"
 | 
					    export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/dsiebel/Proxmox/zoraxy-prebuilt/misc/alpine-install.func)"
 | 
				
			||||||
  else
 | 
					  else
 | 
				
			||||||
    export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/install.func)"
 | 
					    export FUNCTIONS_FILE_PATH="$(curl -s https://raw.githubusercontent.com/dsiebel/Proxmox/zoraxy-prebuilt/misc/install.func)"
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
  export CACHER="$APT_CACHER"
 | 
					  export CACHER="$APT_CACHER"
 | 
				
			||||||
  export CACHER_IP="$APT_CACHER_IP"
 | 
					  export CACHER_IP="$APT_CACHER_IP"
 | 
				
			||||||
| 
						 | 
					@ -569,7 +569,7 @@ build_container() {
 | 
				
			||||||
    $PW
 | 
					    $PW
 | 
				
			||||||
  "
 | 
					  "
 | 
				
			||||||
  # This executes create_lxc.sh and creates the container and .conf file
 | 
					  # This executes create_lxc.sh and creates the container and .conf file
 | 
				
			||||||
  bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/ct/create_lxc.sh)" || exit
 | 
					  bash -c "$(wget -qLO - https://raw.githubusercontent.com/dsiebel/Proxmox/zoraxy-prebuilt/ct/create_lxc.sh)" || exit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
 | 
					  LXC_CONFIG=/etc/pve/lxc/${CTID}.conf
 | 
				
			||||||
  if [ "$CT_TYPE" == "0" ]; then
 | 
					  if [ "$CT_TYPE" == "0" ]; then
 | 
				
			||||||
| 
						 | 
					@ -633,7 +633,7 @@ http://dl-cdn.alpinelinux.org/alpine/latest-stable/community
 | 
				
			||||||
EOF'
 | 
					EOF'
 | 
				
			||||||
    pct exec "$CTID" -- ash -c "apk add bash >/dev/null"
 | 
					    pct exec "$CTID" -- ash -c "apk add bash >/dev/null"
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
  lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/tteck/Proxmox/main/install/$var_install.sh)" || exit
 | 
					  lxc-attach -n "$CTID" -- bash -c "$(wget -qLO - https://raw.githubusercontent.com/dsiebel/Proxmox/zoraxy-prebuilt/install/$var_install.sh)" || exit
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue