Heartbeat check fails for ExApp on remote host; Nextcloud keeps targeting 'localhost', ignores BIND_ADDRESS/OVERRIDE_APP_HOST flags

未關閉
#609 6 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
4/5
預估耗時
3-5 天
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
docker, php

研究方向

先追蹤 app_api heartbeat 與 docker-install 部署流程,重點關注遠端 daemon 位址以及 BIND_ADDRESS/APP_API_HOST 設定如何傳遞。使用文件中記載的 host-network 設定重現部署,並確認 heartbeat 的目標是遠端應用程式而非 localhost,以及已部署的應用程式可從外部連線。

由索引模型根據 Issue 內容生成。

描述

deploy documentation priority: normal
Describe the bug

Set up Nextcloud 30.0.12 on CPU-only Rocky Linux 9 with an additional GPU-supported Rocky Linux 9 server as a processing backend for apps.

All is done in a http-only enviroment.

When doing a test deploy on the DSP, it fails the heartbeat check every time. But accessing the heartbeat via wget or curl either inside the container or inside the gpu server, where the test-deploy is made, works. The Nextcloud instance cannot reach the container. Connection is refused everytime, according to the log. However, looking a tcpdump, we can see that Nextcloud attempts to get the Heartbeat check from the localhost (nextcloud server) instead of the container, which is in the GPU server.

Neither -e OVERRIDE_APP_HOST='true' nor -e APP_API_HOST='0.0.0.0' on the DSP container had any effect. The heartbeat still targets localhost, and the app still binds to 127.0.0.1.

Using Docker's default bridge network (by leaving the Network field in the UI blank) caused the test container to fail the "Container started" step.

Steps/Code to Reproduce

Recommended settings used for docker run:
docker run
-d
--name GPU-DSP
--restart unless-stopped
--net host
-v /var/run/docker.sock:/var/run/docker.sock
-e BIND_ADDRESS=""
-e EX_APPS_NET="[email protected]" \
-e NC_HAPROXY_PASSWORD='xxx'
ghcr.io/nextcloud/nextcloud-appapi-dsp:v1.5.2

In the Nextcloud Admin UI, configure a new Deploy Daemon with the following settings:
* Deployment method: docker-install
* Daemon host: http://<gpu-server-ip>:2375
* Nextcloud URL: http://<nextcloud-server-ip>
* Network: host
* Compute device: CUDA (NVIDIA)
Click the "Check connection" button (it succeeds).
Click the "Start Deploy test" button.

Expected Results

All checks work fine, app can be deployed.

Actual Results
  • The "Image pull" and "Container started" steps pass, but the "Heartbeat" step fails after timing out.
  • The Nextcloud log shows a cURL error 7: Failed heartbeat on http://localhost:23001: Connection refused. Nextcloud is targeting its own localhost instead of the remote GPU server.
  • The deployed test container log shows the application (Uvicorn) starts successfully but is bound to 127.0.0.1 on the gpu server (docker), but is not reachable externally (by the nextcloud server in this case).
  • The deployment ultimately fails with "Container healthcheck failed" after reaching 210 in the heartbeat counter.
  • The deployed test container works. It is reachable from within the GPU server and within the container itself via wget http://127.0.0.1:<app-port>.
  • Forcing the connection via a two-stage socat tunnel creates an EADDRINUSE (address already in use) error, as the tunnel and the app create a port conflict. This confirms the app is trying to bind to a port that the workaround needs to occupy.

Full line of the relevant nextcloud log:
{"reqId":"vZi5pHotqNXKauq4Ut3G","level":2,"time":"2025-07-07T09:19:57+00:00","remoteAddr":"","user":"--","app":"app_api","method":"","url":"--","message":"Failed heartbeat on http://localhost:23001 for 10 times. Most recent status=0, error: cURL error 7: Failed to connect to localhost port 23001: Connection refused (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://localhost:23001/heartbeat","userAgent":"--","version":"30.0.12.2","data":{"app":"app_api"}}

Setup configuration

Nextcloud Version = 30.0.12.2
Database = mysql/MariaDB 15.1
php = 4.2.13
HostOS = Rocky Linux 9.4 Blue Onyx
GPU and Docker HostOS = Rocky Linux 9.4
Docker Version = 28.3.0

主要語言
PHP
星號
202
分支
30
平均合併
3 天 20 小時
30 天內合併 PR
24

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

nextcloud/app_api 的其他 Issue

查看 nextcloud/app_api 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。