|
| 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 | + postgresql \ |
| 21 | + apache2 \ |
| 22 | + php-{curl,dom,json,ctype,pgsql,gmp,mbstring,iconv,zip} \ |
| 23 | + libapache2-mod-php |
| 24 | +msg_ok "Installed Dependencies" |
| 25 | + |
| 26 | + |
| 27 | +msg_info "Setting up PostgreSQL" |
| 28 | +DB_NAME=freshrss |
| 29 | +DB_USER=freshrss |
| 30 | +DB_PASS=$(openssl rand -base64 18 | tr -dc 'a-zA-Z0-9' | cut -c1-13) |
| 31 | +$STD sudo -u postgres psql -c "CREATE ROLE $DB_USER WITH LOGIN PASSWORD '$DB_PASS';" |
| 32 | +$STD sudo -u postgres psql -c "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER TEMPLATE template0;" |
| 33 | +{ |
| 34 | +echo "FreshRSS Credentials" |
| 35 | +echo "FreshRSS Database User: $DB_USER" |
| 36 | +echo "FreshRSS Database Password: $DB_PASS" |
| 37 | +echo "FreshRSS Database Name: $DB_NAME" |
| 38 | +} >> ~/freshrss.creds |
| 39 | +msg_ok "Set up PostgreSQL" |
| 40 | + |
| 41 | +msg_info "Installing FreshRSS" |
| 42 | +RELEASE=$(curl -s https://api.github.com/repos/FreshRSS/FreshRSS/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') |
| 43 | +cd /opt |
| 44 | +wget -q "https://github.com/FreshRSS/FreshRSS/archive/refs/tags/${RELEASE}.zip" |
| 45 | +unzip -q "${RELEASE}.zip" |
| 46 | +mv "/opt/FreshRSS-${RELEASE}" /opt/freshrss |
| 47 | +cd /opt/freshrss |
| 48 | +chown -R www-data:www-data /opt/freshrss |
| 49 | +chmod -R g+rX /opt/freshrss |
| 50 | +chmod -R g+w /opt/freshrss/data/ |
| 51 | +msg_ok "Installed FreshRSS" |
| 52 | + |
| 53 | +msg_info "Creating Service" |
| 54 | +cat <<EOF >/etc/apache2/sites-available/freshrss.conf |
| 55 | +<VirtualHost *:80> |
| 56 | + ServerName freshrss |
| 57 | + DocumentRoot /opt/freshrss/p |
| 58 | +
|
| 59 | + <Directory /opt/freshrss/p> |
| 60 | + Options FollowSymLinks |
| 61 | + AllowOverride All |
| 62 | + Require all granted |
| 63 | + </Directory> |
| 64 | +
|
| 65 | + ErrorLog /var/log/apache2/freshrss_error.log |
| 66 | + CustomLog /var/log/apache2/freshrss_access.log combined |
| 67 | +
|
| 68 | + AllowEncodedSlashes On |
| 69 | +</VirtualHost> |
| 70 | +EOF |
| 71 | +$STD a2ensite freshrss |
| 72 | +$STD a2enmod rewrite |
| 73 | +$STD a2dissite 000-default.conf |
| 74 | +$STD systemctl reload apache2 |
| 75 | +msg_ok "Created Service" |
| 76 | + |
| 77 | +motd_ssh |
| 78 | +customize |
| 79 | + |
| 80 | +msg_info "Cleaning up" |
| 81 | +rm -rf "/opt/${RELEASE}.zip" |
| 82 | +$STD apt-get -y autoremove |
| 83 | +$STD apt-get -y autoclean |
| 84 | +msg_ok "Cleaned" |
0 commit comments