mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2025-04-19 21:28:06 +00:00
slskd (#3516)
This commit is contained in:
parent
04f781c512
commit
ca5de7a6ff
80
ct/slskd.sh
Normal file
80
ct/slskd.sh
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
|
||||||
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
|
# Author: vhsdream
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
# Source: https://github.com/slskd/slskd, https://soularr.net
|
||||||
|
|
||||||
|
APP="slskd"
|
||||||
|
var_tags="${var_tags:-arr;p2p}"
|
||||||
|
var_cpu="${var_cpu:-1}"
|
||||||
|
var_ram="${var_ram:-512}"
|
||||||
|
var_disk="${var_disk:-4}"
|
||||||
|
var_os="${var_os:-debian}"
|
||||||
|
var_version="${var_version:-12}"
|
||||||
|
var_unprivileged="${var_unprivileged:-1}"
|
||||||
|
|
||||||
|
header_info "$APP"
|
||||||
|
variables
|
||||||
|
color
|
||||||
|
catch_errors
|
||||||
|
|
||||||
|
function update_script() {
|
||||||
|
header_info
|
||||||
|
check_container_storage
|
||||||
|
check_container_resources
|
||||||
|
|
||||||
|
if [[ ! -d /opt/slskd ]] || [[ ! -d /opt/soularr ]]; then
|
||||||
|
msg_error "No ${APP} Installation Found!"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
RELEASE=$(curl -s https://api.github.com/repos/slskd/slskd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
|
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
|
||||||
|
msg_info "Stopping $APP and Soularr"
|
||||||
|
systemctl stop slskd soularr.timer soularr.service
|
||||||
|
msg_ok "Stopped $APP and Soularr"
|
||||||
|
|
||||||
|
msg_info "Updating $APP to v${RELEASE}"
|
||||||
|
tmp_file=$(mktemp)
|
||||||
|
curl -fsSL "https://github.com/slskd/slskd/releases/download/${RELEASE}/slskd-${RELEASE}-linux-x64.zip" -o $tmp_file
|
||||||
|
unzip -q -oj $tmp_file slskd -d /opt/${APP}
|
||||||
|
echo "${RELEASE}" >/opt/${APP}_version.txt
|
||||||
|
msg_ok "Updated $APP to v${RELEASE}"
|
||||||
|
|
||||||
|
msg_info "Updating Soularr"
|
||||||
|
cp /opt/soularr/config.ini /opt/config.ini.bak
|
||||||
|
cp /opt/soularr/run.sh /opt/run.sh.bak
|
||||||
|
cd /tmp
|
||||||
|
rm -rf /opt/soularr
|
||||||
|
curl -fsSL https://github.com/mrusse/soularr/archive/refs/heads/main.zip
|
||||||
|
unzip -q main.zip
|
||||||
|
mv soularr-main /opt/soularr
|
||||||
|
cd /opt/soularr
|
||||||
|
$STD pip install -r requirements.txt
|
||||||
|
mv /opt/config.ini.bak /opt/soularr/config.ini
|
||||||
|
mv /opt/run.sh.bak /opt/soularr/run.sh
|
||||||
|
msg_ok "Soularr updated"
|
||||||
|
msg_info "Starting $APP and Soularr"
|
||||||
|
systemctl start slskd soularr.timer
|
||||||
|
msg_ok "Started $APP and Soularr"
|
||||||
|
|
||||||
|
msg_info "Cleaning Up"
|
||||||
|
rm -rf $tmp_file
|
||||||
|
rm -rf /tmp/main.zip
|
||||||
|
msg_ok "Cleanup Completed"
|
||||||
|
|
||||||
|
else
|
||||||
|
msg_ok "No update required. ${APP} is already at v${RELEASE}"
|
||||||
|
fi
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
|
||||||
|
start
|
||||||
|
build_container
|
||||||
|
description
|
||||||
|
|
||||||
|
msg_ok "Completed Successfully!\n"
|
||||||
|
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
|
||||||
|
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
|
||||||
|
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:5030${CL}"
|
43
frontend/public/json/slskd.json
Normal file
43
frontend/public/json/slskd.json
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
{
|
||||||
|
"name": "slskd",
|
||||||
|
"slug": "slskd",
|
||||||
|
"categories": [
|
||||||
|
11
|
||||||
|
],
|
||||||
|
"date_created": "2025-03-31",
|
||||||
|
"type": "ct",
|
||||||
|
"updateable": true,
|
||||||
|
"privileged": false,
|
||||||
|
"interface_port": 5030,
|
||||||
|
"documentation": "https://github.com/slskd/slskd/tree/master/docs",
|
||||||
|
"website": "https://github.com/slskd/slskd",
|
||||||
|
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/png/slskd.png",
|
||||||
|
"description": "A modern client-server application for the Soulseek file sharing network. ",
|
||||||
|
"install_methods": [
|
||||||
|
{
|
||||||
|
"type": "default",
|
||||||
|
"script": "ct/slskd.sh",
|
||||||
|
"resources": {
|
||||||
|
"cpu": 1,
|
||||||
|
"ram": 512,
|
||||||
|
"hdd": 4,
|
||||||
|
"os": "Debian",
|
||||||
|
"version": "12"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"default_credentials": {
|
||||||
|
"username": "slskd",
|
||||||
|
"password": "slskd"
|
||||||
|
},
|
||||||
|
"notes": [
|
||||||
|
{
|
||||||
|
"text": "See /opt/slskd/config/sksld.yml to add your Soulseek credentials",
|
||||||
|
"type": "info"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"text": "This LXC includes Soularr; it needs to be configured (/opt/soularr/config.ini) before it will work",
|
||||||
|
"type": "info"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
120
install/slskd-install.sh
Normal file
120
install/slskd-install.sh
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# Copyright (c) 2021-2025 community-scripts ORG
|
||||||
|
# Author: vhsdream
|
||||||
|
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
|
||||||
|
# Source: https://github.com/slskd/slskd/, https://soularr.net
|
||||||
|
|
||||||
|
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 \
|
||||||
|
python3-pip
|
||||||
|
msg_ok "Installed Dependencies"
|
||||||
|
|
||||||
|
msg_info "Setup ${APPLICATION}"
|
||||||
|
tmp_file=$(mktemp)
|
||||||
|
RELEASE=$(curl -s https://api.github.com/repos/slskd/slskd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
|
||||||
|
curl -fsSL "https://github.com/slskd/slskd/releases/download/${RELEASE}/slskd-${RELEASE}-linux-x64.zip" -o $tmp_file
|
||||||
|
unzip -q $tmp_file -d /opt/${APPLICATION}
|
||||||
|
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
|
||||||
|
JWT_KEY=$(openssl rand -base64 44)
|
||||||
|
SLSKD_API_KEY=$(openssl rand -base64 44)
|
||||||
|
cp /opt/${APPLICATION}/config/slskd.example.yml /opt/${APPLICATION}/config/slskd.yml
|
||||||
|
sed -i \
|
||||||
|
-e "\|web:|,\|cidr|s|^#||" \
|
||||||
|
-e "\|https:|,\|5031|s|false|true|" \
|
||||||
|
-e "\|api_keys|,\|cidr|s|<some.*$|$SLSKD_API_KEY|; \
|
||||||
|
s|role: readonly|role: readwrite|; \
|
||||||
|
s|0.0.0.0/0,::/0|& # Replace this with your subnet|" \
|
||||||
|
-e "\|soulseek|,\|write_queue|s|^#||" \
|
||||||
|
-e "\|jwt:|,\|ttl|s|key: ~|key: $JWT_KEY|" \
|
||||||
|
/opt/${APPLICATION}/config/slskd.yml
|
||||||
|
msg_ok "Setup ${APPLICATION}"
|
||||||
|
|
||||||
|
msg_info "Installing Soularr"
|
||||||
|
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
|
||||||
|
cd /tmp
|
||||||
|
curl -fsSL https://github.com/mrusse/soularr/archive/refs/heads/main.zip
|
||||||
|
unzip -q main.zip
|
||||||
|
mv soularr-main /opt/soularr
|
||||||
|
cd /opt/soularr
|
||||||
|
$STD pip install -r requirements.txt
|
||||||
|
sed -i \
|
||||||
|
-e "\|[Slskd]|,\|host_url|s|yourslskdapikeygoeshere|$SLSKD_API_KEY|" \
|
||||||
|
-e "/host_url/s/slskd/localhost/" \
|
||||||
|
/opt/soularr/config.ini
|
||||||
|
sed -i \
|
||||||
|
-e "/#This\|#Default\|INTERVAL/{N;d;}" \
|
||||||
|
-e "/while\|#Pass/d" \
|
||||||
|
-e "\|python|s|app|opt/soularr|; s|python|python3|" \
|
||||||
|
-e "/dt/,+2d" \
|
||||||
|
/opt/soularr/run.sh
|
||||||
|
sed -i -E "/(soularr.py)/s/.{5}$//; /if/,/fi/s/.{4}//" /opt/soularr/run.sh
|
||||||
|
chmod +x /opt/soularr/run.sh
|
||||||
|
msg_ok "Installed Soularr"
|
||||||
|
|
||||||
|
msg_info "Creating Services"
|
||||||
|
cat <<EOF >/etc/systemd/system/${APPLICATION}.service
|
||||||
|
[Unit]
|
||||||
|
Description=${APPLICATION} Service
|
||||||
|
After=network.target
|
||||||
|
Wants=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
WorkingDirectory=/opt/${APPLICATION}
|
||||||
|
ExecStart=/opt/${APPLICATION}/slskd --config /opt/${APPLICATION}/config/slskd.yml
|
||||||
|
Restart=always
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat <<EOF >/etc/systemd/system/soularr.timer
|
||||||
|
[Unit]
|
||||||
|
Description=Soularr service timer
|
||||||
|
RefuseManualStart=no
|
||||||
|
RefuseManualStop=no
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
Persistent=true
|
||||||
|
# run every 5 minutes
|
||||||
|
OnCalendar=*-*-* *:0/5:00
|
||||||
|
Unit=soularr.service
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=timers.target
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cat <<EOF >/etc/systemd/system/soularr.service
|
||||||
|
[Unit]
|
||||||
|
Description=Soularr service
|
||||||
|
After=network.target slskd.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
WorkingDirectory=/opt/soularr
|
||||||
|
ExecStart=/bin/bash -c /opt/soularr/run.sh
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
||||||
|
EOF
|
||||||
|
systemctl enable -q --now ${APPLICATION}.service
|
||||||
|
systemctl enable -q soularr.timer
|
||||||
|
msg_ok "Created Services"
|
||||||
|
|
||||||
|
motd_ssh
|
||||||
|
customize
|
||||||
|
|
||||||
|
msg_info "Cleaning up"
|
||||||
|
rm -rf $tmp_file
|
||||||
|
rm -rf /tmp/main.zip
|
||||||
|
$STD apt-get -y autoremove
|
||||||
|
$STD apt-get -y autoclean
|
||||||
|
msg_ok "Cleaned"
|
Loading…
x
Reference in New Issue
Block a user