chaitin / chaitin/SafeLine

[Bug] openwrt安装后safeline-luigi和safeline-mgt提示连接不上safeline-pg

Open
#1,249 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
22.6k
Forks
1.5k
Avg merge
4h 30m
Merged PRs (30d)
11

Description

What happened?

openwrt 18安装雷池9.2.8报错
safeline-luigi和safeline-mgt容器一直重启 并且log报错连接不上safeline-pg
并且localtime也存在问题 下面是我修改了引用本地localtime后的compose文件

How we reproduce?

networks:
safeline-ce:
name: safeline-ce
driver: bridge
ipam:
driver: default
config:
- gateway: ${SUBNET_PREFIX:?SUBNET_PREFIX required}.1
subnet: ${SUBNET_PREFIX}.0/24
driver_opts:
com.docker.network.bridge.name: safeline-ce

services:
postgres:
container_name: safeline-pg
restart: always
image: ${IMAGE_PREFIX}/safeline-postgres${ARCH_SUFFIX}:15.2
volumes:
- ${SAFELINE_DIR}/resources/postgres/data:/var/lib/postgresql/data
environment:
- TZ=Asia/Shanghai
- POSTGRES_USER=safeline-ce
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:?postgres password required}
networks:
safeline-ce:
ipv4_address: ${SUBNET_PREFIX}.2
command: [postgres, -c, max_connections=600]
healthcheck:
test: pg_isready -U safeline-ce -d safeline-ce
mgt:
container_name: safeline-mgt
restart: always
image: ${IMAGE_PREFIX}/safeline-mgt${REGION}${ARCH_SUFFIX}:${IMAGE_TAG:?image tag required}
volumes:
- ${SAFELINE_DIR}/resources/mgt:/app/data
- ${SAFELINE_DIR}/logs/nginx:/app/log/nginx:z
- ${SAFELINE_DIR}/resources/sock:/app/sock
- /var/run:/app/run
ports:
- ${MGT_PORT:-9443}:1443
healthcheck:
test: curl -k -f https://localhost:1443/api/open/health
environment:
- TZ=Asia/Shanghai
- MGT_PG=postgres://safeline-ce:${POSTGRES_PASSWORD}@safeline-pg/safeline-ce?sslmode=disable
- MGT_PROXY=${MGT_PROXY}
depends_on:
- postgres
- fvm
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
networks:
safeline-ce:
ipv4_address: ${SUBNET_PREFIX}.4
detect:
container_name: safeline-detector
restart: always
image: ${IMAGE_PREFIX}/safeline-detector${REGION}${ARCH_SUFFIX}:${IMAGE_TAG}
volumes:
- ${SAFELINE_DIR}/resources/detector:/resources/detector
- ${SAFELINE_DIR}/logs/detector:/logs/detector
environment:
- TZ=Asia/Shanghai
- LOG_DIR=/logs/detector
networks:
safeline-ce:
ipv4_address: ${SUBNET_PREFIX}.5
tengine:
container_name: safeline-tengine
restart: always
image: ${IMAGE_PREFIX}/safeline-tengine${REGION}${ARCH_SUFFIX}:${IMAGE_TAG}
volumes:
- /etc/resolv.conf:/etc/resolv.conf:ro
- ${SAFELINE_DIR}/resources/nginx:/etc/nginx
- ${SAFELINE_DIR}/resources/detector:/resources/detector
- ${SAFELINE_DIR}/resources/chaos:/resources/chaos
- ${SAFELINE_DIR}/logs/nginx:/var/log/nginx:z
- ${SAFELINE_DIR}/resources/cache:/usr/local/nginx/cache
- ${SAFELINE_DIR}/resources/sock:/app/sock
environment:
- TZ=Asia/Shanghai
- TCD_MGT_API=https://${SUBNET_PREFIX}.4:1443/api/open/publish/server
- TCD_SNSERVER=${SUBNET_PREFIX}.5:8000
- SNSERVER_ADDR=${SUBNET_PREFIX}.5:8000
- CHAOS_ADDR=${SUBNET_PREFIX}.10
ulimits:
nofile: 131072
ports:
- "80:80"
- "443:443"
networks:
safeline-ce:
ipv4_address: ${SUBNET_PREFIX}.6
luigi:
container_name: safeline-luigi
restart: always
image: ${IMAGE_PREFIX}/safeline-luigi${REGION}${ARCH_SUFFIX}:${IMAGE_TAG}
environment:
- TZ=Asia/Shanghai
- MGT_IP=${SUBNET_PREFIX}.4
- LUIGI_PG=postgres://safeline-ce:${POSTGRES_PASSWORD}@safeline-pg/safeline-ce?sslmode=disable
volumes:
- ${SAFELINE_DIR}/resources/luigi:/app/data
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
depends_on:
- detect
- mgt
networks:
safeline-ce:
ipv4_address: ${SUBNET_PREFIX}.7
fvm:
container_name: safeline-fvm
restart: always
image: ${IMAGE_PREFIX}/safeline-fvm${REGION}${ARCH_SUFFIX}:${IMAGE_TAG}
environment:
- TZ=Asia/Shanghai
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "5"
networks:
safeline-ce:
ipv4_address: ${SUBNET_PREFIX}.8
chaos:
container_name: safeline-chaos
restart: always
image: ${IMAGE_PREFIX}/safeline-chaos${REGION}${ARCH_SUFFIX}:${IMAGE_TAG}
logging:
driver: "json-file"
options:
max-size: "100m"
max-file: "10"
environment:
- DB_ADDR=postgres://safeline-ce:${POSTGRES_PASSWORD}@safeline-pg/safeline-ce?sslmode=disable
volumes:
- ${SAFELINE_DIR}/resources/sock:/app/sock
- ${SAFELINE_DIR}/resources/chaos:/app/chaos
networks:
safeline-ce:
ipv4_address: ${SUBNET_PREFIX}.10

