From 6d210f021cf10dbda19d0032e9b62704378940a2 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Tue, 13 Jan 2026 10:09:11 +0100 Subject: [PATCH] ampache --- ct/ampache.sh | 74 +++++++++++++++++++++++++ ct/deferred/ampache.sh | 48 ----------------- install/ampache-install.sh | 58 ++++++++++++++++++++ install/deferred/ampache-install.sh | 83 ----------------------------- 4 files changed, 132 insertions(+), 131 deletions(-) create mode 100644 ct/ampache.sh delete mode 100644 ct/deferred/ampache.sh create mode 100644 install/ampache-install.sh delete mode 100644 install/deferred/ampache-install.sh diff --git a/ct/ampache.sh b/ct/ampache.sh new file mode 100644 index 000000000..eb5e949c0 --- /dev/null +++ b/ct/ampache.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func) +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (Canbiz) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/ampache/ampache + +APP="Ampache" +var_tags="${var_tags:-music}" +var_disk="${var_disk:-5}" +var_cpu="${var_cpu:-4}" +var_ram="${var_ram:-2048}" +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/ampache ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + if check_for_gh_release "Ampache" "ampache/ampache"; then + msg_info "Stopping Apache" + systemctl stop apache2 + msg_ok "Stopped Apache" + + msg_info "Backing up Configuration" + cp /opt/ampache/config/ampache.cfg.php /tmp/ampache.cfg.php.backup + cp /opt/ampache/rest/.htaccess /tmp/ampache_rest.htaccess.backup + cp /opt/ampache/play/.htaccess /tmp/ampache_play.htaccess.backup + cp /opt/ampache/channel/.htaccess /tmp/ampache_channel.htaccess.backup + msg_ok "Backed up Configuration" + + msg_info "Backup Ampache Folder" + rm -rf /opt/ampache_backup + mv /opt/ampache /opt/ampache_backup + msg_ok "Backed up Ampache" + + fetch_and_deploy_gh_release "Ampache" "ampache/ampache" "release" "latest" "/opt/ampache" "ampache-*_all_php8.4.zip" + + msg_info "Restoring Configuration" + cp /tmp/ampache.cfg.php.backup /opt/ampache/config/ampache.cfg.php + cp /tmp/ampache_rest.htaccess.backup /opt/ampache/rest/.htaccess + cp /tmp/ampache_play.htaccess.backup /opt/ampache/play/.htaccess + cp /tmp/ampache_channel.htaccess.backup /opt/ampache/channel/.htaccess + chmod 664 /opt/ampache/rest/.htaccess /opt/ampache/play/.htaccess /opt/ampache/channel/.htaccess + chown -R www-data:www-data /opt/ampache + rm -f /tmp/ampache*.backup + msg_ok "Restored Configuration" + + msg_info "Starting Apache" + systemctl start apache2 + msg_ok "Started Apache" + msg_ok "Updated successfully!" + 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}/install.php${CL}" diff --git a/ct/deferred/ampache.sh b/ct/deferred/ampache.sh deleted file mode 100644 index 068b2675a..000000000 --- a/ct/deferred/ampache.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash -source <(curl -fsSL https://git.community-scripts.org/community-scripts/ProxmoxVED/raw/branch/main/misc/build.func) -# Copyright (c) 2021-2026 community-scripts ORG -# Author: MickLesk (Canbiz) -# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE -# Source: - -APP="Ampache" -var_tags="${var_tags:-music}" -var_disk="${var_disk:-5}" -var_cpu="${var_cpu:-4}" -var_ram="${var_ram:-2048}" -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/ampache ]]; then - msg_error "No ${APP} Installation Found!" - exit - fi - if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then - msg_info "Updating ${APP} LXC" - cd /opt/ampache - ###### Update Script Here ###### - msg_ok "Updated Successfully" - 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}/install.php${CL}" diff --git a/install/ampache-install.sh b/install/ampache-install.sh new file mode 100644 index 000000000..c3892c15d --- /dev/null +++ b/install/ampache-install.sh @@ -0,0 +1,58 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2026 community-scripts ORG +# Author: MickLesk (Canbiz) +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/ampache/ampache + +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 \ + flac \ + vorbis-tools \ + lame \ + ffmpeg \ + inotify-tools \ + libavcodec-extra \ + libmp3lame-dev \ + libtheora-dev \ + libvorbis-dev \ + libvpx-dev +msg_ok "Installed Dependencies" + +PHP_VERSION=8.4 PHP_MODULE=bcmath,bz2,curl,gd,imagick,intl,mbstring,mysql,sqlite3,xml,xmlrpc,zip PHP_APACHE=YES setup_php +setup_mariadb +DB_NAME=ampache DB_USER=ampache setup_mariadb_db + +fetch_and_deploy_gh_release "Ampache" "ampache/ampache" "release" "latest" "/opt/ampache" "ampache-*_all_php8.4.zip" + +msg_info "Setup Ampache" +rm -rf /var/www/html +ln -s /opt/ampache/public /var/www/html +mv /opt/ampache/rest/.htaccess.dist /opt/ampache/rest/.htaccess +mv /opt/ampache/play/.htaccess.dist /opt/ampache/play/.htaccess +mv /opt/ampache/channel/.htaccess.dist /opt/ampache/channel/.htaccess +cp /opt/ampache/config/ampache.cfg.php.dist /opt/ampache/config/ampache.cfg.php +chmod 664 /opt/ampache/rest/.htaccess /opt/ampache/play/.htaccess /opt/ampache/channel/.htaccess +chown -R www-data:www-data /opt/ampache +msg_ok "Set up Ampache" + +msg_info "Configuring PHP" +sed -i 's/upload_max_filesize = .*/upload_max_filesize = 100M/' /etc/php/8.4/apache2/php.ini +sed -i 's/post_max_size = .*/post_max_size = 100M/' /etc/php/8.4/apache2/php.ini +sed -i 's/max_execution_time = .*/max_execution_time = 600/' /etc/php/8.4/apache2/php.ini +sed -i 's/memory_limit = .*/memory_limit = 512M/' /etc/php/8.4/apache2/php.ini +$STD a2enmod rewrite +$STD systemctl restart apache2 +msg_ok "Configured PHP" + +motd_ssh +customize +cleanup_lxc diff --git a/install/deferred/ampache-install.sh b/install/deferred/ampache-install.sh deleted file mode 100644 index 35dfe1430..000000000 --- a/install/deferred/ampache-install.sh +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env bash - -# Copyright (c) 2021-2024 tteck -# Author: MickLesk (Canbiz) -# License: MIT -# https://github.com/tteck/Proxmox/raw/main/LICENSE - -source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" -color -verb_ip6 -catch_errors -setting_up_container -network_check -update_os - -msg_info "Installing Dependencies (Patience)" -apt-get install -y \ - apache2 \ - cron \ - flac \ - vorbis-tools \ - lame \ - ffmpeg \ - lsb-release \ - gosu \ - wget \ - curl \ - git \ - make \ - inotify-tools \ - libavcodec-extra \ - libev-libevent-dev \ - libmp3lame-dev \ - libtheora-dev \ - libvorbis-dev \ - libvpx-dev -msg_ok "Installed Dependencies" - -PHP_VERSION=8.4 -PHP_MODULE=bcmath,bz2,cli,common,curl,fpm,gd,imagick,intl,mbstring,mysql,sqlite3,xml,xmlrpc,zip -PHP_APACHE=YES -setup_php -setup_mariadb - -msg_info "Setting up Database" -DB_NAME=ampache2 -DB_USER=ampache2 -DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) -sudo mysql -u root -e "CREATE DATABASE $DB_NAME;" -sudo mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');" -sudo mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;" -echo "" >>~/ampache.creds -echo -e "Ampache Database User: \e $DB_USER\e" >>~/ampache.creds -echo -e "Ampache Database Password: \e$DB_PASS\e" >>~/ampache.creds -echo -e "Ampache Database Name: \e$DB_NAME\e" >>~/ampache.creds -msg_ok "Set up database" - -msg_info "Installing Ampache(Patience)" -cd /opt -AMPACHE_VERSION=$(wget -q https://github.com/ampache/ampache/releases/latest -O - | grep "title>Release" | cut -d " " -f 4) -wget https://github.com/ampache/ampache/releases/download/${AMPACHE_VERSION}/ampache-${AMPACHE_VERSION}_all_php8.4.zip -unzip -q ampache-${AMPACHE_VERSION}_all_php8.4.zip -d ampache -rm -rf /var/www/html -ln -s /opt/ampache/public /var/www/html -sudo mv /opt/ampache/rest/.htaccess.dist /opt/ampache/rest/.htaccess -sudo mv /opt/ampache/play/.htaccess.dist /opt/ampache/play/.htaccess -sudo mv /opt/ampache/channel/.htaccess.dist /opt/ampache/channel/.htaccess -sudo cp /opt/ampache/config/ampache.cfg.php.dist /opt/ampache/config/ampache.cfg.php -sudo chmod 664 /opt/ampache/rest/.htaccess /opt/ampache/play/.htaccess -sudo sed -i 's/upload_max_filesize = .*/upload_max_filesize = 50M/' /etc/php/8.4/apache2/php.ini && - sudo sed -i 's/post_max_size = .*/post_max_size = 50M/' /etc/php/8.4/apache2/php.ini && - sudo sed -i 's/max_execution_time = .*/max_execution_time = 300/' /etc/php/8.4/apache2/php.ini && - sudo sed -i 's/memory_limit = .*/memory_limit = 256M/' /etc/php/8.4/apache2/php.ini && - sudo systemctl restart apache2 -msg_ok "Installed Ampache" - -motd_ssh -customize - -msg_info "Cleaning up" -$STD apt-get autoremove -$STD apt-get autoclean -msg_ok "Cleaned"