Tt-rss throwing 500 error

I created the container with

docker create -it --name ttrss --restart unless-stopped `
-e "SELF_URL_PATH=http://localhost:9002/" `
-e "DB_TYPE=mysql" `
-e "DB_HOST=host.docker.internal" `
-e "DB_PORT=3306" `
-e "DB_NAME=ttrss" `
-e "DB_USER=ttrss" `
-e "DB_PASS=[redacted]" `
-e "TZ=Asia/Shanghai" `
-e PUID=1000 `
-e PGID=1000 `
-p "9002:80" `
-v "Z:\wwwroot\Docker Mount Points\Tiny Tiny RSS:/config" `
linuxserver/tt-rss

Then running docker start ttrss. But I get 500 error connecting to localhost:9002

docker logs ttrss output seems to be fine. So what could be wrong?

I also tried to create a php to test whether the conncetion is working.

#~ cat << 'EOF' >> test.php
<?php
$dbname = 'ttrss';
$dbuser = 'ttrss';
$dbpass = '[redacted]';
$dbhost = 'host.docker.internal';
$connect = mysqli_connect($dbhost, $dbuser, $dbpass) or die("Unable to Connect to '$dbhost'");
mysqli_select_db($connect, $dbname) or die("Could not open the db '$dbname'");
$test_query = "SHOW TABLES FROM $dbname";
$result = mysqli_query($connect, $test_query);
$tblCnt = 0;
while($tbl = mysqli_fetch_array($result)) {
  $tblCnt++;
  #echo $tbl[0]."<br />\n";
}
if (!$tblCnt) {
  echo "There are no tables<br />\n";
} else {
  echo "There are $tblCnt tables<br />\n";
}
EOF

And it shows that there is no tables. So at least databse connection works. Besides, there is no error log for php.

It turns out that the docker image doesn’t initialize the ttrss database. Seems to be a bug.

root@b96cee9ffec3:/var/www/html# sudo -u abc php -f index.php
PHP Fatal error:  Uncaught PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ttrss.ttrss_version' doesn't exist in /var/www/html/include/functions.php:850
Stack trace:
#0 /var/www/html/include/functions.php(850): PDO->query('SELECT schema_v...')
#1 /var/www/html/plugins/auth_internal/init.php(27): get_schema_version()
#2 /var/www/html/include/functions.php(520): Auth_Internal->authenticate(NULL, NULL)
#3 /var/www/html/include/functions.php(679): authenticate_user(NULL, NULL)
#4 /var/www/html/index.php(32): login_sequence()
#5 {main}
  thrown in /var/www/html/include/functions.php on line 850
PHP Fatal error:  Uncaught PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'ttrss.ttrss_version' doesn't exist in /var/www/html/include/functions.php:850
Stack trace:
#0 /var/www/html/include/functions.php(850): PDO->query('SELECT schema_v...')
#1 /var/www/html/classes/logger/sql.php(11): get_schema_version()
#2 /var/www/html/classes/logger.php(28): Logger_SQL->log_error(1, 'Uncaught PDOExc...', 'include/functio...', 850, '')
#3 /var/www/html/include/errorhandler.php(66): Logger->log_error(1, 'Uncaught PDOExc...', 'include/functio...', 850, '')
#4 [internal function]: ttrss_fatal_handler()
#5 {main}
  thrown in /var/www/html/include/functions.php on line 850

If it’s a fresh install, you do so via the wizard. As you haven’t provided any information about how you deployed the container, I’m assuming you’ve used the additional flags here https://github.com/linuxserver/docker-tt-rss/#power-users and not read that it’s actually for per-existing installs.

Apologies, I just noticed you provided the info above the other post…will teach me for not scrolling up!

So yea, remove all the DB / power user flags and you will get the setup wizard which will go through getting the database setup.

Ah thanks. Though it would be sweet if we could create the database with those environment variables set🤣

Just a little note here… The default sql schema created by tt-rss is UTF8 and lacks some unicode functionality like emojis. So if you care those things I do recommend cp /var/www/html/schema/ttrss_schema_mysql.sql /config and edit the sql file on your need, like replacing DEFAULT CHARSET=UTF8 with DEFAULT CHARSET=UTF8MB4 COLLATE utf8mb4_unicode_ci

I suspect this would be better reported upstream to TT-RSS directly.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.