Compare commits

...

6 Commits

Author SHA1 Message Date
Evan Owen 68d3fb5150
Merge 536a96b65e into a40795a5d4 2024-06-27 01:13:16 +00:00
ulmentflam 536a96b65e
Changing application name to Kubo 2024-06-26 21:13:02 -04:00
ulmentflam b3b97c1b4f
Resolving Review Comments 2024-06-26 14:32:52 -04:00
tteckster a40795a5d4
Update scrutiny-install.sh
fixes https://github.com/tteck/Proxmox/issues/3269
2024-06-26 12:40:15 -04:00
tteckster a87b6c8a2b
Update CHANGELOG.md 2024-06-26 12:15:18 -04:00
CanbiZ 3639db4e94
Add new LXC: Scrutiny (#3260) 2024-06-26 07:09:56 -04:00
5 changed files with 287 additions and 20 deletions

View File

@ -9,6 +9,13 @@
- All LXC instances created using this repository come pre-installed with Midnight Commander, which is a command-line tool (`mc`) that offers a user-friendly file and directory management interface for the terminal environment.
## 2024-06-26
### Changed
- **Scrutiny LXC**
- NEW Script
## 2024-06-14
### Changed

View File

@ -9,19 +9,19 @@ source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build
function header_info {
clear
cat <<"EOF"
________ ___________
/ _/ __ \/ ____/ ___/
/ // /_/ / /_ \__ \
_/ // ____/ __/ ___/ /
/___/_/ /_/ /____/
__ __ __
/ //_/_ __/ /_ ____
/ ,< / / / / __ \/ __ \
/ /| / /_/ / /_/ / /_/ /
/_/ |_\__,_/_.___/\____/
EOF
}
header_info
echo -e "Loading..."
APP="IPFS"
APP="Kubo"
var_disk="4"
var_cpu="2"
var_ram="6144"
var_ram="4096"
var_os="debian"
var_version="12"
variables
@ -55,14 +55,20 @@ function default_settings() {
function update_script() {
header_info
if [[ ! -f /usr/local/kubo ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
msg_info "Updating $APP LXC"
apt-get update &>/dev/null
apt-get -y upgrade &>/dev/null
wget -q "$(curl -s "https://api.github.com/repos/ipfs/kubo/releases/latest" | grep "linux-amd64.tar.gz" | grep "browser_download_url" | head -n 1 | cut -d\" -f4)"
tar -xzf kubo*linux-amd64.tar.gz -C /usr/local
rm -rf kubo*linux-amd64.tar.gz
systemctl restart ipfs.service
msg_ok "Updated $APP LXC"
RELEASE=$(wget -q https://github.com/ipfs/kubo/releases/latest -O - | grep "title>Release" | cut -d " " -f 4)
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
msg_info "Updating $APP LXC"
apt-get update &>/dev/null
apt-get -y upgrade &>/dev/null
wget -q "https://github.com/ipfs/kubo/releases/download/${RELEASE}/kubo_${RELEASE}_linux-amd64.tar.gz"
tar -xzf "kubo_${RELEASE}_linux-amd64.tar.gz" -C /usr/local
systemctl restart ipfs.service
echo "${RELEASE}" >/opt/${APP}_version.txt
rm "kubo_${RELEASE}_linux-amd64.tar.gz"
msg_ok "Updated $APP LXC"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
exit
}

190
ct/scrutiny.sh Normal file
View File

@ -0,0 +1,190 @@
#!/usr/bin/env bash
source <(curl -s https://raw.githubusercontent.com/tteck/Proxmox/main/misc/build.func)
# Copyright (c) 2021-2024 tteck
# Author: tteck
# Co-Author: MickLesk (Canbiz)
# License: MIT
# https://github.com/tteck/Proxmox/raw/main/LICENSE
function header_info {
clear
cat <<"EOF"
_____ __ _
/ ___/____________ __/ /_(_)___ __ __
\__ \/ ___/ ___/ / / / __/ / __ \/ / / /
___/ / /__/ / / /_/ / /_/ / / / / /_/ /
/____/\___/_/ \__,_/\__/_/_/ /_/\__, /
/____/
EOF
}
header_info
echo -e "Loading..."
APP="Scrutiny"
var_disk="4"
var_cpu="1"
var_ram="1024"
var_os="debian"
var_version="12"
variables
color
catch_errors
function default_settings() {
CT_TYPE="1"
PW=""
CT_ID=$NEXTID
HN=$NSAPP
DISK_SIZE="$var_disk"
CORE_COUNT="$var_cpu"
RAM_SIZE="$var_ram"
BRG="vmbr0"
NET="dhcp"
GATE=""
APT_CACHER=""
APT_CACHER_IP=""
DISABLEIP6="no"
MTU=""
SD=""
NS=""
MAC=""
VLAN=""
SSH="no"
VERB="no"
echo_default
}
function update_script() {
if [[ ! -d /opt/scrutiny ]]; then msg_error "No ${APP} Installation Found!"; exit; fi
RELEASE=$(curl -s https://api.github.com/repos/AnalogJ/scrutiny/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
UPD=$(whiptail --backtitle "Proxmox VE Helper Scripts" --title "Scrutiny Management" --radiolist --cancel-button Exit-Script "Spacebar = Select" 15 70 4 \
"1" "Update Scrutiny to $RELEASE" ON \
"2" "Start Scrutiny Webapp" OFF \
"3" "Create/Start Scrutiny Collector" OFF \
"4" "Change Scrutiny Settings" OFF \
3>&1 1>&2 2>&3)
header_info
if [ "$UPD" == "1" ]; then
if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
msg_info "Stopping all Scrutiny Services"
WEBAPP_ACTIVE=$(systemctl is-active scrutiny.service)
COLLECTOR_ACTIVE=$(systemctl is-active scrutiny_collector.service)
systemctl stop scrutiny.service scrutiny_collector.service
msg_ok "Stopped all Scrutiny Services"
msg_info "Updating to ${RELEASE}"
cd /opt
rm -rf scrutiny_bak
mv scrutiny scrutiny_bak
mkdir -p /opt/scrutiny/web /opt/scrutiny/bin
wget -q -O /opt/scrutiny/bin/scrutiny-web-linux-amd64 "https://github.com/AnalogJ/scrutiny/releases/download/${RELEASE}/scrutiny-web-linux-amd64"
wget -q -O /opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 "https://github.com/AnalogJ/scrutiny/releases/download/${RELEASE}/scrutiny-collector-metrics-linux-amd64"
wget -q -O /opt/scrutiny/web/scrutiny-web-frontend.tar.gz "https://github.com/AnalogJ/scrutiny/releases/download/${RELEASE}/scrutiny-web-frontend.tar.gz"
cd /opt/scrutiny/web && tar xvzf scrutiny-web-frontend.tar.gz --strip-components 1 -C .
chmod +x /opt/scrutiny/bin/scrutiny-web-linux-amd64
chmod +x /opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64
echo "${RELEASE}" > /opt/scrutiny_version.txt
msg_ok "Updated Scrutiny to $RELEASE"
msg_info "Cleaning up"
rm -f /opt/scrutiny/web/scrutiny-web-frontend.tar.gz
msg_ok "Cleaned"
if [ "$WEBAPP_ACTIVE" == "active" ]; then
msg_info "Starting Scrutiny Webapp Service"
systemctl start scrutiny.service
msg_ok "Started Scrutiny Webapp Service"
fi
if [ "$COLLECTOR_ACTIVE" == "active" ]; then
msg_info "Starting Scrutiny Collector Service"
systemctl start scrutiny_collector.service
msg_ok "Started Scrutiny Collector Service"
fi
msg_ok "Updated Successfully!\n"
else
msg_ok "No update required. ${APP} is already at ${RELEASE}"
fi
exit
fi
if [ "$UPD" == "2" ]; then
msg_info "Checking for Scrutiny Webapp Service"
if systemctl list-units --full -all | grep -Fq 'scrutiny.service'; then
msg_info "Stopping Scrutiny Webapp Service"
systemctl stop scrutiny.service
msg_ok "Stopped Scrutiny Webapp Service"
else
msg_info "Scrutiny Webapp Service not found, creating..."
cat <<EOF >/etc/systemd/system/scrutiny.service
[Unit]
Description=Scrutiny - Hard Drive Monitoring and Webapp
After=network.target
[Service]
Type=simple
ExecStart=/opt/scrutiny/bin/scrutiny-web-linux-amd64 start --config /opt/scrutiny/config/scrutiny.yaml
Restart=always
User=root
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q scrutiny.service
msg_ok "Created Scrutiny Webapp Service"
fi
msg_info "Starting Scrutiny Webapp Service"
systemctl start scrutiny.service
msg_ok "Started Scrutiny Webapp Service"
exit
fi
if [ "$UPD" == "3" ]; then
msg_info "Checking for Scrutiny Collector Service"
if systemctl list-units --full -all | grep -Fq 'scrutiny_collector.service'; then
msg_info "Stopping Scrutiny Collector Service"
systemctl stop scrutiny_collector.service
msg_ok "Stopped Scrutiny Collector Service"
else
msg_info "Scrutiny Collector Service not found, creating..."
wget -q -O /opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 "https://github.com/AnalogJ/scrutiny/releases/download/${RELEASE}/scrutiny-collector-metrics-linux-amd64"
chmod +x /opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64
cat <<EOF >/etc/systemd/system/scrutiny_collector.service
[Unit]
Description=Scrutiny Collector
After=network.target
[Service]
Type=simple
ExecStart=/opt/scrutiny/bin/scrutiny-collector-metrics-linux-amd64 run --api-endpoint "http://localhost:8080"
Restart=always
User=root
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q scrutiny_collector.service
msg_ok "Created Scrutiny Collector Service"
fi
msg_info "Starting Scrutiny Collector Service"
systemctl start scrutiny_collector.service
msg_ok "Started Scrutiny Collector Service"
exit
fi
if [ "$UPD" == "4" ]; then
nano /opt/scrutiny/config/scrutiny.yaml
exit
fi
}
start
build_container
description
msg_ok "Completed Successfully!\n"
echo -e "${APP} Setup should be reachable by going to the following URL.
${BL}http://${IP}:8080${CL} \n"

View File

@ -22,15 +22,18 @@ $STD apt-get install -y gpg
msg_ok "Installed Dependencies"
msg_info "Installing IPFS"
wget -q "$(curl -s "https://api.github.com/repos/ipfs/kubo/releases/latest" | grep "linux-amd64.tar.gz" | grep "browser_download_url" | head -n 1 | cut -d\" -f4)"
tar -xzf kubo*linux-amd64.tar.gz -C /usr/local
RELEASE=$(wget -q https://github.com/ipfs/kubo/releases/latest -O - | grep "title>Release" | cut -d " " -f 4)
$STD wget -q "https://github.com/ipfs/kubo/releases/download/${RELEASE}/kubo_${RELEASE}_linux-amd64.tar.gz"
tar -xzf "kubo_${RELEASE}_linux-amd64.tar.gz" -C /usr/local
$STD ln -s /usr/local/kubo/ipfs /usr/local/bin/ipfs
ipfs init &>/dev/null
$STD ipfs init
ipfs config Addresses.API /ip4/0.0.0.0/tcp/5001
ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080
LXCIP=$(hostname -I | awk '{print $1}')
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"http://${LXCIP}:5001\", \"http://localhost:3000\", \"http://127.0.0.1:5001\", \"https://webui.ipfs.io\", \"http://0.0.0.0:5001\"]"
ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods '["PUT", "POST"]'
echo "${RELEASE}" >"/opt/${APPLICATION}_version.txt"
$STD rm "kubo_${RELEASE}_linux-amd64.tar.gz"
msg_ok "Installed IPFS"
msg_info "Creating Service"
@ -46,7 +49,6 @@ Restart=on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl -q daemon-reload
systemctl enable --now -q ipfs.service
msg_ok "Created Service"
@ -54,7 +56,6 @@ motd_ssh
customize
msg_info "Cleaning up"
rm -rf kubo*linux-amd64.tar.gz
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"

View File

@ -0,0 +1,63 @@
#!/usr/bin/env bash
# Copyright (c) 2021-2024 tteck
# Author: tteck
# Co-Author: MickLesk (Canbiz)
# License: MIT
# https://github.com/tteck/Proxmox/raw/main/LICENSE
# Source: https://github.com/AnalogJ/scrutiny
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 \
sudo \
curl \
smartmontools \
make \
mc
msg_ok "Installed Dependencies"
msg_info "Installing Scrutiny WebApp"
mkdir -p /opt/scrutiny/{config,web,bin}
RELEASE=$(curl -s https://api.github.com/repos/analogj/scrutiny/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
wget -q -O /opt/scrutiny/config/scrutiny.yaml https://raw.githubusercontent.com/AnalogJ/scrutiny/master/example.scrutiny.yaml
wget -q -O /opt/scrutiny/bin/scrutiny-web-linux-amd64 "https://github.com/AnalogJ/scrutiny/releases/download/${RELEASE}/scrutiny-web-linux-amd64"
wget -q -O /opt/scrutiny/web/scrutiny-web-frontend.tar.gz "https://github.com/AnalogJ/scrutiny/releases/download/${RELEASE}/scrutiny-web-frontend.tar.gz"
cd /opt/scrutiny/web
tar xzf scrutiny-web-frontend.tar.gz --strip-components 1 -C .
chmod +x /opt/scrutiny/bin/scrutiny-web-linux-amd64
msg_ok "Installed Scrutiny WebApp"
msg_info "Setup Service"
cat <<EOF >/etc/systemd/system/scrutiny.service
[Unit]
Description=Scrutiny - Hard Drive Monitoring and Webapp
After=network.target
[Service]
Type=simple
ExecStart=/opt/scrutiny/bin/scrutiny-web-linux-amd64 start --config /opt/scrutiny/config/scrutiny.yaml
Restart=always
User=root
[Install]
WantedBy=multi-user.target
EOF
systemctl enable -q --now scrutiny.service
msg_ok "Created and enabled Service"
motd_ssh
customize
msg_info "Cleaning up"
$STD apt-get -y autoremove
$STD apt-get -y autoclean
msg_ok "Cleaned"