Expected behavior

ImmortalWrt 24.10.4-r33602-e717d133ed6d
雷池9.2.8

Error log

root@WeiFHWrt:/data/safeline# docker logs safeline-mgt --tail=200
2025/12/05 20:56:10 [notice] 7#7: using the "epoll" event method
2025/12/05 20:56:10 [notice] 7#7: nginx/1.28.0
2025/12/05 20:56:10 [notice] 7#7: built by gcc 14.2.0 (Alpine 14.2.0)
2025/12/05 20:56:10 [notice] 7#7: OS: Linux 6.6.110
2025/12/05 20:56:10 [notice] 7#7: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2025/12/05 20:56:10 [notice] 8#8: start worker processes
2025/12/05 20:56:10 [notice] 8#8: start worker process 9
2025/12/05 20:56:10 [notice] 8#8: start worker process 10
2025/12/05 20:56:10 [notice] 8#8: start worker process 11
2025/12/05 20:56:10 [notice] 8#8: start worker process 12
panic: failed to init pg db: failed to connect to host=safeline-pg user=safeline-ce database=safeline-ce: dial error (dial tcp 172.19.0.2:5432: connect: connection refused)

goroutine 1 [running]:
main.main()
/work/main.go:32 +0x24c
2025/12/05 20:56:13 [notice] 7#7: using the "epoll" event method
2025/12/05 20:56:13 [notice] 7#7: nginx/1.28.0
2025/12/05 20:56:13 [notice] 7#7: built by gcc 14.2.0 (Alpine 14.2.0)
2025/12/05 20:56:13 [notice] 7#7: OS: Linux 6.6.110
2025/12/05 20:56:13 [notice] 7#7: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2025/12/05 20:56:13 [notice] 8#8: start worker processes
2025/12/05 20:56:13 [notice] 8#8: start worker process 9
2025/12/05 20:56:13 [notice] 8#8: start worker process 10
2025/12/05 20:56:13 [notice] 8#8: start worker process 11
2025/12/05 20:56:13 [notice] 8#8: start worker process 12
panic: failed to init pg db: failed to connect to host=safeline-pg user=safeline-ce database=safeline-ce: dial error (dial tcp 172.19.0.2:5432: connect: connection refused)

