mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-09-07 22:36:45 +00:00
setup_go with no GO_VERSION resolves to whatever go.dev currently serves, so every Go app was built against a moving target. When 1.27 landed it broke wanderer outright (#16909): PocketBase pins go 1.25.0 and stack-overflows at startup when built with anything newer. Two problems, both fixed here: setup_go ran before the source was fetched in all 15 install scripts, so the pin could not be read even if someone wanted one. It now runs after the fetch and reads the version out of go.mod. 13 ct/ scripts rebuild with go during update. Eleven never called setup_go at all and rebuilt with whatever the container happened to have; the other two called it before the fetch. All 13 now use the same call as their installer, verified identical string for string. caddy is left alone: xcaddy fetches the Caddy source itself, so there is no local go.mod to read, and it already pins deliberately. wanderer is in #16976.
85 lines
2.7 KiB
Bash
85 lines
2.7 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# Copyright (c) 2021-2026 community-scripts ORG
|
|
# Author: MickLesk (CanbiZ)
|
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
|
# Source: https://github.com/Ozark-Connect/NetworkOptimizer
|
|
|
|
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
|
|
color
|
|
verb_ip6
|
|
catch_errors
|
|
setting_up_container
|
|
network_check
|
|
update_os
|
|
|
|
msg_info "Installing Dependencies"
|
|
echo "iperf3 iperf3/start_daemon boolean false" | debconf-set-selections
|
|
DEBIAN_FRONTEND=noninteractive $STD apt install -y \
|
|
git \
|
|
sshpass \
|
|
iperf3
|
|
setup_deb822_repo \
|
|
"microsoft" \
|
|
"https://packages.microsoft.com/keys/microsoft-2025.asc" \
|
|
"https://packages.microsoft.com/debian/13/prod/" \
|
|
"trixie"
|
|
$STD apt install -y dotnet-sdk-10.0
|
|
msg_ok "Installed Dependencies"
|
|
|
|
|
|
fetch_and_deploy_gh_release "networkoptimizer" "Ozark-Connect/NetworkOptimizer" "tarball"
|
|
GO_VERSION="$(grep -m1 '^go ' /opt/networkoptimizer/src/uwnspeedtest/go.mod | awk '{print $2}')" setup_go
|
|
|
|
msg_info "Building NetworkOptimizer"
|
|
RID="linux-x64"
|
|
[[ "$(dpkg --print-architecture)" == "arm64" ]] && RID="linux-arm64"
|
|
cd /opt/networkoptimizer
|
|
export MinVerVersionOverride="$(cat ~/.networkoptimizer)"
|
|
export MSBUILDDISABLENODEREUSE=1
|
|
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
|
export DOTNET_SYSTEM_NET_DISABLEIPV6=1
|
|
$STD dotnet publish src/NetworkOptimizer.Web -c Release -r "$RID" --self-contained -o /opt/networkoptimizer/publish
|
|
chmod +x /opt/networkoptimizer/publish/NetworkOptimizer.Web
|
|
msg_ok "Built NetworkOptimizer"
|
|
|
|
msg_info "Building Speed Test Binaries"
|
|
mkdir -p /opt/networkoptimizer/publish/tools
|
|
cd /opt/networkoptimizer/src/uwnspeedtest
|
|
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $STD go build -trimpath -ldflags "-s -w" -o /opt/networkoptimizer/publish/tools/uwnspeedtest-linux-arm64 .
|
|
[[ "$(arch_resolve)" != "arm64" ]] && CGO_ENABLED=0 GOOS=linux GOARCH="$(arch_resolve)" $STD go build -trimpath -ldflags "-s -w" -o "/opt/networkoptimizer/publish/tools/uwnspeedtest-linux-$(arch_resolve)" .
|
|
msg_ok "Built Speed Test Binaries"
|
|
|
|
msg_info "Configuring NetworkOptimizer"
|
|
cat <<EOF >/opt/networkoptimizer/networkoptimizer.env
|
|
ASPNETCORE_URLS=http://*:8042
|
|
HOST_IP=${LOCAL_IP}
|
|
Iperf3Server__Enabled=true
|
|
EOF
|
|
msg_ok "Configured NetworkOptimizer"
|
|
|
|
msg_info "Creating Service"
|
|
cat <<EOF >/etc/systemd/system/networkoptimizer.service
|
|
[Unit]
|
|
Description=NetworkOptimizer
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=root
|
|
WorkingDirectory=/opt/networkoptimizer/publish
|
|
EnvironmentFile=/opt/networkoptimizer/networkoptimizer.env
|
|
ExecStart=/opt/networkoptimizer/publish/NetworkOptimizer.Web
|
|
Restart=always
|
|
RestartSec=10
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
systemctl enable -q --now networkoptimizer
|
|
msg_ok "Created Service"
|
|
|
|
motd_ssh
|
|
customize
|
|
cleanup_lxc
|