Skip to content

Commit ca5de7a

Browse files
slskd (#3516)
1 parent 04f781c commit ca5de7a

File tree

3 files changed

+243
-0
lines changed

3 files changed

+243
-0
lines changed

ct/slskd.sh

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/usr/bin/env bash
2+
source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: vhsdream
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/slskd/slskd, https://soularr.net
7+
8+
APP="slskd"
9+
var_tags="${var_tags:-arr;p2p}"
10+
var_cpu="${var_cpu:-1}"
11+
var_ram="${var_ram:-512}"
12+
var_disk="${var_disk:-4}"
13+
var_os="${var_os:-debian}"
14+
var_version="${var_version:-12}"
15+
var_unprivileged="${var_unprivileged:-1}"
16+
17+
header_info "$APP"
18+
variables
19+
color
20+
catch_errors
21+
22+
function update_script() {
23+
header_info
24+
check_container_storage
25+
check_container_resources
26+
27+
if [[ ! -d /opt/slskd ]] || [[ ! -d /opt/soularr ]]; then
28+
msg_error "No ${APP} Installation Found!"
29+
exit
30+
fi
31+
32+
RELEASE=$(curl -s https://api.github.com/repos/slskd/slskd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
33+
if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then
34+
msg_info "Stopping $APP and Soularr"
35+
systemctl stop slskd soularr.timer soularr.service
36+
msg_ok "Stopped $APP and Soularr"
37+
38+
msg_info "Updating $APP to v${RELEASE}"
39+
tmp_file=$(mktemp)
40+
curl -fsSL "https://github.com/slskd/slskd/releases/download/${RELEASE}/slskd-${RELEASE}-linux-x64.zip" -o $tmp_file
41+
unzip -q -oj $tmp_file slskd -d /opt/${APP}
42+
echo "${RELEASE}" >/opt/${APP}_version.txt
43+
msg_ok "Updated $APP to v${RELEASE}"
44+
45+
msg_info "Updating Soularr"
46+
cp /opt/soularr/config.ini /opt/config.ini.bak
47+
cp /opt/soularr/run.sh /opt/run.sh.bak
48+
cd /tmp
49+
rm -rf /opt/soularr
50+
curl -fsSL https://github.com/mrusse/soularr/archive/refs/heads/main.zip
51+
unzip -q main.zip
52+
mv soularr-main /opt/soularr
53+
cd /opt/soularr
54+
$STD pip install -r requirements.txt
55+
mv /opt/config.ini.bak /opt/soularr/config.ini
56+
mv /opt/run.sh.bak /opt/soularr/run.sh
57+
msg_ok "Soularr updated"
58+
msg_info "Starting $APP and Soularr"
59+
systemctl start slskd soularr.timer
60+
msg_ok "Started $APP and Soularr"
61+
62+
msg_info "Cleaning Up"
63+
rm -rf $tmp_file
64+
rm -rf /tmp/main.zip
65+
msg_ok "Cleanup Completed"
66+
67+
else
68+
msg_ok "No update required. ${APP} is already at v${RELEASE}"
69+
fi
70+
exit
71+
}
72+
73+
start
74+
build_container
75+
description
76+
77+
msg_ok "Completed Successfully!\n"
78+
echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
79+
echo -e "${INFO}${YW} Access it using the following URL:${CL}"
80+
echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:5030${CL}"

frontend/public/json/slskd.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "slskd",
3+
"slug": "slskd",
4+
"categories": [
5+
11
6+
],
7+
"date_created": "2025-03-31",
8+
"type": "ct",
9+
"updateable": true,
10+
"privileged": false,
11+
"interface_port": 5030,
12+
"documentation": "https://github.com/slskd/slskd/tree/master/docs",
13+
"website": "https://github.com/slskd/slskd",
14+
"logo": "https://cdn.jsdelivr.net/gh/selfhst/icons/png/slskd.png",
15+
"description": "A modern client-server application for the Soulseek file sharing network. ",
16+
"install_methods": [
17+
{
18+
"type": "default",
19+
"script": "ct/slskd.sh",
20+
"resources": {
21+
"cpu": 1,
22+
"ram": 512,
23+
"hdd": 4,
24+
"os": "Debian",
25+
"version": "12"
26+
}
27+
}
28+
],
29+
"default_credentials": {
30+
"username": "slskd",
31+
"password": "slskd"
32+
},
33+
"notes": [
34+
{
35+
"text": "See /opt/slskd/config/sksld.yml to add your Soulseek credentials",
36+
"type": "info"
37+
},
38+
{
39+
"text": "This LXC includes Soularr; it needs to be configured (/opt/soularr/config.ini) before it will work",
40+
"type": "info"
41+
}
42+
]
43+
}

install/slskd-install.sh

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2021-2025 community-scripts ORG
4+
# Author: vhsdream
5+
# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
6+
# Source: https://github.com/slskd/slskd/, https://soularr.net
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-get install -y \
18+
python3-pip
19+
msg_ok "Installed Dependencies"
20+
21+
msg_info "Setup ${APPLICATION}"
22+
tmp_file=$(mktemp)
23+
RELEASE=$(curl -s https://api.github.com/repos/slskd/slskd/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }')
24+
curl -fsSL "https://github.com/slskd/slskd/releases/download/${RELEASE}/slskd-${RELEASE}-linux-x64.zip" -o $tmp_file
25+
unzip -q $tmp_file -d /opt/${APPLICATION}
26+
echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
27+
JWT_KEY=$(openssl rand -base64 44)
28+
SLSKD_API_KEY=$(openssl rand -base64 44)
29+
cp /opt/${APPLICATION}/config/slskd.example.yml /opt/${APPLICATION}/config/slskd.yml
30+
sed -i \
31+
-e "\|web:|,\|cidr|s|^#||" \
32+
-e "\|https:|,\|5031|s|false|true|" \
33+
-e "\|api_keys|,\|cidr|s|<some.*$|$SLSKD_API_KEY|; \
34+
s|role: readonly|role: readwrite|; \
35+
s|0.0.0.0/0,::/0|& # Replace this with your subnet|" \
36+
-e "\|soulseek|,\|write_queue|s|^#||" \
37+
-e "\|jwt:|,\|ttl|s|key: ~|key: $JWT_KEY|" \
38+
/opt/${APPLICATION}/config/slskd.yml
39+
msg_ok "Setup ${APPLICATION}"
40+
41+
msg_info "Installing Soularr"
42+
rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED
43+
cd /tmp
44+
curl -fsSL https://github.com/mrusse/soularr/archive/refs/heads/main.zip
45+
unzip -q main.zip
46+
mv soularr-main /opt/soularr
47+
cd /opt/soularr
48+
$STD pip install -r requirements.txt
49+
sed -i \
50+
-e "\|[Slskd]|,\|host_url|s|yourslskdapikeygoeshere|$SLSKD_API_KEY|" \
51+
-e "/host_url/s/slskd/localhost/" \
52+
/opt/soularr/config.ini
53+
sed -i \
54+
-e "/#This\|#Default\|INTERVAL/{N;d;}" \
55+
-e "/while\|#Pass/d" \
56+
-e "\|python|s|app|opt/soularr|; s|python|python3|" \
57+
-e "/dt/,+2d" \
58+
/opt/soularr/run.sh
59+
sed -i -E "/(soularr.py)/s/.{5}$//; /if/,/fi/s/.{4}//" /opt/soularr/run.sh
60+
chmod +x /opt/soularr/run.sh
61+
msg_ok "Installed Soularr"
62+
63+
msg_info "Creating Services"
64+
cat <<EOF >/etc/systemd/system/${APPLICATION}.service
65+
[Unit]
66+
Description=${APPLICATION} Service
67+
After=network.target
68+
Wants=network.target
69+
70+
[Service]
71+
WorkingDirectory=/opt/${APPLICATION}
72+
ExecStart=/opt/${APPLICATION}/slskd --config /opt/${APPLICATION}/config/slskd.yml
73+
Restart=always
74+
75+
[Install]
76+
WantedBy=multi-user.target
77+
EOF
78+
79+
cat <<EOF >/etc/systemd/system/soularr.timer
80+
[Unit]
81+
Description=Soularr service timer
82+
RefuseManualStart=no
83+
RefuseManualStop=no
84+
85+
[Timer]
86+
Persistent=true
87+
# run every 5 minutes
88+
OnCalendar=*-*-* *:0/5:00
89+
Unit=soularr.service
90+
91+
[Install]
92+
WantedBy=timers.target
93+
EOF
94+
95+
cat <<EOF >/etc/systemd/system/soularr.service
96+
[Unit]
97+
Description=Soularr service
98+
After=network.target slskd.service
99+
100+
[Service]
101+
Type=simple
102+
WorkingDirectory=/opt/soularr
103+
ExecStart=/bin/bash -c /opt/soularr/run.sh
104+
105+
[Install]
106+
WantedBy=multi-user.target
107+
EOF
108+
systemctl enable -q --now ${APPLICATION}.service
109+
systemctl enable -q soularr.timer
110+
msg_ok "Created Services"
111+
112+
motd_ssh
113+
customize
114+
115+
msg_info "Cleaning up"
116+
rm -rf $tmp_file
117+
rm -rf /tmp/main.zip
118+
$STD apt-get -y autoremove
119+
$STD apt-get -y autoclean
120+
msg_ok "Cleaned"

0 commit comments

Comments
 (0)