|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# Copyright (c) 2021-2025 community-scripts ORG |
| 4 | +# Author: bvdberg01 |
| 5 | +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE |
| 6 | + |
| 7 | +source /dev/stdin <<< "$FUNCTIONS_FILE_PATH" |
| 8 | +color |
| 9 | +verb_ip6 |
| 10 | +catch_errors |
| 11 | +setting_up_container |
| 12 | +network_check |
| 13 | +update_os |
| 14 | + |
| 15 | +msg_info "Installing Dependencies" |
| 16 | +$STD apt-get install -y \ |
| 17 | + curl \ |
| 18 | + sudo \ |
| 19 | + mc \ |
| 20 | + mariadb-server \ |
| 21 | + apache2 \ |
| 22 | + libapache2-mod-php \ |
| 23 | + php8.2-{pdo,mysql,mbstring,gettext,fileinfo,gd,xml,zip} |
| 24 | +msg_ok "Installed Dependencies" |
| 25 | + |
| 26 | +msg_info "Setting up MariaDB" |
| 27 | +DB_NAME=projectsend |
| 28 | +DB_USER=projectsend |
| 29 | +DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | head -c13) |
| 30 | +$STD mysql -u root -e "CREATE DATABASE $DB_NAME;" |
| 31 | +$STD mysql -u root -e "CREATE USER '$DB_USER'@'localhost' IDENTIFIED WITH mysql_native_password AS PASSWORD('$DB_PASS');" |
| 32 | +$STD mysql -u root -e "GRANT ALL ON $DB_NAME.* TO '$DB_USER'@'localhost'; FLUSH PRIVILEGES;" |
| 33 | +{ |
| 34 | + echo "projectsend-Credentials" |
| 35 | + echo "projectsend Database User: $DB_USER" |
| 36 | + echo "projectsend Database Password: $DB_PASS" |
| 37 | + echo "projectsend Database Name: $DB_NAME" |
| 38 | +} >> ~/projectsend.creds |
| 39 | +msg_ok "Set up MariaDB" |
| 40 | + |
| 41 | +msg_info "Installing projectsend" |
| 42 | +RELEASE=$(curl -s https://api.github.com/repos/projectsend/projectsend/releases/latest | grep "tag_name" | awk '{print substr($2, 3, length($2)-4) }') |
| 43 | +cd /opt |
| 44 | +wget -q "https://github.com/projectsend/projectsend/releases/download/r${RELEASE}/projectsend-r${RELEASE}.zip" |
| 45 | +mkdir projectsend |
| 46 | +unzip -q "projectsend-r${RELEASE}.zip" -d projectsend |
| 47 | +mv /opt/projectsend/includes/sys.config.sample.php /opt/projectsend/includes/sys.config.php |
| 48 | +chown -R www-data:www-data /opt/projectsend |
| 49 | +chmod -R 775 /opt/projectsend |
| 50 | +chmod 644 /opt/projectsend/includes/sys.config.php |
| 51 | +sed -i -e "s/\(define('DB_NAME', \).*/\1'$DB_NAME');/" \ |
| 52 | + -e "s/\(define('DB_USER', \).*/\1'$DB_USER');/" \ |
| 53 | + -e "s/\(define('DB_PASSWORD', \).*/\1'$DB_PASS');/" \ |
| 54 | + /opt/projectsend/includes/sys.config.php |
| 55 | +sed -i -e "s/^\(memory_limit = \).*/\1 256M/" \ |
| 56 | + -e "s/^\(post_max_size = \).*/\1 256M/" \ |
| 57 | + -e "s/^\(upload_max_filesize = \).*/\1 256M/" \ |
| 58 | + -e "s/^\(max_execution_time = \).*/\1 300/" \ |
| 59 | + /etc/php/8.2/apache2/php.ini |
| 60 | +echo "${RELEASE}" >/opt/${APPLICATION}_version.txt |
| 61 | +msg_ok "Installed projectsend" |
| 62 | + |
| 63 | +msg_info "Creating Service" |
| 64 | +cat <<EOF >/etc/apache2/sites-available/projectsend.conf |
| 65 | +<VirtualHost *:80> |
| 66 | + ServerName projectsend |
| 67 | + DocumentRoot /opt/projectsend |
| 68 | + <Directory /opt/projectsend> |
| 69 | + Options FollowSymLinks |
| 70 | + AllowOverride All |
| 71 | + Require all granted |
| 72 | + </Directory> |
| 73 | +
|
| 74 | + ErrorLog /var/log/apache2/projectsend_error.log |
| 75 | + CustomLog /var/log/apache2/projectsend_access.log combined |
| 76 | +</VirtualHost> |
| 77 | +EOF |
| 78 | +$STD a2ensite projectsend |
| 79 | +$STD a2enmod rewrite |
| 80 | +$STD a2dissite 000-default.conf |
| 81 | +$STD systemctl reload apache2 |
| 82 | +msg_ok "Created Service" |
| 83 | + |
| 84 | +motd_ssh |
| 85 | +customize |
| 86 | + |
| 87 | +msg_info "Cleaning up" |
| 88 | +rm -rf "/opt/projectsend-r${RELEASE}.zip" |
| 89 | +$STD apt-get -y autoremove |
| 90 | +$STD apt-get -y autoclean |
| 91 | +msg_ok "Cleaned" |
0 commit comments