goroutine 1 [running]:
main.main()
/work/main.go:32 +0x24c
2025/12/05 20:56:15 [notice] 7#7: using the "epoll" event method
2025/12/05 20:56:15 [notice] 7#7: nginx/1.28.0
2025/12/05 20:56:15 [notice] 7#7: built by gcc 14.2.0 (Alpine 14.2.0)
2025/12/05 20:56:15 [notice] 7#7: OS: Linux 6.6.110
2025/12/05 20:56:15 [notice] 7#7: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2025/12/05 20:56:15 [notice] 8#8: start worker processes
2025/12/05 20:56:15 [notice] 8#8: start worker process 9
2025/12/05 20:56:15 [notice] 8#8: start worker process 10
2025/12/05 20:56:15 [notice] 8#8: start worker process 11
2025/12/05 20:56:15 [notice] 8#8: start worker process 12
panic: failed to init pg db: failed to connect to host=safeline-pg user=safeline-ce database=safeline-ce: dial error (dial tcp 172.19.0.2:5432: connect: connection refused)

goroutine 1 [running]:
main.main()
/work/main.go:32 +0x24c
2025/12/05 20:56:16 [notice] 7#7: using the "epoll" event method
2025/12/05 20:56:16 [notice] 7#7: nginx/1.28.0
2025/12/05 20:56:16 [notice] 7#7: built by gcc 14.2.0 (Alpine 14.2.0)
2025/12/05 20:56:16 [notice] 7#7: OS: Linux 6.6.110
2025/12/05 20:56:16 [notice] 7#7: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2025/12/05 20:56:16 [notice] 8#8: start worker processes
2025/12/05 20:56:16 [notice] 8#8: start worker process 9
2025/12/05 20:56:16 [notice] 8#8: start worker process 10
2025/12/05 20:56:16 [notice] 8#8: start worker process 11
2025/12/05 20:56:16 [notice] 8#8: start worker process 12
panic: failed to init pg db: failed to connect to host=safeline-pg user=safeline-ce database=safeline-ce: dial error (dial tcp 172.19.0.2:5432: connect: connection refused)

goroutine 1 [running]:
main.main()
/work/main.go:32 +0x24c
2025/12/05 20:56:18 [notice] 7#7: using the "epoll" event method
2025/12/05 20:56:18 [notice] 7#7: nginx/1.28.0
2025/12/05 20:56:18 [notice] 7#7: built by gcc 14.2.0 (Alpine 14.2.0)
2025/12/05 20:56:18 [notice] 7#7: OS: Linux 6.6.110
2025/12/05 20:56:18 [notice] 7#7: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2025/12/05 20:56:18 [notice] 8#8: start worker processes
2025/12/05 20:56:18 [notice] 8#8: start worker process 9
2025/12/05 20:56:18 [notice] 8#8: start worker process 10
2025/12/05 20:56:18 [notice] 8#8: start worker process 11
2025/12/05 20:56:18 [notice] 8#8: start worker process 12
panic: failed to init pg db: failed to connect to host=safeline-pg user=safeline-ce database=safeline-ce: dial error (dial tcp 172.19.0.2:5432: connect: connection refused)

goroutine 1 [running]:
main.main()
/work/main.go:32 +0x24c
2025/12/05 20:56:21 [notice] 7#7: using the "epoll" event method
2025/12/05 20:56:21 [notice] 7#7: nginx/1.28.0
2025/12/05 20:56:21 [notice] 7#7: built by gcc 14.2.0 (Alpine 14.2.0)
2025/12/05 20:56:21 [notice] 7#7: OS: Linux 6.6.110
2025/12/05 20:56:21 [notice] 7#7: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2025/12/05 20:56:21 [notice] 8#8: start worker processes
2025/12/05 20:56:21 [notice] 8#8: start worker process 9
2025/12/05 20:56:21 [notice] 8#8: start worker process 10
2025/12/05 20:56:21 [notice] 8#8: start worker process 11
2025/12/05 20:56:21 [notice] 8#8: start worker process 12
panic: failed to init pg db: failed to connect to host=safeline-pg user=safeline-ce database=safeline-ce: dial error (dial tcp 172.19.0.2:5432: connect: connection refused)

