Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] 数据库没有初始化,TTRSS 启动失败 #75

Closed
Zyx-A opened this issue Sep 29, 2019 · 3 comments · Fixed by #79
Closed

[BUG] 数据库没有初始化,TTRSS 启动失败 #75

Zyx-A opened this issue Sep 29, 2019 · 3 comments · Fixed by #79
Labels

Comments

@Zyx-A
Copy link

Zyx-A commented Sep 29, 2019

Describe the bug
数据库没有初始化,TTRSS 启动失败。

该网页无法正常运作
目前无法处理此请求。
HTTP ERROR 500

Have you googled?
Google 没有相关解答

Deployment method

  • Docker
docker version
Client:
 Version:         1.13.1
 API version:     1.26
 Package version: docker-1.13.1-96.gitb2f74b2.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      b2f74b2/1.13.1
 Built:           Wed May  1 14:55:20 2019
 OS/Arch:         linux/amd64

Server:
 Version:         1.13.1
 API version:     1.26 (minimum version 1.12)
 Package version: docker-1.13.1-96.gitb2f74b2.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      b2f74b2/1.13.1
 Built:           Wed May  1 14:55:20 2019
 OS/Arch:         linux/amd64
 Experimental:    false
  • Docker-compose
docker-compose version
docker-compose version 1.24.1, build 4667896
docker-py version: 3.7.3
CPython version: 2.7.5
OpenSSL version: OpenSSL 1.0.2k-fips  26 Jan 2017
  • Version of the image used [e.g. latest, nightly, 19.8]
docker.io/wangqiru/mercury-parser-api   latest              96e94d06f630        28 hours ago        169 MB
docker.io/nginx                         latest              f949e7d76d63        4 days ago          126 MB
docker.io/wangqiru/ttrss                latest              41c6f42f8bb9        4 weeks ago         94.9 MB
docker.io/sameersbn/postgresql          latest              a2e40a2d9cf8        2 months ago        176 MB
docker.io/wangqiru/opencc-api-server    latest              8f6fc60cf70e        4 months ago        98.3 MB

Deployment environment

  • cat /etc/os-release
NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"
ID_LIKE="rhel fedora"
VERSION_ID="7"
PRETTY_NAME="CentOS Linux 7 (Core)"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:centos:centos:7"
HOME_URL="https://www.centos.org/"
BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7"
CENTOS_MANTISBT_PROJECT_VERSION="7"
REDHAT_SUPPORT_PRODUCT="centos"
REDHAT_SUPPORT_PRODUCT_VERSION="7"

To Reproduce
Steps to reproduce the behavior:

  1. wget https://raw.githubusercontent.com/HenryQW/Awesome-TTRSS/master/docker-compose.yml
  2. docker-compose up -d
  3. docker logs ttrss --tail 100
  4. docker logs postgres
