Files
ProxmoxVE/install/myspeed-install.sh

62 lines
1.5 KiB
Bash
Raw Normal View History

2024-06-14 12:06:18 +02:00
#!/usr/bin/env bash
# Copyright (c) 2021-2025 tteck
2025-02-12 19:01:56 +01:00
# Author: MickLesk (Canbiz)
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
2024-06-14 12:06:18 +02:00
# Source: https://github.com/gnmyt/myspeed
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 \
2025-02-12 19:01:56 +01:00
build-essential \
ca-certificates
2024-06-14 12:06:18 +02:00
msg_ok "Installed Dependencies"
NODE_VERSION="22" install_node_and_modules
2024-06-14 12:06:18 +02:00
msg_info "Installing MySpeed"
RELEASE=$(curl -fsSL https://github.com/gnmyt/myspeed/releases/latest | grep "title>Release" | cut -d " " -f 5)
2024-06-14 12:06:18 +02:00
cd /opt
2025-04-01 10:58:29 +02:00
curl -fsSL "https://github.com/gnmyt/myspeed/releases/download/v$RELEASE/MySpeed-$RELEASE.zip" -o $(basename "https://github.com/gnmyt/myspeed/releases/download/v$RELEASE/MySpeed-$RELEASE.zip")
$STD unzip MySpeed-$RELEASE.zip -d myspeed
2024-06-14 12:06:18 +02:00
cd myspeed
$STD npm install
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
msg_ok "Installed MySpeed"
msg_info "Creating Service"
cat <<EOF >/etc/systemd/system/myspeed.service
[Unit]
Description=MySpeed
After=network.target
[Service]
Type=simple
ExecStart=/usr/bin/node server
Restart=always
User=root
Environment=NODE_ENV=production
WorkingDirectory=/opt/myspeed
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now myspeed
2024-06-14 12:06:18 +02:00
msg_ok "Created Service"
motd_ssh
customize
msg_info "Cleaning up"
$STD apt-get -y autoremove
rm -rf /opt/MySpeed-$RELEASE.zip
$STD apt-get -y autoclean
2025-02-12 19:01:56 +01:00
msg_ok "Cleaned"