goroutine 1 [running]:
main.main()
/work/main.go:32 +0x24c
2025/12/05 20:56:25 [notice] 7#7: using the "epoll" event method
2025/12/05 20:56:25 [notice] 7#7: nginx/1.28.0
2025/12/05 20:56:25 [notice] 7#7: built by gcc 14.2.0 (Alpine 14.2.0)
2025/12/05 20:56:25 [notice] 7#7: OS: Linux 6.6.110
2025/12/05 20:56:25 [notice] 7#7: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2025/12/05 20:56:25 [notice] 8#8: start worker processes
2025/12/05 20:56:25 [notice] 8#8: start worker process 9
2025/12/05 20:56:25 [notice] 8#8: start worker process 10
2025/12/05 20:56:25 [notice] 8#8: start worker process 11
2025/12/05 20:56:25 [notice] 8#8: start worker process 12
panic: failed to init pg db: failed to connect to host=safeline-pg user=safeline-ce database=safeline-ce: dial error (dial tcp 172.19.0.2:5432: connect: connection refused)

goroutine 1 [running]:
main.main()
/work/main.go:32 +0x24c
2025/12/05 20:56:33 [notice] 7#7: using the "epoll" event method
2025/12/05 20:56:33 [notice] 7#7: nginx/1.28.0
2025/12/05 20:56:33 [notice] 7#7: built by gcc 14.2.0 (Alpine 14.2.0)
2025/12/05 20:56:33 [notice] 7#7: OS: Linux 6.6.110
2025/12/05 20:56:33 [notice] 7#7: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2025/12/05 20:56:33 [notice] 8#8: start worker processes
2025/12/05 20:56:33 [notice] 8#8: start worker process 9
2025/12/05 20:56:33 [notice] 8#8: start worker process 10
2025/12/05 20:56:33 [notice] 8#8: start worker process 11
2025/12/05 20:56:33 [notice] 8#8: start worker process 12
2025/12/05 20:56:33 [error] 9#9: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.19.0.1, server: , request: "POST /api/open/publish/server HTTP/1.1", upstream: "http://[::1]:8000/api/open/publish/server", host: "172.19.0.4:1443"
2025/12/05 20:56:33 [warn] 9#9: *1 upstream server temporarily disabled while connecting to upstream, client: 172.19.0.1, server: , request: "POST /api/open/publish/server HTTP/1.1", upstream: "http://[::1]:8000/api/open/publish/server", host: "172.19.0.4:1443"
2025/12/05 20:56:33 [error] 9#9: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.19.0.1, server: , request: "POST /api/open/publish/server HTTP/1.1", upstream: "http://127.0.0.1:8000/api/open/publish/server", host: "172.19.0.4:1443"
2025/12/05 20:56:33 [warn] 9#9: *1 upstream server temporarily disabled while connecting to upstream, client: 172.19.0.1, server: , request: "POST /api/open/publish/server HTTP/1.1", upstream: "http://127.0.0.1:8000/api/open/publish/server", host: "172.19.0.4:1443"
panic: failed to init pg db: failed to connect to host=safeline-pg user=safeline-ce database=safeline-ce: dial error (dial tcp 172.19.0.2:5432: connect: connection refused)

goroutine 1 [running]:
main.main()
/work/main.go:32 +0x24c
2025/12/05 20:56:47 [notice] 7#7: using the "epoll" event method
2025/12/05 20:56:47 [notice] 7#7: nginx/1.28.0
2025/12/05 20:56:47 [notice] 7#7: built by gcc 14.2.0 (Alpine 14.2.0)
2025/12/05 20:56:47 [notice] 7#7: OS: Linux 6.6.110
2025/12/05 20:56:47 [notice] 7#7: getrlimit(RLIMIT_NOFILE): 1048576:1048576
2025/12/05 20:56:47 [notice] 8#8: start worker processes
2025/12/05 20:56:47 [notice] 8#8: start worker process 9
2025/12/05 20:56:47 [notice] 8#8: start worker process 10
2025/12/05 20:56:47 [notice] 8#8: start worker process 11
2025/12/05 20:56:47 [notice] 8#8: start worker process 12
panic: failed to init pg db: failed to connect to host=safeline-pg user=safeline-ce database=safeline-ce: dial error (dial tcp 172.19.0.2:5432: connect: connection refused)

goroutine 1 [running]:
main.main()
/work/main.go:32 +0x24c

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the shown Docker Compose services, especially the postgres healthcheck and the mgt/luigi database settings, then inspect /work/main.go:32 and the container logs. Done means the services start reliably on the reported OpenWrt setup, connect to safeline-pg, and no longer enter restart loops.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go, postgresql
Domain
databases, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.