Spaces:
Sleeping
Sleeping
Download setup.sh from vectorfox2/tr: direct link, hf CLI and curl.
- Browser
- Download file 2.82 kB
-
https://huggingface.co/spaces/vectorfox2/tr/resolve/main/setup.sh
- Command line
-
hf download hf://spaces/vectorfox2/tr/setup.sh
-
curl -L -o setup.sh https://huggingface.co/spaces/vectorfox2/tr/resolve/main/setup.sh
2.82 kB
| set -e | |
| echo "=== Tiny Tiny RSS Setup Script ===" | |
| echo "This script will install and configure tt-rss from scratch" | |
| echo "" | |
| # Check if running as root | |
| if [ "$EUID" -ne 0 ]; then | |
| echo "Please run as root" | |
| exit 1 | |
| fi | |
| # Install dependencies | |
| echo "[1/8] Installing dependencies..." | |
| apt-get update | |
| apt-get install -y software-properties-common curl git postgresql nginx kmod sudo | |
| # Add PHP repository and install PHP 8.2 | |
| echo "[2/8] Installing PHP 8.2..." | |
| add-apt-repository -y ppa:ondrej/php | |
| apt-get update | |
| apt-get install -y php8.2 php8.2-fpm php8.2-pgsql php8.2-curl php8.2-gd php8.2-intl php8.2-mbstring php8.2-xml php8.2-zip | |
| # Clone tt-rss if not already present | |
| echo "[3/8] Cloning tt-rss repository..." | |
| if [ ! -f "/tmp/ttrss/index.php" ]; then | |
| git clone https://git.tt-rss.org/fox/tt-rss.git /tmp/ttrss | |
| fi | |
| # Setup PostgreSQL | |
| echo "[4/8] Configuring PostgreSQL..." | |
| service postgresql start | |
| sleep 2 | |
| # Create database user and database | |
| su - postgres -c "psql -tc \"SELECT 1 FROM pg_user WHERE usename = 'ttrss'\" | grep -q 1 || psql -c \"CREATE USER ttrss WITH PASSWORD 'ttrss123';\"" | |
| su - postgres -c "psql -tc \"SELECT 1 FROM pg_database WHERE datname = 'ttrss'\" | grep -q 1 || psql -c \"CREATE DATABASE ttrss OWNER ttrss;\"" | |
| # Create tt-rss config | |
| echo "[5/8] Creating configuration..." | |
| cat > /tmp/ttrss/config.php <<'PHPCONFIG' | |
| <?php | |
| putenv('TTRSS_DB_TYPE=pgsql'); | |
| putenv('TTRSS_DB_HOST=localhost'); | |
| putenv('TTRSS_DB_PORT=5432'); | |
| putenv('TTRSS_DB_NAME=ttrss'); | |
| putenv('TTRSS_DB_USER=ttrss'); | |
| putenv('TTRSS_DB_PASS=ttrss123'); | |
| putenv('TTRSS_SELF_URL_PATH=http://localhost:8281/'); | |
| PHPCONFIG | |
| # Set permissions | |
| chown -R www-data:www-data /tmp/ttrss | |
| chmod -R 755 /tmp/ttrss | |
| # Initialize database schema | |
| echo "[6/8] Initializing database..." | |
| echo "yes" | sudo -u www-data php /tmp/ttrss/update.php --update-schema | |
| # Set admin password | |
| sudo -u www-data php /tmp/ttrss/update.php --user-set-password admin:admin123 | |
| # Configure Nginx | |
| echo "[7/8] Configuring web server..." | |
| cat > /etc/nginx/sites-available/ttrss <<'NGINXCONFIG' | |
| server { | |
| listen 8281; | |
| server_name localhost; | |
| root /tmp/ttrss; | |
| index index.php; | |
| access_log /var/log/nginx/ttrss_access.log; | |
| error_log /var/log/nginx/ttrss_error.log; | |
| location / { | |
| try_files $uri $uri/ =404; | |
| } | |
| location ~ \.php$ { | |
| include snippets/fastcgi-php.conf; | |
| fastcgi_pass unix:/var/run/php/php8.2-fpm.sock; | |
| fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
| include fastcgi_params; | |
| } | |
| location ~ /\.ht { | |
| deny all; | |
| } | |
| } | |
| NGINXCONFIG | |
| ln -sf /etc/nginx/sites-available/ttrss /etc/nginx/sites-enabled/ | |
| rm -f /etc/nginx/sites-enabled/default | |
| cd /tmp/ttrss/plugins.local/ | |
| git clone https://github.com/vector090/tt-rss-plugin-card-view card_view | |