docker-ttrss icon indicating copy to clipboard operation
docker-ttrss copied to clipboard

Trying to recreate db, but ttrss-configure-db.php fails when applying schema

Open mozster opened this issue 3 years ago • 2 comments

I'd like to start again with a fresh install, so I moved my /data folder out of the way, and expected the docker container to create a new database for my installation, but it appears to fail during the database creation process:

ttrss    | Setup: Database
ttrss    | Configuring database for: /var/www/ttrss/config.php
ttrss_postgres | 2022-02-18 11:14:45.490 UTC [69] FATAL:  password authentication failed for user "ttrss"
ttrss_postgres | 2022-02-18 11:14:45.490 UTC [69] DETAIL:  Role "ttrss" does not exist.
ttrss_postgres | 	Connection matched pg_hba.conf line 100: "host all all all scram-sha-256"
ttrss    | pgsql:host=db;port=5432;dbname=ttrss;user=user;password=password;Database login failed, trying to create ...
ttrss    | pgsql:host=db;port=5432;user=user;password=password;pgsql:host=db;port=5432;dbname=ttrss;user=user;password=password;Database login created and confirmed
ttrss_postgres | 2022-02-18 11:14:46.305 UTC [72] ERROR:  relation "ttrss_feeds" does not exist at character 15
ttrss_postgres | 2022-02-18 11:14:46.305 UTC [72] STATEMENT:  SELECT 1 FROM ttrss_feeds
ttrss    | pgsql:host=db;port=5432;dbname=ttrss;user=user;password=password;Database table not found, applying schema... 
ttrss    | PHP Fatal error:  Uncaught PDOException: SQLSTATE[HY000]: General error: trying to execute an empty query in /srv/ttrss-configure-db.php:82
ttrss    | Stack trace:
ttrss    | #0 /srv/ttrss-configure-db.php(82): PDO->exec()
ttrss    | #1 {main}
ttrss    |   thrown in /srv/ttrss-configure-db.php on line 82

is this a fault in the script?

mozster avatar Feb 18 '22 11:02 mozster

I've managed to get past the error by doing the following (I'm not sure if all of them are necessary, but it's working now)

  1. add yet more environment params to the ttrss container
      TTRSS_DB_HOST: "db"
      TTRSS_DB_NAME: "ttrss"
      TTRSS_DB_PASS: "password"
      TTRSS_DB_USER: "user"
  1. log into the ttrss container and modify /etc/passwd to allow www-data user to login docker exec -it ttrss sh followed by vi /etc/passwd modify the www-data user as follows: www-data:x:82:82:Linux User,,,:/home/www-data:/bin/ash
  2. while still in the container run the update schema script to generate the correct schema su www-data -c 'php /var/www/ttrss/update.php --update-schema'
  3. restore the www-data user to www-data:x:82:82:Linux User,,,:/home/www-data:/sbin/nologin
  4. restart the containers

mozster avatar Feb 18 '22 14:02 mozster

Probably to the new database scheme intrdouced, see https://github.com/x86dev/docker-ttrss/issues/56#issuecomment-1066115587

x86dev avatar Sep 25 '22 18:09 x86dev