chaitin / SafeLine

serve as a reverse proxy to protect your web services from attacks and exploits.
https://waf.chaitin.com
GNU General Public License v3.0
13.19k stars 813 forks source link

[Bug] Failed to connect to postgresql DB #1041

Closed vin-c-ent closed 2 months ago

vin-c-ent commented 3 months ago

What happened?

在威联通NAS的QTS系统通过docker手动安装safeline,无法访问登录页面。containers不断重启。 卸载后再安装也不行。

How we reproduce?

  1. ...
  2. ...
  3. ...

Expected behavior

No response

Error log

safeline-luigi

2024/08/17 16:14:10 [ERROR] cmd/main.go:36 pg addr not found, wait mgt to set it up.

safeline-mgt :

panic: failed to connect to `host=safeline-pg user=safeline-ce database=safeline-ce`: dial error (timeout: dial tcp 172.22.222.2:5432: connect: connection timed out)

goroutine 1 [running]:
main.initDeps()
        /work/cmd/server/main.go:282 +0x34e
main.main()
        /work/cmd/server/main.go:318 +0x54
2024/08/17 16:24:08 [notice] 7#7: using the "epoll" event method
2024/08/17 16:24:08 [notice] 7#7: nginx/1.25.5
2024/08/17 16:24:08 [notice] 7#7: built by gcc 13.2.1 20231014 (Alpine 13.2.1_git20231014) 
2024/08/17 16:24:08 [notice] 7#7: OS: Linux 5.10.60-qnap
2024/08/17 16:24:08 [notice] 7#7: getrlimit(RLIMIT_NOFILE): 65535:65535
2024/08/17 16:24:08 [notice] 8#8: start worker processes
2024/08/17 16:24:08 [notice] 8#8: start worker process 10
2024/08/17 16:24:08 [notice] 8#8: start worker process 11
2024/08/17 16:24:39 [error] 10#10: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: , request: "GET /api/open/health HTTP/2.0", upstream: "http://127.0.0.1:8000/api/open/health", host: "localhost:1443"
2024/08/17 16:25:10 [error] 11#11: *3 connect() failed (111: Connection refused) while connecting to upstream, client: 127.0.0.1, server: , request: "GET /api/open/health HTTP/2.0", upstream: "http://127.0.0.1:8000/api/open/health", host: "localhost:1443"

safeline-mario

connect database failed

safeline-bridge

time=2024-08-17T16:12:26.928+08:00 level=INFO msg="start grpc server" network=unix address=/app/run/safeline.sock`

safeline-pg

PostgreSQL init process complete; ready for start up.

2024-08-17 16:12:54.818 HKT [1] LOG:  starting PostgreSQL 15.2 (Debian 15.2-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 64-bit
2024-08-17 16:12:54.889 HKT [1] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2024-08-17 16:12:54.889 HKT [1] LOG:  listening on IPv6 address "::", port 5432
2024-08-17 16:12:55.076 HKT [1] LOG:  listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
2024-08-17 16:12:55.289 HKT [72] LOG:  database system was shut down at 2024-08-17 16:12:53 HKT
2024-08-17 16:12:55.424 HKT [1] LOG:  database system is ready to accept connections
2024-08-17 16:17:55.388 HKT [70] LOG:  checkpoint starting: time
2024-08-17 16:18:03.376 HKT [70] LOG:  checkpoint complete: wrote 34 buffers (0.2%); 0 WAL file(s) added, 0 removed, 0 recycled; write=5.006 s, sync=1.222 s, total=7.988 s; sync files=11, longest=0.296 s, average=0.112 s; distance=151 kB, estimate=151 kB
LuoYulin-OwO commented 3 months ago

咱也碰到这个问题了,解决方式有点生草 去官网重新下载一个docker-compose.yaml再部署就行

新compose文件里面多了一个“chaos”模块 应该是因为老compose文件里面没有这个导致的...?

vin-c-ent commented 3 months ago

咱也碰到这个问题了,解决方式有点生草 去官网重新下载一个docker-compose.yaml再部署就行

新compose文件里面多了一个“chaos”模块 应该是因为老compose文件里面没有这个导致的...?

我这边有点不一样,我这边是有chaos这个模块的,也是在运行着的…还有一点就是我这边一开始运行是没问题的,第二天就出现db connection failed的问题了

vin-c-ent commented 2 months ago

有人也遇到过吗?或者缺了啥log我也可以补上

xbingW commented 2 months ago

问题反馈请移步 https://rivers.chaitin.cn/discussion