Skip to content

Commit fbd9d24

Browse files
push-app-to-main[bot]MickLesktremor021
authored
NetworkOptimizer (#16328)
* Add networkoptimizer (ct) * Update source line for build.func in networkoptimizer.sh Updated the source line to always use the latest build.func script from the community scripts repository. * Apply suggestion from @tremor021 * Apply suggestion from @tremor021 --------- Co-authored-by: push-app-to-main[bot] <203845782+push-app-to-main[bot]@users.noreply.github.com> Co-authored-by: CanbiZ (MickLesk) <47820557+MickLesk@users.noreply.github.com> Co-authored-by: Slaviša Arežina <58952836+tremor021@users.noreply.github.com>
1 parent 347e0e6 commit fbd9d24

3 files changed

Lines changed: 155 additions & 0 deletions

File tree

ct/headers/networkoptimizer

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
_ __ __ __ ____ __ _ _
2+
/ | / /__ / /__ ______ _____/ /__/ __ \____ / /_(_)___ ___ (_)___ ___ _____
3+
/ |/ / _ \/ __/ | /| / / __ \/ ___/ //_/ / / / __ \/ __/ / __ `__ \/ /_ / / _ \/ ___/
4+
/ /| / __/ /_ | |/ |/ / /_/ / / / ,< / /_/ / /_/ / /_/ / / / / / / / / /_/ __/ /
5+
/_/ |_/\___/\__/ |__/|__/\____/_/ /_/|_|\____/ .___/\__/_/_/ /_/ /_/_/ /___/\___/_/
6+
/_/

ct/networkoptimizer.sh

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/usr/bin/env bash
2+
source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2026 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/Ozark-Connect/NetworkOptimizer
7+
8+
APP="NetworkOptimizer"
9+
var_tags="${var_tags:-network;monitoring;unifi}"
10+
var_cpu="${var_cpu:-2}"
11+
var_ram="${var_ram:-4096}"
12+
var_disk="${var_disk:-12}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-13}"
15+
var_arm64="${var_arm64:-yes}"
16+
var_unprivileged="${var_unprivileged:-1}"
17+
18+
header_info "$APP"
19+
variables
20+
color
21+
catch_errors
22+
23+
function update_script() {
24+
header_info
25+
check_container_storage
26+
check_container_resources
27+
28+
if [[ ! -d /opt/networkoptimizer ]]; then
29+
msg_error "No ${APP} Installation Found!"
30+
exit
31+
fi
32+
33+
if check_for_gh_release "networkoptimizer" "Ozark-Connect/NetworkOptimizer"; then
34+
msg_info "Stopping Service"
35+
systemctl stop networkoptimizer
36+
msg_ok "Stopped Service"
37+
38+
create_backup /opt/networkoptimizer/networkoptimizer.env
39+
40+
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "networkoptimizer" "Ozark-Connect/NetworkOptimizer" "tarball"
41+
42+
msg_info "Rebuilding NetworkOptimizer"
43+
RID="linux-x64"
44+
[[ "$(dpkg --print-architecture)" == "arm64" ]] && RID="linux-arm64"
45+
cd /opt/networkoptimizer
46+
$STD dotnet publish src/NetworkOptimizer.Web -c Release -r "$RID" --self-contained -o /opt/networkoptimizer/publish
47+
chmod +x /opt/networkoptimizer/publish/NetworkOptimizer.Web
48+
mkdir -p /opt/networkoptimizer/publish/tools
49+
cd /opt/networkoptimizer/src/uwnspeedtest
50+
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $STD go build -trimpath -ldflags "-s -w" -o /opt/networkoptimizer/publish/tools/uwnspeedtest-linux-arm64 .
51+
msg_ok "Rebuilt NetworkOptimizer"
52+
53+
restore_backup
54+
55+
msg_info "Starting Service"
56+
systemctl start networkoptimizer
57+
msg_ok "Started Service"
58+
msg_ok "Updated successfully!"
59+
fi
60+
exit
61+
}
62+
63+
start
64+
build_container
65+
description
66+
67+
msg_ok "Completed Successfully!\n"
68+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
69+
echo -e "${INFO}${YW}Access it using the following URL:${CL}"
70+
echo -e "${GATEWAY}${BGN}http://${IP}:8042${CL}"
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2026 community-scripts ORG
4+
# Author: MickLesk (CanbiZ)
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/Ozark-Connect/NetworkOptimizer
7+
8+
source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
9+
color
10+
verb_ip6
11+
catch_errors
12+
setting_up_container
13+
network_check
14+
update_os
15+
16+
msg_info "Installing Dependencies"
17+
$STD apt install -y \
18+
git \
19+
sshpass \
20+
iperf3
21+
setup_deb822_repo \
22+
"microsoft" \
23+
"https://packages.microsoft.com/keys/microsoft-2025.asc" \
24+
"https://packages.microsoft.com/debian/13/prod/" \
25+
"trixie"
26+
$STD apt install -y dotnet-sdk-10.0
27+
msg_ok "Installed Dependencies"
28+
29+
setup_go
30+
31+
fetch_and_deploy_gh_release "networkoptimizer" "Ozark-Connect/NetworkOptimizer" "tarball"
32+
33+
msg_info "Building NetworkOptimizer"
34+
RID="linux-x64"
35+
[[ "$(dpkg --print-architecture)" == "arm64" ]] && RID="linux-arm64"
36+
cd /opt/networkoptimizer
37+
export MinVerVersionOverride="$(cat ~/.networkoptimizer)"
38+
$STD dotnet publish src/NetworkOptimizer.Web -c Release -r "$RID" --self-contained -o /opt/networkoptimizer/publish
39+
chmod +x /opt/networkoptimizer/publish/NetworkOptimizer.Web
40+
msg_ok "Built NetworkOptimizer"
41+
42+
msg_info "Building Gateway Speed Test Binary"
43+
mkdir -p /opt/networkoptimizer/publish/tools
44+
cd /opt/networkoptimizer/src/uwnspeedtest
45+
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $STD go build -trimpath -ldflags "-s -w" -o /opt/networkoptimizer/publish/tools/uwnspeedtest-linux-arm64 .
46+
msg_ok "Built Gateway Speed Test Binary"
47+
48+
msg_info "Configuring NetworkOptimizer"
49+
cat <<EOF >/opt/networkoptimizer/networkoptimizer.env
50+
ASPNETCORE_URLS=http://*:8042
51+
HOST_IP=${LOCAL_IP}
52+
Iperf3Server__Enabled=true
53+
EOF
54+
msg_ok "Configured NetworkOptimizer"
55+
56+
msg_info "Creating Service"
57+
cat <<EOF >/etc/systemd/system/networkoptimizer.service
58+
[Unit]
59+
Description=NetworkOptimizer
60+
After=network.target
61+
62+
[Service]
63+
Type=simple
64+
User=root
65+
WorkingDirectory=/opt/networkoptimizer/publish
66+
EnvironmentFile=/opt/networkoptimizer/networkoptimizer.env
67+
ExecStart=/opt/networkoptimizer/publish/NetworkOptimizer.Web
68+
Restart=always
69+
RestartSec=10
70+
71+
[Install]
72+
WantedBy=multi-user.target
73+
EOF
74+
systemctl enable -q --now networkoptimizer
75+
msg_ok "Created Service"
76+
77+
motd_ssh
78+
customize
79+
cleanup_lxc

0 commit comments

Comments
 (0)