Initializing datadir...
Initializing certdir...
Initializing logdir...
Initializing rundir...
Setting resolv.conf ACLs...
Creating database user: ttrss
Creating database: ttrss...
‣ Loading pg_trgm extension...
‣ Granting access to ttrss user...
Starting PostgreSQL 10...
2019-09-29 11:42:26.818 CST [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2019-09-29 11:42:26.818 CST [1] LOG:  listening on IPv6 address "::", port 5432
2019-09-29 11:42:26.845 CST [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2019-09-29 11:42:26.889 CST [1388] LOG:  database system was shut down at 2019-09-29 11:42:26 CST
2019-09-29 11:42:26.905 CST [1] LOG:  database system is ready to accept connections
2019-09-29 11:42:27.809 CST [1395] LOG:  incomplete startup packet
2019-09-29 11:42:28.084 CST [1399] ERROR:  relation "ttrss_version" does not exist at character 28
2019-09-29 11:42:28.084 CST [1399] STATEMENT:  SELECT schema_version FROM ttrss_version
2019-09-29 11:42:29.027 CST [1400] ERROR:  relation "ttrss_version" does not exist at character 28
2019-09-29 11:42:29.027 CST [1400] STATEMENT:  SELECT schema_version FROM ttrss_version
2019-09-29 11:42:30.029 CST [1401] ERROR:  relation "ttrss_version" does not exist at character 28
2019-09-29 11:42:30.029 CST [1401] STATEMENT:  SELECT schema_version FROM ttrss_version
  1. docker exec -it postgres /bin/bash
# sudo -u postgres psql
psql (10.9 (Ubuntu 10.9-1.pgdg18.04+1))
Type "help" for help.

postgres=# \l
                             List of databases
   Name    |  Owner   | Encoding | Collate | Ctype |   Access privileges
-----------+----------+----------+---------+-------+-----------------------
 postgres  | postgres | UTF8     | C       | C     |
 template0 | postgres | UTF8     | C       | C     | =c/postgres          +
           |          |          |         |       | postgres=CTc/postgres
 template1 | postgres | UTF8     | C       | C     | =c/postgres          +
           |          |          |         |       | postgres=CTc/postgres
 ttrss     | postgres | UTF8     | C       | C     | =Tc/postgres         +
           |          |          |         |       | postgres=CTc/postgres+
           |          |          |         |       | ttrss=CTc/postgres
(4 rows)

postgres=# \c ttrss
You are now connected to database "ttrss" as user "postgres".
ttrss=# \d
Did not find any relations.
ttrss=#

Expected behavior
页面能访问

Screenshots
If applicable, add screenshots to help explain your problem.

Error logs

  • docker logs ttrss --tail 100
  thrown in /var/www/include/functions.php on line 850
[06:49:46/1818] Spawn interval: 120 sec
PHP Fatal error:  Uncaught PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "ttrss_version" does not exist
LINE 1: SELECT schema_version FROM ttrss_version
                                   ^ in /var/www/include/functions.php:850
Stack trace:
#0 /var/www/include/functions.php(850): PDO->query('SELECT schema_v...')
#1 /var/www/update_daemon2.php(202): get_schema_version()
#2 {main}
  thrown in /var/www/include/functions.php on line 850
[06:49:47/1820] Spawn interval: 120 sec
PHP Fatal error:  Uncaught PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "ttrss_version" does not exist
LINE 1: SELECT schema_version FROM ttrss_version
                                   ^ in /var/www/include/functions.php:850
Stack trace:
#0 /var/www/include/functions.php(850): PDO->query('SELECT schema_v...')
#1 /var/www/update_daemon2.php(202): get_schema_version()
#2 {main}
  thrown in /var/www/include/functions.php on line 850
[06:49:48/1822] Spawn interval: 120 sec
PHP Fatal error:  Uncaught PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "ttrss_version" does not exist
LINE 1: SELECT schema_version FROM ttrss_version
                                   ^ in /var/www/include/functions.php:850
Stack trace:
#0 /var/www/include/functions.php(850): PDO->query('SELECT schema_v...')
#1 /var/www/update_daemon2.php(202): get_schema_version()
#2 {main}
  thrown in /var/www/include/functions.php on line 850
[06:49:49/1824] Spawn interval: 120 sec
PHP Fatal error:  Uncaught PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "ttrss_version" does not exist
LINE 1: SELECT schema_version FROM ttrss_version
                                   ^ in /var/www/include/functions.php:850
Stack trace:
#0 /var/www/include/functions.php(850): PDO->query('SELECT schema_v...')
#1 /var/www/update_daemon2.php(202): get_schema_version()
#2 {main}
  thrown in /var/www/include/functions.php on line 850
[06:49:50/1826] Spawn interval: 120 sec
PHP Fatal error:  Uncaught PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "ttrss_version" does not exist
LINE 1: SELECT schema_version FROM ttrss_version
                                   ^ in /var/www/include/functions.php:850
Stack trace:
#0 /var/www/include/functions.php(850): PDO->query('SELECT schema_v...')
#1 /var/www/update_daemon2.php(202): get_schema_version()
#2 {main}
  thrown in /var/www/include/functions.php on line 850
[06:49:51/1828] Spawn interval: 120 sec
PHP Fatal error:  Uncaught PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "ttrss_version" does not exist
LINE 1: SELECT schema_version FROM ttrss_version
                                   ^ in /var/www/include/functions.php:850
Stack trace:
#0 /var/www/include/functions.php(850): PDO->query('SELECT schema_v...')
#1 /var/www/update_daemon2.php(202): get_schema_version()
#2 {main}
  thrown in /var/www/include/functions.php on line 850
[06:49:52/1830] Spawn interval: 120 sec
PHP Fatal error:  Uncaught PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "ttrss_version" does not exist
LINE 1: SELECT schema_version FROM ttrss_version
                                   ^ in /var/www/include/functions.php:850
Stack trace:
#0 /var/www/include/functions.php(850): PDO->query('SELECT schema_v...')
#1 /var/www/update_daemon2.php(202): get_schema_version()
#2 {main}
  thrown in /var/www/include/functions.php on line 850
[06:49:53/1832] Spawn interval: 120 sec
PHP Fatal error:  Uncaught PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "ttrss_version" does not exist
LINE 1: SELECT schema_version FROM ttrss_version
                                   ^ in /var/www/include/functions.php:850
Stack trace:
#0 /var/www/include/functions.php(850): PDO->query('SELECT schema_v...')
#1 /var/www/update_daemon2.php(202): get_schema_version()
#2 {main}
  thrown in /var/www/include/functions.php on line 850
[06:49:54/1834] Spawn interval: 120 sec
PHP Fatal error:  Uncaught PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "ttrss_version" does not exist
LINE 1: SELECT schema_version FROM ttrss_version
                                   ^ in /var/www/include/functions.php:850
Stack trace:
#0 /var/www/include/functions.php(850): PDO->query('SELECT schema_v...')
#1 /var/www/update_daemon2.php(202): get_schema_version()
#2 {main}
  thrown in /var/www/include/functions.php on line 850
[06:49:55/1836] Spawn interval: 120 sec
PHP Fatal error:  Uncaught PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "ttrss_version" does not exist
LINE 1: SELECT schema_version FROM ttrss_version
                                   ^ in /var/www/include/functions.php:850
Stack trace:
#0 /var/www/include/functions.php(850): PDO->query('SELECT schema_v...')
#1 /var/www/update_daemon2.php(202): get_schema_version()
#2 {main}
  thrown in /var/www/include/functions.php on line 850
[06:49:57/1838] Spawn interval: 120 sec
PHP Fatal error:  Uncaught PDOException: SQLSTATE[42P01]: Undefined table: 7 ERROR:  relation "ttrss_version" does not exist
LINE 1: SELECT schema_version FROM ttrss_version
                                   ^ in /var/www/include/functions.php:850
Stack trace:
#0 /var/www/include/functions.php(850): PDO->query('SELECT schema_v...')
#1 /var/www/update_daemon2.php(202): get_schema_version()
#2 {main}
  thrown in /var/www/include/functions.php on line 850
  • docker logs postgres --tail 100
2019-09-29 14:49:52.890 CST [13044] ERROR:  relation "ttrss_version" does not exist at character 28
2019-09-29 14:49:52.890 CST [13044] STATEMENT:  SELECT schema_version FROM ttrss_version
2019-09-29 14:49:53.889 CST [13045] ERROR:  relation "ttrss_version" does not exist at character 28
2019-09-29 14:49:53.889 CST [13045] STATEMENT:  SELECT schema_version FROM ttrss_version
2019-09-29 14:49:54.898 CST [13046] ERROR:  relation "ttrss_version" does not exist at character 28
2019-09-29 14:49:54.898 CST [13046] STATEMENT:  SELECT schema_version FROM ttrss_version
2019-09-29 14:49:55.898 CST [13047] ERROR:  relation "ttrss_version" does not exist at character 28
2019-09-29 14:49:55.898 CST [13047] STATEMENT:  SELECT schema_version FROM ttrss_version
2019-09-29 14:49:57.073 CST [13048] ERROR:  relation "ttrss_version" does not exist at character 28
2019-09-29 14:49:57.073 CST [13048] STATEMENT:  SELECT schema_version FROM ttrss_version

Additional context
尝试使用 postgres 官方镜像( postgres:10.1-alpine ),也是同样的报错 https://hub.docker.com/_/postgres

@Zyx-A Zyx-A added the bug label Sep 29, 2019
@lemonbox
Copy link

相同问题

@ccpz
Copy link
Contributor

ccpz commented Sep 30, 2019

Same problem, fix in #76

@Zyx-A
Copy link
Author

Zyx-A commented Sep 30, 2019

感谢 @ccpz 提供的解决方案,该方案实测可用。

注释或删除database.postgres中的DB_NAME参数,并将可持续化的 postgres 库文件(默认位置:~/postgres/data)删干净,即可正常新建并初始化成功。

另外补充下修改docker-compost.yml的注意事项:
因为sameersbn/postgresql:latest镜像具有多个 ENV,所以database.postgres中不要自行添加DB_USERDB_PASS参数,否则操作后,将得到如下日志:

# docker logs ttrss
[07:33:04/27] Spawn interval: 120 sec
[30-Sep-2019 15:33:04] NOTICE: fpm is running, pid 28
[30-Sep-2019 15:33:04] NOTICE: ready to handle connections
<pre>Exception while creating PDO object:SQLSTATE[08006] [7] could not connect to server: Connection refused
	Is the server running on host "localhost" (::1) and accepting
	TCP/IP connections on port 5432?
could not connect to server: Connection refused
	Is the server running on host "localhost" (127.0.0.1) and accepting
	TCP/IP connections on port 5432?</pre>[07:33:05/33] Spawn interval: 120 sec
<pre>Exception while creating PDO object:SQLSTATE[08006] [7] could not connect to server: Connection refused
	Is the server running on host "localhost" (::1) and accepting
	TCP/IP connections on port 5432?
could not connect to server: Connection refused
	Is the server running on host "localhost" (127.0.0.1) and accepting
	TCP/IP connections on port 5432?</pre>[07:33:06/35] Spawn interval: 120 sec
<pre>Exception while creating PDO object:SQLSTATE[08006] [7] could not connect to server: Connection refused
	Is the server running on host "localhost" (::1) and accepting
	TCP/IP connections on port 5432?
could not connect to server: Connection refused
	Is the server running on host "localhost" (127.0.0.1) and accepting
	TCP/IP connections on port 5432?</pre>[07:33:07/37] Spawn interval: 120 sec
<pre>Exception while creating PDO object:SQLSTATE[08006] [7] could not connect to server: Connection refused
	Is the server running on host "localhost" (::1) and accepting
	TCP/IP connections on port 5432?
could not connect to server: Connection refused
	Is the server running on host "localhost" (127.0.0.1) and accepting
	TCP/IP connections on port 5432?</pre>[07:33:08/39] Spawn interval: 120 sec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants