rootuc commited on
Commit
dcfe930
·
1 Parent(s): fdc0a12
Files changed (3) hide show
  1. Dockerfile +8 -0
  2. README.md +1 -0
  3. setup.sh +118 -0
Dockerfile ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+
2
+ FROM ubuntu
3
+
4
+ ADD setup.sh /
5
+
6
+ RUN bash /setup.sh
7
+
8
+ CMD ["nginx"]
README.md CHANGED
@@ -4,6 +4,7 @@ emoji: 😻
4
  colorFrom: green
5
  colorTo: yellow
6
  sdk: docker
 
7
  pinned: false
8
  ---
9
 
 
4
  colorFrom: green
5
  colorTo: yellow
6
  sdk: docker
7
+ app_port: 8281
8
  pinned: false
9
  ---
10
 
setup.sh ADDED
@@ -0,0 +1,118 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+ set -e
3
+
4
+ echo "=== Tiny Tiny RSS Setup Script ==="
5
+ echo "This script will install and configure tt-rss from scratch"
6
+ echo ""
7
+
8
+ # Check if running as root
9
+ if [ "$EUID" -ne 0 ]; then
10
+ echo "Please run as root"
11
+ exit 1
12
+ fi
13
+
14
+ # Install dependencies
15
+ echo "[1/8] Installing dependencies..."
16
+ apt-get update
17
+ apt-get install -y software-properties-common curl git postgresql nginx kmod
18
+
19
+ # Add PHP repository and install PHP 8.2
20
+ echo "[2/8] Installing PHP 8.2..."
21
+ add-apt-repository -y ppa:ondrej/php
22
+ apt-get update
23
+ 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
24
+
25
+ # Clone tt-rss if not already present
26
+ echo "[3/8] Cloning tt-rss repository..."
27
+ if [ ! -f "/tmp/ttrss/index.php" ]; then
28
+ git clone https://git.tt-rss.org/fox/tt-rss.git /tmp/ttrss
29
+ fi
30
+
31
+ # Setup PostgreSQL
32
+ echo "[4/8] Configuring PostgreSQL..."
33
+ service postgresql start
34
+ sleep 2
35
+
36
+ # Create database user and database
37
+ su - postgres -c "psql -tc \"SELECT 1 FROM pg_user WHERE usename = 'ttrss'\" | grep -q 1 || psql -c \"CREATE USER ttrss WITH PASSWORD 'ttrss123';\""
38
+ su - postgres -c "psql -tc \"SELECT 1 FROM pg_database WHERE datname = 'ttrss'\" | grep -q 1 || psql -c \"CREATE DATABASE ttrss OWNER ttrss;\""
39
+
40
+ # Create tt-rss config
41
+ echo "[5/8] Creating configuration..."
42
+ cat > /tmp/ttrss/config.php <<'PHPCONFIG'
43
+ <?php
44
+ putenv('TTRSS_DB_TYPE=pgsql');
45
+ putenv('TTRSS_DB_HOST=localhost');
46
+ putenv('TTRSS_DB_PORT=5432');
47
+ putenv('TTRSS_DB_NAME=ttrss');
48
+ putenv('TTRSS_DB_USER=ttrss');
49
+ putenv('TTRSS_DB_PASS=ttrss123');
50
+ putenv('TTRSS_SELF_URL_PATH=http://localhost:8281/');
51
+ PHPCONFIG
52
+
53
+ # Set permissions
54
+ chown -R www-data:www-data /tmp/ttrss
55
+ chmod -R 755 /tmp/ttrss
56
+
57
+ # Initialize database schema
58
+ echo "[6/8] Initializing database..."
59
+ echo "yes" | sudo -u www-data php /tmp/ttrss/update.php --update-schema
60
+
61
+ # Set admin password
62
+ sudo -u www-data php /tmp/ttrss/update.php --user-set-password admin:admin123
63
+
64
+ # Configure Nginx
65
+ echo "[7/8] Configuring web server..."
66
+ cat > /etc/nginx/sites-available/ttrss <<'NGINXCONFIG'
67
+ server {
68
+ listen 8281;
69
+ server_name localhost;
70
+ root /tmp/ttrss;
71
+ index index.php;
72
+
73
+ access_log /var/log/nginx/ttrss_access.log;
74
+ error_log /var/log/nginx/ttrss_error.log;
75
+
76
+ location / {
77
+ try_files $uri $uri/ =404;
78
+ }
79
+
80
+ location ~ \.php$ {
81
+ include snippets/fastcgi-php.conf;
82
+ fastcgi_pass unix:/var/run/php/php8.2-fpm.sock;
83
+ fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
84
+ include fastcgi_params;
85
+ }
86
+
87
+ location ~ /\.ht {
88
+ deny all;
89
+ }
90
+ }
91
+ NGINXCONFIG
92
+
93
+ ln -sf /etc/nginx/sites-available/ttrss /etc/nginx/sites-enabled/
94
+ rm -f /etc/nginx/sites-enabled/default
95
+
96
+ # Start services
97
+ echo "[8/8] Starting services..."
98
+ service php8.2-fpm start
99
+ service nginx restart
100
+
101
+ # Start feed updater daemon
102
+ sudo -u www-data php /tmp/ttrss/update.php --daemon > /tmp/ttrss-updater.log 2>&1 &
103
+
104
+ echo ""
105
+ echo "=== Setup Complete! ==="
106
+ echo ""
107
+ echo "tt-rss is now running at: http://localhost:8281/"
108
+ echo ""
109
+ echo "Login credentials:"
110
+ echo " Username: admin"
111
+ echo " Password: admin123"
112
+ echo ""
113
+ echo "Services running:"
114
+ echo " - PostgreSQL database"
115
+ echo " - PHP 8.2-FPM"
116
+ echo " - Nginx web server"
117
+ echo " - tt-rss feed updater daemon"
118
+ echo ""