Spaces:
Sleeping
Sleeping
File size: 2,824 Bytes
dcfe930 b976eee dcfe930 74366b2 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | #!/bin/bash
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
|