From c6c026e221e886d7c1c4bde48c0635a765f5435b Mon Sep 17 00:00:00 2001 From: bvdberg01 <74251551+bvdberg01@users.noreply.github.com> Date: Tue, 21 Jan 2025 09:02:57 +0100 Subject: [PATCH] New script: ProjectSend (#1616) * New Script: ProjectSend * Update projectsend.json * Update projectsend-install.sh --- ct/projectsend.sh | 71 ++++++++++++++++++++++++++ install/projectsend-install.sh | 91 ++++++++++++++++++++++++++++++++++ json/projectsend.json | 39 +++++++++++++++ 3 files changed, 201 insertions(+) create mode 100644 ct/projectsend.sh create mode 100644 install/projectsend-install.sh create mode 100644 json/projectsend.json diff --git a/ct/projectsend.sh b/ct/projectsend.sh new file mode 100644 index 000000000..f2e845662 --- /dev/null +++ b/ct/projectsend.sh @@ -0,0 +1,71 @@ +#!/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: bvdberg01 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://www.projectsend.org/ + +# App Default Values +APP="ProjectSend" +var_tags="media" +var_cpu="1" +var_ram="1024" +var_disk="8" +var_os="debian" +var_version="12" +var_unprivileged="1" + +# App Output & Base Settings +header_info "$APP" +base_settings + +# Core +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + if [[ ! -d /opt/projectsend ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + RELEASE=$(curl -s https://api.github.com/repos/projectsend/projectsend/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') + if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then + msg_info "Stopping Service" + systemctl stop apache2 + msg_ok "Stopped Service" + + msg_info "Updating ${APP} to v${RELEASE}" + cd /opt + wget -q "https://github.com/projectsend/projectsend/releases/download/r${RELEASE}/projectsend-r${RELEASE}.zip" + unzip -o -q "projectsend-r${RELEASE}.zip" -d projectsend + chown -R www-data:www-data /opt/projectsend + chmod -R 775 /opt/projectsend + echo "${RELEASE}" >/opt/${APP}_version.txt + msg_ok "Updated $APP to v${RELEASE}" + + msg_info "Starting Service" + systemctl start apache2 + msg_ok "Started Service" + + msg_info "Cleaning up" + rm -rf "/opt/projectsend-r${RELEASE}.zip" + msg_ok "Cleaned" + 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}${CL}" diff --git a/install/projectsend-install.sh b/install/projectsend-install.sh new file mode 100644 index 000000000..e6f11732d --- /dev/null +++ b/install/projectsend-install.sh @@ -0,0 +1,91 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: bvdberg01 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/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" +$STD apt-get install -y \ + curl \ + sudo \ + mc \ + mariadb-server \ + apache2 \ + libapache2-mod-php \ + php8.2-{pdo,mysql,mbstring,gettext,fileinfo,gd,xml,zip} +msg_ok "Installed Dependencies" + +msg_info "Setting up MariaDB" +DB_NAME=projectsend +DB_USER=projectsend +DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) +$STD mysql -u root -e "CREATE DATABASE $DB_NAME;" +$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');" +$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;" +{ + echo "projectsend-Credentials" + echo "projectsend Database User: $DB_USER" + echo "projectsend Database Password: $DB_PASS" + echo "projectsend Database Name: $DB_NAME" +} >> ~/projectsend.creds +msg_ok "Set up MariaDB" + +msg_info "Installing projectsend" +RELEASE=$(curl -s https://api.github.com/repos/projectsend/projectsend/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') +cd /opt +wget -q "https://github.com/projectsend/projectsend/releases/download/r${RELEASE}/projectsend-r${RELEASE}.zip" +mkdir projectsend +unzip -q "projectsend-r${RELEASE}.zip" -d projectsend +mv /opt/projectsend/includes/sys.config.sample.php /opt/projectsend/includes/sys.config.php +chown -R www-data:www-data /opt/projectsend +chmod -R 775 /opt/projectsend +chmod 644 /opt/projectsend/includes/sys.config.php +sed -i -e "s/\(define('DB_NAME', \).*/\1'$DB_NAME');/" \ + -e "s/\(define('DB_USER', \).*/\1'$DB_USER');/" \ + -e "s/\(define('DB_PASSWORD', \).*/\1'$DB_PASS');/" \ + /opt/projectsend/includes/sys.config.php +sed -i -e "s/^\(memory_limit = \).*/\1 256M/" \ + -e "s/^\(post_max_size = \).*/\1 256M/" \ + -e "s/^\(upload_max_filesize = \).*/\1 256M/" \ + -e "s/^\(max_execution_time = \).*/\1 300/" \ + /etc/php/8.2/apache2/php.ini +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt +msg_ok "Installed projectsend" + +msg_info "Creating Service" +cat </etc/apache2/sites-available/projectsend.conf + + ServerName projectsend + DocumentRoot /opt/projectsend + + Options FollowSymLinks + AllowOverride All + Require all granted + + + ErrorLog /var/log/apache2/projectsend_error.log + CustomLog /var/log/apache2/projectsend_access.log combined + +EOF +$STD a2ensite projectsend +$STD a2enmod rewrite +$STD a2dissite 000-default.conf +$STD systemctl reload apache2 +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +rm -rf "/opt/projectsend-r${RELEASE}.zip" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned" diff --git a/json/projectsend.json b/json/projectsend.json new file mode 100644 index 000000000..fe3ab3a20 --- /dev/null +++ b/json/projectsend.json @@ -0,0 +1,39 @@ +{ + "name": "ProjectSend", + "slug": "projectsend", + "categories": [ + 12 + ], + "date_created": "2025-01-20", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 80, + "documentation": "https://docs.projectsend.org/", + "website": "https://projectsend.org/", + "logo": "https://camo.githubusercontent.com/378a455e1cf6f36c5427b2bdfd78b0defd829be9b8c6b073f83931693e1665d5/68747470733a2f2f7777772e70726f6a65637473656e642e6f72672f70726f6a65637473656e642d6c6f676f2d6e65772e706e67", + "description": "ProjectSend is a free, open source software that lets you share files with your clients, focused on ease of use and privacy. It supports clients groups, system users roles, statistics, multiple languages, detailed logs... and much more!", + "install_methods": [ + { + "type": "default", + "script": "ct/projectsend.sh", + "resources": { + "cpu": 1, + "ram": 1024, + "hdd": 8, + "os": "debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": null, + "password": null + }, + "notes": [ + { + "text": "After running the update script, logging in as a system user in ProjectSend is necessary to upgrade the database.", + "type": "info" + } + ] + } \ No newline at end of file