diff --git a/ct/slskd.sh b/ct/slskd.sh index 7638b2311..edc84a772 100644 --- a/ct/slskd.sh +++ b/ct/slskd.sh @@ -3,7 +3,7 @@ source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxV # Copyright (c) 2021-2026 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: https://github.com/slskd/slskd, https://github.com/mrusse/soularr APP="slskd" var_tags="${var_tags:-arr;p2p}" @@ -24,50 +24,65 @@ function update_script() { check_container_storage check_container_resources - if [[ ! -d /opt/slskd ]] || [[ ! -d /opt/soularr ]]; then - msg_error "No ${APP} Installation Found!" + if [[ ! -d /opt/slskd ]]; then + msg_error "No Slskd 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 Service" - systemctl stop slskd soularr.timer soularr.service - msg_info "Stopped Service" + if check_for_gh_release "Slskd" "slskd/slskd"; then + msg_info "Stopping Service(s)" + systemctl stop slskd + [[ -f /etc/systemd/system/soularr.service ]] && systemctl stop soularr.timer soularr.service + msg_ok "Stopped Service(s)" - 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 - $STD unzip -oj $tmp_file slskd -d /opt/${APP} - echo "${RELEASE}" >/opt/${APP}_version.txt - msg_ok "Updated $APP to v${RELEASE}" + msg_info "Backing up config" + cp /opt/slskd/config/slskd.yml /opt/slskd.yml.bak + msg_ok "Backed up config" - msg_info "Starting Service" + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "Slskd" "slskd/slskd" "prebuild" "latest" "/opt/slskd" "slskd-*-linux-x64.zip" + + msg_info "Restoring config" + mv /opt/slskd.yml.bak /opt/slskd/config/slskd.yml + msg_ok "Restored config" + + msg_info "Starting Service(s)" systemctl start slskd - msg_ok "Started Service" - rm -rf $tmp_file - else - msg_ok "No ${APP} update required. ${APP} is already at v${RELEASE}" + [[ -f /etc/systemd/system/soularr.service ]] && systemctl start soularr.timer + msg_ok "Started Service(s)" + msg_ok "Updated Slskd successfully!" fi - 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 -o main.zip https://github.com/mrusse/soularr/archive/refs/heads/main.zip - $STD unzip 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 - rm -rf /tmp/main.zip - msg_ok "Updated soularr" + [[ -d /opt/soularr ]] && if check_for_gh_release "Soularr" "mrusse/soularr"; then + if systemctl is-active soularr.timer >/dev/null; then + msg_info "Stopping Timer and Service" + systemctl stop soularr.timer soularr.service + msg_ok "Stopped Timer and Service" + fi - msg_info "Starting soularr timer" - systemctl start soularr.timer - msg_ok "Started soularr timer" - exit + msg_info "Backing up Soularr config" + cp /opt/soularr/config.ini /opt/soularr_config.ini.bak + cp /opt/soularr/run.sh /opt/soularr_run.sh.bak + msg_ok "Backed up Soularr config" + + PYTHON_VERSION="3.11" setup_uv + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "Soularr" "mrusse/soularr" "tarball" "latest" "/opt/soularr" + msg_info "Updating Soularr" + cd /opt/soularr + $STD uv venv -c venv + $STD source venv/bin/activate + $STD uv pip install -r requirements.txt + deactivate + msg_ok "Updated Soularr" + + msg_info "Restoring Soularr config" + mv /opt/soularr_config.ini.bak /opt/soularr/config.ini + mv /opt/soularr_run.sh.bak /opt/soularr/run.sh + msg_ok "Restored Soularr config" + + msg_info "Starting Soularr Timer" + systemctl restart soularr.timer + msg_ok "Started Soularr Timer" + msg_ok "Updated Soularr successfully!" + fi } start diff --git a/frontend/public/json/slskd.json b/frontend/public/json/slskd.json index d4ab048fc..20900c1f9 100644 --- a/frontend/public/json/slskd.json +++ b/frontend/public/json/slskd.json @@ -1,5 +1,5 @@ { - "name": "slskd", + "name": "Slskd", "slug": "slskd", "categories": [ 11 @@ -35,10 +35,6 @@ { "text": "See /opt/slskd/config/slskd.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" } ] } diff --git a/install/slskd-install.sh b/install/slskd-install.sh index 13e6d620e..d56f37e28 100644 --- a/install/slskd-install.sh +++ b/install/slskd-install.sh @@ -3,7 +3,7 @@ # Copyright (c) 2021-2026 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: https://github.com/slskd/slskd/, https://github.com/mrusse/soularr source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" color @@ -13,71 +13,71 @@ setting_up_container network_check update_os -msg_info "Installing Dependencies" -$STD apt install -y \ - python3-pip -msg_ok "Installed Dependencies" +fetch_and_deploy_gh_release "Slskd" "slskd/slskd" "prebuild" "latest" "/opt/slskd" "slskd-*-linux-x64.zip" -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 -$STD unzip $tmp_file -d /opt/${APPLICATION} -echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_info "Configuring Slskd" 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 +cp /opt/slskd/config/slskd.example.yml /opt/slskd/config/slskd.yml sed -i \ - -e "\|web:|,\|cidr|s|^#||" \ - -e "\|https:|,\|5031|s|false|true|" \ + -e '/web:/,/cidr/s/^# //' \ + -e '/https:/,/port: 5031/s/false/true/' \ + -e '/port: 5030/,/socket/s/,.*$//' \ + -e '/content_path:/,/authentication/s/false/true/' \ -e "\|api_keys|,\|cidr|s|/opt/soularr/run.sh +#!/usr/bin/env bash -msg_info "Creating Services" -cat </etc/systemd/system/${APPLICATION}.service +if ps aux | grep "[s]oularr.py" >/dev/null; then + echo "Soularr is already running. Exiting..." + exit 1 +else + source /opt/soularr/venv/bin/activate + uv run python3 -u /opt/soularr/soularr.py --config-dir /opt/soularr +fi +EOF + chmod +x /opt/soularr/run.sh + deactivate + msg_ok "Installed Soularr" +fi + +msg_info "Creating Service" +cat </etc/systemd/system/slskd.service [Unit] -Description=${APPLICATION} Service +Description=Slskd Service After=network.target Wants=network.target [Service] -WorkingDirectory=/opt/${APPLICATION} -ExecStart=/opt/${APPLICATION}/slskd --config /opt/${APPLICATION}/config/slskd.yml +WorkingDirectory=/opt/slskd +ExecStart=/opt/slskd/slskd --config /opt/slskd/config/slskd.yml Restart=always [Install] WantedBy=multi-user.target EOF -cat </etc/systemd/system/soularr.timer +if [[ -d /opt/soularr ]]; then + cat </etc/systemd/system/soularr.timer [Unit] Description=Soularr service timer RefuseManualStart=no @@ -85,15 +85,15 @@ RefuseManualStop=no [Timer] Persistent=true -# run every 5 minutes -OnCalendar=*-*-* *:0/5:00 +# run every 10 minutes +OnCalendar=*-*-* *:0/10:00 Unit=soularr.service [Install] WantedBy=timers.target EOF -cat </etc/systemd/system/soularr.service + cat </etc/systemd/system/soularr.service [Unit] Description=Soularr service After=network.target slskd.service @@ -106,10 +106,9 @@ ExecStart=/bin/bash -c /opt/soularr/run.sh [Install] WantedBy=multi-user.target EOF -systemctl enable -q --now ${APPLICATION} -systemctl enable -q soularr.timer -rm -rf $tmp_file -rm -rf /tmp/main.zip + msg_warn "Add your Lidarr API key to Soularr in '/opt/soularr/config.ini', then run 'systemctl enable --now soularr.timer'" +fi +systemctl enable -q --now slskd msg_ok "Created Services" motd_ssh