Skip to content

Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.

Go

MUL-6611: docs(self-host): route /health through the proxy, add single-origin example and release-tag note (#7466)

Felix02111ab949dc97f
diff --git a/apps/docs/content/docs/self-host-quickstart.ja.mdx b/apps/docs/content/docs/self-host-quickstart.ja.mdx
index 3ddc197bfa..fdfe7909a1 100644
--- a/apps/docs/content/docs/self-host-quickstart.ja.mdx
+++ b/apps/docs/content/docs/self-host-quickstart.ja.mdx
@@ -57,6 +57,13 @@ make selfhost
<Callout type="info">
`make selfhost` は公開済みのイメージを取得し、checkout 中のコードをビルドしません。ローカルのソースを試すには `make selfhost-build` を使ってください。
+
+公開済みのイメージは最新の **release タグ** を追跡しますが、単なる `git clone` でチェックアウトされるのは `main` で、通常リリースより先行しています。この checkout から何かをビルドする場合(CLI、または `make selfhost-build` によるイメージ)は、先に対応する release タグへ切り替えて、ビルドしたバイナリと稼働中のコンテナのバージョンを揃えてください:
+
+```bash
+git fetch --tags --depth 1
+git checkout $(git tag -l 'v*' --sort=-v:refname | head -1)
+```
</Callout>
## 2. サービスの準備完了を確認する
@@ -131,13 +138,50 @@ api.example.com {
}
```
+すべてのトラフィックを**単一オリジン**(1 つのドメイン、または 1 台のホストに 1 つのポートで、小規模サーバーで一般的な構成)で扱いたい場合は、デーモンが依存するパスを backend に明示的に転送し、残りを frontend に任せます:
+
+```text
+multica.example.com {
+ # CLI の到達確認: `multica setup` は <server-url>/health に GET を送り 200 を要求する。
+ # 古い frontend はこのパスを転送しないため、backend に直接ルーティングする
+ handle /health {
+ reverse_proxy 127.0.0.1:8080
+ }
+
+ # ブラウザの realtime WebSocket——web イメージは WS アップグレードを proxy できないため backend へ直接
+ handle /ws {
+ reverse_proxy 127.0.0.1:8080 {
+ flush_interval -1
+ }
+ }
+
+ # デーモンの長時間接続: {server-url}/api/daemon/ws にダイヤルします(/ws ではない)。
+ # このルートがないとハンドシェイクが失敗し、デーモンは通知なくポーリングへフォールバックします
+ handle /api/daemon/ws {
+ reverse_proxy 127.0.0.1:8080 {
+ flush_interval -1
+ }
+ }
+
+ # 残りのパスは frontend へ。API とログインのリクエストを転送する
+ handle {
+ reverse_proxy 127.0.0.1:3000
+ }
+}
+```
+
+単一オリジンでは、2 つの URL をどちらもそこに向けます(`.env` の `FRONTEND_ORIGIN` と `MULTICA_APP_URL`、および `multica setup self-host` の `--server-url` と `--app-url`)。
+
Caddy が TLS 証明書を取得し、WebSocket を転送します。`.env` を変更したら、`up -d` でコンテナを作り直して新しい設定を反映します。
```bash
docker compose -f docker-compose.selfhost.yml up -d
curl -fsS https://api.example.com/readyz
+curl -fsS https://app.example.com/api/config | grep -o '"daemon_server_url":"[^"]*"'
```
+最後のコマンドは `daemon_server_url`(デーモンが API に接続するための URL)を出力します: `MULTICA_DAEMON_SERVER_URL` が設定されていればそれを、次に `MULTICA_PUBLIC_URL`、どちらも未設定ならアプリ URL(`MULTICA_APP_URL`、未設定なら `FRONTEND_ORIGIN` にフォールバック)を使います。`MULTICA_APP_URL` と `FRONTEND_ORIGIN` のどちらも未設定の場合、`MULTICA_DAEMON_SERVER_URL` や `MULTICA_PUBLIC_URL` が設定されていてもこのフィールドはレスポンスから丸ごと省略されます(上の grep は何も出力しません)。`localhost` と出力される場合は `.env` がまだローカルのデフォルトのままです: `.env.example` からコピーした `${FRONTEND_PORT}` 参照に頼らず、`FRONTEND_ORIGIN` と `MULTICA_APP_URL` を公開 URL として明示的に設定し、コンテナを作り直してください。
+
<Callout type="warning">
`docker compose restart` は既存のコンテナを再起動するだけで、`.env` を読み直しません。設定を変更した後に `.env` を読み直すには、`docker compose -f docker-compose.selfhost.yml up -d` を実行してください。
</Callout>
@@ -201,7 +245,7 @@ multica setup self-host \
--app-url https://app.example.com
```
-このコマンドはまず `<server-url>/health` を確認し、次にブラウザを開いてログインを完了します。ログイン後はローカルに認証情報を保存し、デーモンを起動します。
+このコマンドはまず `<server-url>/health` を確認し、次にブラウザを開いてログインを完了します。ログイン後はローカルに認証情報を保存し、デーモンを起動します。このステップで `Server not reachable` エラーが出る場合、`/health` のプローブが 200 を取得できなかったことを意味します: プロキシがすべてのトラフィックをこのパスを転送しない古い frontend に向けているか、プロキシが `/health` を backend にルーティングしていないか、あるいは DNS・TLS・ファイアウォール・タイムアウト・backend からの 5xx といったより下位の障害です。詳細は[トラブルシューティング](/troubleshooting#multica-setup-がサーバーに到達できないと報告する)を参照してください。
接続状態を確認します。
@@ -299,7 +343,7 @@ docker compose -f docker-compose.selfhost.yml exec -T postgres \
### migration は自動で実行されます
-[ステップ1](#1-プロジェクトを取得してバックエンドを起動する)と同じく、バックエンドコンテナはトラフィックを受け付ける前に起動時に `./migrate up` を実行します(`docker/entrypoint.sh`)。個別のアップグレードコマンドはありません — 新しいイメージを立ち上げること自体が migration のステップです。様子を見るには:
+[ステップ1](#1-multica-を起動する)と同じく、バックエンドコンテナはトラフィックを受け付ける前に起動時に `./migrate up` を実行します(`docker/entrypoint.sh`)。個別のアップグレードコマンドはありません — 新しいイメージを立ち上げること自体が migration のステップです。様子を見るには:
```bash
docker compose -f docker-compose.selfhost.yml logs -f backend
@@ -334,7 +378,7 @@ Helm には独自のアップグレード経路があります。values ファ
|---|---|
| `/readyz` が `ok` を返さない | `docker compose -f docker-compose.selfhost.yml logs backend postgres` を実行する。 |
| 認証コードが届かない | コードを一度リクエストし、backend のログで `Verification code` を探す。 |
-| `setup self-host` が server に到達できないと報告する | 実行用コンピュータから `https://api.example.com/health` をリクエストし、DNS、TLS、リバースプロキシがすべて到達可能か確認する。 |
+| `setup self-host` が server に到達できないと報告する | 実行用コンピュータから `https://api.example.com/health` をリクエストし、DNS、TLS、リバースプロキシがすべて到達可能か確認する。404 が返る場合、プロキシが `/health` をこのパスを転送しない古い web リリースに向けているため、backend へ直接ルーティングすること([トラブルシューティング](/troubleshooting#multica-setup-がサーバーに到達できないと報告する))。 |
| デーモンが `Agents` を表示しない | AI コーディングツールが `PATH` にありログイン済みであることを確認し、`multica daemon restart` を実行する。 |
| イシューがキューにとどまり続ける | `multica daemon status` を実行し、デーモンが起動していてワークスペースに接続していることを確認する。 |
diff --git a/apps/docs/content/docs/self-host-quickstart.ko.mdx b/apps/docs/content/docs/self-host-quickstart.ko.mdx
index b2a8b0eede..eeca46254f 100644
--- a/apps/docs/content/docs/self-host-quickstart.ko.mdx
+++ b/apps/docs/content/docs/self-host-quickstart.ko.mdx
@@ -57,6 +57,13 @@ make selfhost
<Callout type="info">
`make selfhost`는 공개된 이미지를 pull하며 현재 checkout의 코드를 컴파일하지 않습니다. 로컬 소스 코드를 테스트하려면 `make selfhost-build`를 사용하세요.
+
+공개된 이미지는 최신 **release 태그**를 따르지만, 단순히 `git clone`하면 `main`이 체크아웃되며 보통 릴리스보다 앞서 있습니다. 이 checkout에서 무언가를 빌드할 때(CLI, 또는 `make selfhost-build`로 만드는 이미지)는 먼저 해당 release 태그로 전환해서 빌드 결과물과 실행 중인 컨테이너의 버전을 일치시키세요:
+
+```bash
+git fetch --tags --depth 1
+git checkout $(git tag -l 'v*' --sort=-v:refname | head -1)
+```
</Callout>
## 2. 서비스 준비 상태 확인
@@ -131,13 +138,50 @@ api.example.com {
}
```
+모든 트래픽을 **단일 오리진**(하나의 도메인, 또는 호스트 하나에 포트 하나로, 소규모 서버에서 흔한 형태)으로 처리하려면, 데몬이 의존하는 경로를 backend로 명시적으로 전달하고 나머지는 frontend에 맡기세요:
+
+```text
+multica.example.com {
+ # CLI 도달 확인: `multica setup`이 <server-url>/health에 GET을 보내 200을 기대합니다.
+ # 구버전 frontend는 이 경로를 전달하지 않으므로 backend로 직접 라우팅합니다
+ handle /health {
+ reverse_proxy 127.0.0.1:8080
+ }
+
+ # 브라우저 realtime WebSocket — web 이미지는 WS 업그레이드를 proxy할 수 없어 backend로 직접
+ handle /ws {
+ reverse_proxy 127.0.0.1:8080 {
+ flush_interval -1
+ }
+ }
+
+ # 데몬 긴 연결: {server-url}/api/daemon/ws로 다이얼합니다(/ws가 아님).
+ # 이 라우트가 없으면 핸드셰이크가 실패하고 데몬은 조용히 폴링으로 폴백합니다
+ handle /api/daemon/ws {
+ reverse_proxy 127.0.0.1:8080 {
+ flush_interval -1
+ }
+ }
+
+ # 나머지 경로는 frontend로 전달하며 frontend가 API와 로그인 요청을 proxy
+ handle {
+ reverse_proxy 127.0.0.1:3000
+ }
+}
+```
+
+단일 오리진에서는 두 URL을 모두 그 오리진으로 지정합니다(`.env`의 `FRONTEND_ORIGIN`과 `MULTICA_APP_URL`, 그리고 `multica setup self-host`의 `--server-url`과 `--app-url`).
+
Caddy가 TLS 인증서를 발급하고 WebSocket을 전달합니다. `.env`를 수정한 뒤 `up -d`로 컨테이너를 다시 만들어 새 설정을 적용합니다.
```bash
docker compose -f docker-compose.selfhost.yml up -d
curl -fsS https://api.example.com/readyz
+curl -fsS https://app.example.com/api/config | grep -o '"daemon_server_url":"[^"]*"'
```
+마지막 명령은 `daemon_server_url`(데몬이 API에 연결할 때 쓰는 URL)을 출력합니다: `MULTICA_DAEMON_SERVER_URL`이 설정되어 있으면 그 값을, 그다음 `MULTICA_PUBLIC_URL`, 둘 다 미설정이면 앱 URL(`MULTICA_APP_URL`, 미설정이면 `FRONTEND_ORIGIN`으로 폴백)을 사용합니다. `MULTICA_APP_URL`과 `FRONTEND_ORIGIN` 둘 다 설정되어 있지 않으면 `MULTICA_DAEMON_SERVER_URL`이나 `MULTICA_PUBLIC_URL`이 설정되어 있어도 이 필드는 응답에서 통째로 생략됩니다(위의 grep은 아무것도 출력하지 않음). `localhost`가 출력되면 `.env`가 아직 로컬 기본값인 것입니다: `.env.example`에서 복사한 `${FRONTEND_PORT}` 참조에 의존하지 말고 `FRONTEND_ORIGIN`과 `MULTICA_APP_URL`을 공개 URL로 명시적으로 설정한 뒤 컨테이너를 다시 만드세요.
+
<Callout type="warning">
`docker compose restart`는 기존 컨테이너만 다시 시작하며 `.env`를 다시 읽지 않습니다. 설정을 수정한 뒤 `.env`를 다시 읽게 하려면 `docker compose -f docker-compose.selfhost.yml up -d`를 실행하세요.
</Callout>
@@ -201,7 +245,7 @@ multica setup self-host \
--app-url https://app.example.com
```
-이 명령은 먼저 `<server-url>/health`를 확인한 뒤 브라우저를 열어 로그인을 완료합니다. 로그인 후 로컬 자격 증명을 저장하고 데몬을 시작합니다.
+이 명령은 먼저 `<server-url>/health`를 확인한 뒤 브라우저를 열어 로그인을 완료합니다. 로그인 후 로컬 자격 증명을 저장하고 데몬을 시작합니다. 이 단계에서 `Server not reachable` 오류가 나면 `/health` 프로브가 200을 받지 못했다는 뜻입니다: 프록시가 모든 트래픽을 이 경로를 전달하지 않는 구버전 frontend로 보내고 있거나, 프록시가 `/health`를 backend로 라우팅하지 않거나, DNS·TLS·방화벽·타임아웃·backend의 5xx 같은 하위 계층의 문제일 수 있습니다. [문제 해결](/troubleshooting#multica-setup이-서버에-도달할-수-없다고-보고함)을 참고하세요.
연결 상태를 확인합니다.
@@ -299,7 +343,7 @@ docker compose -f docker-compose.selfhost.yml exec -T postgres \
### migration은 자동으로 실행됩니다
-[1단계](#1-프로젝트-받아오기-및-백엔드-시작하기)와 마찬가지로, 백엔드 컨테이너는 트래픽을 받기 전에 시작 시점에 `./migrate up`을 실행합니다(`docker/entrypoint.sh`). 별도의 업그레이드 명령은 없습니다 — 새 이미지를 띄우는 것 자체가 migration 단계입니다. 진행 상황을 보려면:
+[1단계](#1-multica-시작)와 마찬가지로, 백엔드 컨테이너는 트래픽을 받기 전에 시작 시점에 `./migrate up`을 실행합니다(`docker/entrypoint.sh`). 별도의 업그레이드 명령은 없습니다 — 새 이미지를 띄우는 것 자체가 migration 단계입니다. 진행 상황을 보려면:
```bash
docker compose -f docker-compose.selfhost.yml logs -f backend
@@ -334,7 +378,7 @@ Helm은 자체 업그레이드 경로가 있습니다. values 파일에서 `imag
|---|---|
| `/readyz`가 `ok`를 반환하지 않음 | `docker compose -f docker-compose.selfhost.yml logs backend postgres`를 실행합니다. |
| 인증 코드를 받지 못함 | 인증 코드를 한 번 요청한 뒤 backend 로그에서 `Verification code`를 찾습니다. |
-| `setup self-host`에 server 접근 불가가 표시됨 | 실행 컴퓨터에서 `https://api.example.com/health`를 요청해 DNS, TLS, reverse proxy에 모두 접근할 수 있는지 확인합니다. |
+| `setup self-host`에 server 접근 불가가 표시됨 | 실행 컴퓨터에서 `https://api.example.com/health`를 요청해 DNS, TLS, reverse proxy에 모두 접근할 수 있는지 확인합니다. 404가 반환되면 프록시가 `/health`를 이 경로를 전달하지 않는 구버전 web 릴리스로 보내고 있다는 뜻이니 backend로 직접 라우팅해야 합니다([문제 해결](/troubleshooting#multica-setup이-서버에-도달할-수-없다고-보고함)). |
| 데몬의 `Agents`가 비어 있음 | AI 코딩 도구가 `PATH`에 있고 로그인되어 있는지 확인한 뒤 `multica daemon restart`를 실행합니다. |
| 이슈가 계속 큐에서 기다림 | `multica daemon status`를 실행해 데몬이 실행 중이며 워크스페이스에 연결되었는지 확인합니다. |
diff --git a/apps/docs/content/docs/self-host-quickstart.mdx b/apps/docs/content/docs/self-host-quickstart.mdx
index 2066386cf8..bef3485d8d 100644
--- a/apps/docs/content/docs/self-host-quickstart.mdx
+++ b/apps/docs/content/docs/self-host-quickstart.mdx
@@ -57,6 +57,13 @@ Running `make selfhost` again reuses the existing `.env` and volumes; it does no
<Callout type="info">
`make selfhost` pulls published images and does not build the code in your checkout. To test local source, use `make selfhost-build`.
+
+The published images track the newest **release tag**, while a plain `git clone` checks out `main`, which usually runs ahead. If you build anything from this checkout — the CLI, or images via `make selfhost-build` — check out the matching release tag first so built binaries and the running containers stay on the same version:
+
+```bash
+git fetch --tags --depth 1
+git checkout $(git tag -l 'v*' --sort=-v:refname | head -1)
+```
</Callout>
## 2. Confirm the services are ready
@@ -131,13 +138,51 @@ api.example.com {
}
```
+If you would rather serve everything on a **single origin** (one domain, or one host with one port — common on small servers), route the daemon-critical paths to the backend explicitly and let the frontend handle the rest:
+
+```text
+multica.example.com {
+ # CLI reachability probe: `multica setup` GETs <server-url>/health and
+ # needs a 200 — older web releases don't forward it, so route it directly
+ handle /health {
+ reverse_proxy 127.0.0.1:8080
+ }
+
+ # Browser realtime WebSocket — the web image cannot proxy WS upgrades
+ handle /ws {
+ reverse_proxy 127.0.0.1:8080 {
+ flush_interval -1
+ }
+ }
+
+ # Daemon long-connection WebSocket: daemons dial {server-url}/api/daemon/ws
+ # (not /ws). Without this route the handshake fails and the daemon silently
+ # falls back to polling
+ handle /api/daemon/ws {
+ reverse_proxy 127.0.0.1:8080 {
+ flush_interval -1
+ }
+ }
+
+ # Everything else goes to the frontend, which forwards API and login requests
+ handle {
+ reverse_proxy 127.0.0.1:3000
+ }
+}
+```
+
+With a single origin, point both URLs at it (`FRONTEND_ORIGIN` and `MULTICA_APP_URL` in `.env`, then `--server-url` and `--app-url` in `multica setup self-host`).
+
Caddy obtains TLS certificates and forwards WebSockets. After editing `.env`, recreate the containers with `up -d` so the new configuration takes effect:
```bash
docker compose -f docker-compose.selfhost.yml up -d
curl -fsS https://api.example.com/readyz
+curl -fsS https://app.example.com/api/config | grep -o '"daemon_server_url":"[^"]*"'
```
+The last command prints `daemon_server_url`, the URL daemons use to reach the API: `MULTICA_DAEMON_SERVER_URL` when set, then `MULTICA_PUBLIC_URL`, otherwise the app URL — `MULTICA_APP_URL`, falling back to `FRONTEND_ORIGIN`. When neither `MULTICA_APP_URL` nor `FRONTEND_ORIGIN` is set, the field is omitted from the response entirely (so the grep prints nothing), even if `MULTICA_DAEMON_SERVER_URL` or `MULTICA_PUBLIC_URL` is set. If it prints a `localhost` address, `.env` still carries local defaults: set `FRONTEND_ORIGIN` and `MULTICA_APP_URL` explicitly to the public URLs instead of relying on the `${FRONTEND_PORT}` references copied from `.env.example`, then recreate the containers.
+
<Callout type="warning">
`docker compose restart` only restarts existing containers and does not re-read `.env`. After changing configuration, run `docker compose -f docker-compose.selfhost.yml up -d` to re-read `.env`.
</Callout>
@@ -201,7 +246,7 @@ multica setup self-host \
--app-url https://app.example.com
```
-The command first checks `<server-url>/health`, then opens a browser to complete login. After login it stores local credentials and starts the daemon.
+The command first checks `<server-url>/health`, then opens a browser to complete login. After login it stores local credentials and starts the daemon. A `Server not reachable` error at this step means the probe could not get a 200 from `/health`: the proxy forwards everything to a web release that does not forward the path, the proxy does not route `/health` to the backend at all, or a lower-level failure (DNS, TLS, firewall, timeout, 5xx from the backend) — see [Troubleshooting](/troubleshooting#multica-setup-reports-the-server-is-not-reachable).
Confirm the connection:
@@ -299,7 +344,7 @@ Use your own `POSTGRES_USER` / `POSTGRES_DB` from `.env` if you changed them fro
### Migrations run themselves
-As in [Step 1](#1-pull-the-project-and-start-the-backend), the backend container runs `./migrate up` on startup (`docker/entrypoint.sh`) before serving traffic. There is no separate upgrade command — bringing up the new image *is* the migration step. Watch it happen:
+As in [Step 1](#1-start-multica), the backend container runs `./migrate up` on startup (`docker/entrypoint.sh`) before serving traffic. There is no separate upgrade command — bringing up the new image *is* the migration step. Watch it happen:
```bash
docker compose -f docker-compose.selfhost.yml logs -f backend
@@ -334,7 +379,7 @@ Helm has its own upgrade path: set `images.backend.tag` / `images.frontend.tag`
|---|---|
| `/readyz` does not return `ok` | Run `docker compose -f docker-compose.selfhost.yml logs backend postgres`. |
| No verification code arrives | Request a code, then search the backend logs for `Verification code`. |
-| `setup self-host` reports the server is unreachable | From the computer, request `https://api.example.com/health` to confirm DNS, TLS, and the reverse proxy are all reachable. |
+| `setup self-host` reports the server is unreachable | From the computer, request `https://api.example.com/health` to confirm DNS, TLS, and the reverse proxy are all reachable. A 404 means the proxy sends `/health` to an older web release that does not forward it — route it to the backend ([Troubleshooting](/troubleshooting#multica-setup-reports-the-server-is-not-reachable)). |
| The daemon lists no `Agents` | Confirm the AI coding tools are on `PATH` and logged in, then run `multica daemon restart`. |
| Issues stay queued | Run `multica daemon status` to confirm the daemon is running and connected to the workspace. |
diff --git a/apps/docs/content/docs/self-host-quickstart.zh.mdx b/apps/docs/content/docs/self-host-quickstart.zh.mdx
index dc7ea1375d..1656441edf 100644
--- a/apps/docs/content/docs/self-host-quickstart.zh.mdx
+++ b/apps/docs/content/docs/self-host-quickstart.zh.mdx
@@ -57,6 +57,13 @@ make selfhost
<Callout type="info">
`make selfhost` 拉取已发布的镜像,不会编译当前 checkout 中的代码。需要测试本地源码时,使用 `make selfhost-build`。
+
+已发布的镜像跟随最新的 **release tag**,而直接 `git clone` 检出的是 `main`,通常领先于发版。如果你要在这个 checkout 上构建任何东西——CLI,或通过 `make selfhost-build` 构建镜像——先切换到与镜像对应的 release tag,让构建产物和运行中的容器保持同一版本:
+
+```bash
+git fetch --tags --depth 1
+git checkout $(git tag -l 'v*' --sort=-v:refname | head -1)
+```
</Callout>
## 2. 确认服务已经就绪
@@ -131,13 +138,50 @@ api.example.com {
}
```
+如果想让所有流量走**单一 origin**(一个域名,或一台主机一个端口——小服务器上常见),把守护进程依赖的路径显式转给 backend,其余交给 frontend:
+
+```text
+multica.example.com {
+ # CLI 可达性探测:`multica setup` 会 GET <server-url>/health 并要求 200,
+ # 旧版 frontend 不转发这个路径,直接路由到 backend
+ handle /health {
+ reverse_proxy 127.0.0.1:8080
+ }
+
+ # 网页端 realtime WebSocket——前端镜像代理不了 WS 升级,直通 backend
+ handle /ws {
+ reverse_proxy 127.0.0.1:8080 {
+ flush_interval -1
+ }
+ }
+
+ # daemon 长连接:拨的是 {server-url}/api/daemon/ws(不是 /ws)。
+ # 缺了这条,握手失败后 daemon 会静默回退到轮询
+ handle /api/daemon/ws {
+ reverse_proxy 127.0.0.1:8080 {
+ flush_interval -1
+ }
+ }
+
+ # 其余路径交给 frontend;它会转发 API 和登录请求
+ handle {
+ reverse_proxy 127.0.0.1:3000
+ }
+}
+```
+
+单一 origin 模式下,两个 URL 都指向它(`.env` 里的 `FRONTEND_ORIGIN` 和 `MULTICA_APP_URL`,以及 `multica setup self-host` 的 `--server-url` 和 `--app-url`)。
+
Caddy 会申请 TLS 证书并转发 WebSocket。修改 `.env` 后,用 `up -d` 重新创建容器,让新配置生效:
```bash
docker compose -f docker-compose.selfhost.yml up -d
curl -fsS https://api.example.com/readyz
+curl -fsS https://app.example.com/api/config | grep -o '"daemon_server_url":"[^"]*"'
```
+最后一条命令输出 `daemon_server_url`——daemon 连接 API 用的地址:设了 `MULTICA_DAEMON_SERVER_URL` 时用它,其次是 `MULTICA_PUBLIC_URL`,否则用 app URL(`MULTICA_APP_URL`,未设置时回退到 `FRONTEND_ORIGIN`)。当 `MULTICA_APP_URL` 和 `FRONTEND_ORIGIN` 都没设时,这个字段会整个从响应里省略(上面的 grep 无输出)——即使设了 `MULTICA_DAEMON_SERVER_URL` 或 `MULTICA_PUBLIC_URL` 也是如此。如果输出的是 `localhost`,说明 `.env` 里还是本地默认值:不要依赖从 `.env.example` 复制来的 `${FRONTEND_PORT}` 引用,把 `FRONTEND_ORIGIN` 和 `MULTICA_APP_URL` 显式设置为公网地址,然后重建容器。
+
<Callout type="warning">
`docker compose restart` 只重启现有容器,不会重新读取 `.env`。修改配置后,重新读取 `.env` 需要运行 `docker compose -f docker-compose.selfhost.yml up -d`。
</Callout>
@@ -201,7 +245,7 @@ multica setup self-host \
--app-url https://app.example.com
```
-这条命令会先检查 `<server-url>/health`,再打开浏览器完成登录。登录完成后,它会保存本机凭据并启动守护进程。
+这条命令会先检查 `<server-url>/health`,再打开浏览器完成登录。登录完成后,它会保存本机凭据并启动守护进程。这一步报 `Server not reachable`,说明 `/health` 没有通过探测拿到 200:可能是代理把所有流量转给了不转发该路径的旧版 frontend,可能是代理根本没把 `/health` 路由到 backend,也可能是更底层的问题(DNS、TLS、防火墙、超时、backend 返回 5xx)——见[故障排查](/troubleshooting#multica-setup-报告服务器不可达)。
确认连接状态:
@@ -299,7 +343,7 @@ docker compose -f docker-compose.selfhost.yml exec -T postgres \
### migration 自动执行
-和[第 1 步](#1-拉取项目--一键启动后端)一样,backend 容器启动时会在对外提供服务之前先跑 `./migrate up`(`docker/entrypoint.sh`)。没有单独的升级命令——把新镜像起起来,本身就是升级这一步。想看过程:
+和[第 1 步](#1-启动-multica)一样,backend 容器启动时会在对外提供服务之前先跑 `./migrate up`(`docker/entrypoint.sh`)。没有单独的升级命令——把新镜像起起来,本身就是升级这一步。想看过程:
```bash
docker compose -f docker-compose.selfhost.yml logs -f backend
@@ -334,7 +378,7 @@ Helm 有自己的升级路径:在 values 文件里把 `images.backend.tag` / `
|---|---|
| `/readyz` 没有返回 `ok` | 运行 `docker compose -f docker-compose.selfhost.yml logs backend postgres`。 |
| 收不到验证码 | 请求一次验证码,再从 backend 日志中查找 `Verification code`。 |
-| `setup self-host` 提示 server 不可达 | 在执行电脑上请求 `https://api.example.com/health`,确认 DNS、TLS 和反向代理都可达。 |
+| `setup self-host` 提示 server 不可达 | 在执行电脑上请求 `https://api.example.com/health`,确认 DNS、TLS 和反向代理都可达。返回 404 说明代理把 `/health` 转给了不转发该路径的旧版 frontend——改为直通 backend(见[故障排查](/troubleshooting#multica-setup-报告服务器不可达))。 |
| 守护进程没有列出 `Agents` | 确认 AI 编程工具在 `PATH` 中并已登录,然后运行 `multica daemon restart`。 |
| issue 一直排队 | 运行 `multica daemon status`,确认守护进程正在运行并连接了工作区。 |
diff --git a/apps/docs/content/docs/troubleshooting.ja.mdx b/apps/docs/content/docs/troubleshooting.ja.mdx
index 6fa84a08a9..14fa7e703c 100644
--- a/apps/docs/content/docs/troubleshooting.ja.mdx
+++ b/apps/docs/content/docs/troubleshooting.ja.mdx
@@ -108,6 +108,10 @@ multica issue runs <issue-id>
- リバースプロキシが WebSocket の Upgrade リクエストを転送しているか。
- ブラウザのログインが期限切れになっていないか。
+`curl` で `/ws` にアクセスして HTTP 400 が返るのは正常な動作です: このエンドポイントは workspace を指定するクエリパラメータを要求し、それらがないハンドシェイクは WebSocket アップグレードの前に拒否されます。したがって backend ログに 400/401 の記録があっても、通常の HTTP ルーティングが backend まで届いたことしか証明しません — プロキシが WebSocket `Upgrade` ヘッダーを保持していることの証明にはなりません。実際の接続を確認するには、ブラウザの DevTools → Network → WS タブ(または WebSocket 対応クライアント)で `101` ハンドシェイクが成立しているかを見てください。
+
+セルフホストの注意: デーモンの長時間接続は `/api/daemon/ws` に向かいます(`/ws` ではありません)。同じように backend へ転送してください。ハンドシェイクが失敗するとデーモンは通知なくポーリングへフォールバックし、backend ログでこのパスに `status=400` が繰り返し現れるのがその兆候です。
+
コンテナは作成時にしか `.env` を読み込みません。変更後は再作成してください:
```bash
@@ -116,6 +120,16 @@ docker compose -f docker-compose.selfhost.yml up -d
完全なリバースプロキシの例は[セルフホストクイックスタート](/self-host-quickstart#3-アクセス方法を選ぶ)を参照してください。
+## `multica setup` がサーバーに到達できないと報告する
+
+CLI の到達確認は `<server-url>/health` に GET を送り、200 を要求します。backend はこのパスを提供します。現在の web リリースは `/health` を backend へ転送しますが、古いリリースはそうではないため、すべてのトラフィックを古い frontend へ転送するリバースプロキシでは 404 が返り、CLI は稼働中のサーバーを到達不能と誤判定します。
+
+プロキシで `/health` を backend(ポート 8080)へ明示的に転送すれば、すべてのリリースで動作します。[セルフホストクイックスタート](/self-host-quickstart#3-アクセス方法を選ぶ)の 2 つの Caddy 例に含まれています。確認方法:
+
+```bash
+curl -fsS <server-url>/health
+```
+
## 認証コードや招待メールが届かない
まず backend の起動ログを確認します。ログには、現在使っているのが `SMTP relay`、`Resend API`、`DEV mode` のどれかが表示されます:
diff --git a/apps/docs/content/docs/troubleshooting.ko.mdx b/apps/docs/content/docs/troubleshooting.ko.mdx
index e7c050d74d..8eb69f5208 100644
--- a/apps/docs/content/docs/troubleshooting.ko.mdx
+++ b/apps/docs/content/docs/troubleshooting.ko.mdx
@@ -108,6 +108,10 @@ multica issue runs <issue-id>
- reverse proxy가 WebSocket Upgrade 요청을 전달하는지
- 브라우저 로그인이 만료되었는지
+`curl`로 `/ws`에 요청했을 때 HTTP 400이 반환되는 것은 정상입니다: 이 엔드포인트는 workspace 관련 쿼리 파라미터를 요구하며, 파라미터 없는 핸드셰이크는 WebSocket 업그레이드 전에 거부됩니다. 따라서 backend 로그에 400/401 기록이 있다는 것은 일반 HTTP 라우팅이 backend까지 도달했다는 것만 증명합니다 — 프록시가 WebSocket `Upgrade` 헤더를 보존하는지는 증명하지 않습니다. 실제 연결을 확인하려면 브라우저 DevTools → Network → WS 탭(또는 WebSocket 지원 클라이언트)에서 `101` 핸드셰이크가 성립했는지 보세요.
+
+자체 호스팅 참고: 데몬의 긴 연결은 `/api/daemon/ws`로 향합니다(`/ws`가 아님). 마찬가지로 backend로 직접 전달해야 하며, 핸드셰이크가 실패하면 데몬은 조용히 폴링으로 폴백합니다. backend 로그에서 이 경로에 `status=400`이 반복되면 그 증상입니다.
+
컨테이너는 생성될 때만 `.env`를 읽으므로 수정 후 다시 생성해야 합니다.
```bash
@@ -116,6 +120,16 @@ docker compose -f docker-compose.selfhost.yml up -d
전체 reverse proxy 예시는 [자체 호스팅 빠른 시작](/self-host-quickstart#3-접근-방식-선택)을 참고하세요.
+## `multica setup`이 서버에 도달할 수 없다고 보고함
+
+CLI 도달 확인은 `<server-url>/health`에 GET을 보내 200을 기대합니다. backend는 이 경로를 제공합니다. 최신 web 릴리스는 `/health`를 backend로 전달하지만 구버전은 그렇지 않아, 모든 트래픽을 구버전 frontend로 전달하는 reverse proxy에서는 404가 반환되고 CLI는 정상 동작 중인 서버를 도달 불가로 오판합니다.
+
+프록시에서 `/health`를 backend(포트 8080)로 명시적으로 전달하면 모든 릴리스에서 동작합니다. [자체 호스팅 빠른 시작](/self-host-quickstart#3-접근-방식-선택)의 두 Caddy 예시에 모두 포함되어 있습니다. 확인 방법:
+
+```bash
+curl -fsS <server-url>/health
+```
+
## 인증 코드 및 초대 이메일이 도착하지 않음
먼저 backend 시작 로그를 확인합니다. 로그에는 현재 `SMTP relay`, `Resend API`, `DEV mode` 중 무엇을 사용하는지 표시됩니다.
diff --git a/apps/docs/content/docs/troubleshooting.mdx b/apps/docs/content/docs/troubleshooting.mdx
index 24cfb2e0c1..5b0f646df4 100644
--- a/apps/docs/content/docs/troubleshooting.mdx
+++ b/apps/docs/content/docs/troubleshooting.mdx
@@ -108,6 +108,10 @@ Check the `/ws` connection under **Network → WS** in the browser's developer t
- Whether the reverse proxy forwards the WebSocket Upgrade request.
- Whether the browser sign-in has expired.
+A plain `curl` against `/ws` returning HTTP 400 is expected: the endpoint requires workspace-scoped query parameters and rejects a bare handshake before any WebSocket upgrade happens. A 400/401 recorded in the backend logs therefore proves only that ordinary HTTP routing reaches the backend — it does not prove the proxy preserves the WebSocket `Upgrade` headers. To verify the actual connection, open the browser DevTools → Network → WS tab (or use a WebSocket-aware client) and look for a `101` handshake.
+
+Self-host note: daemons dial `/api/daemon/ws` for their long connection (not `/ws`) — route it to the backend the same way. If the WebSocket handshake fails there, the daemon silently falls back to polling; repeated `status=400` lines on that path in the backend log are the symptom.
+
Containers read `.env` only at creation time; recreate them after changes:
```bash
@@ -116,6 +120,16 @@ docker compose -f docker-compose.selfhost.yml up -d
For a complete reverse-proxy example, see the [self-host quickstart](/self-host-quickstart#3-choose-how-to-access).
+## `multica setup` reports the server is not reachable
+
+The CLI reachability probe GETs `<server-url>/health` and needs a 200. The backend serves this path. Current web releases forward `/health` to the backend, but older ones do not — a reverse proxy that forwards everything to such an older frontend returns 404, and the CLI concludes the server is down while the stack is healthy.
+
+Routing `/health` to the backend (port 8080) explicitly in your proxy works across all releases — both Caddy examples in the [self-host quickstart](/self-host-quickstart#3-choose-how-to-access) do this. Confirm with:
+
+```bash
+curl -fsS <server-url>/health
+```
+
## Verification code and invitation emails not delivered
Check the backend startup log first. It states whether the server is using `SMTP relay`, `Resend API`, or `DEV mode`:
diff --git a/apps/docs/content/docs/troubleshooting.zh.mdx b/apps/docs/content/docs/troubleshooting.zh.mdx
index d3b28ca1db..01c0113d06 100644
--- a/apps/docs/content/docs/troubleshooting.zh.mdx
+++ b/apps/docs/content/docs/troubleshooting.zh.mdx
@@ -108,6 +108,10 @@ multica issue runs <issue-id>
- 反向代理是否转发 WebSocket 的 Upgrade 请求;
- 浏览器登录是否已经过期。
+直接用 `curl` 访问 `/ws` 返回 HTTP 400 是正常现象:该端点要求带 workspace 相关的查询参数,裸握手在进入 WebSocket 升级之前就会被拒。所以 backend 日志里出现 400/401 记录,只能说明普通 HTTP 路由已经到达 backend——并不能证明代理保留了 WebSocket `Upgrade` 头。要验证真正的连接,请打开浏览器开发者工具的 Network → WS 面板(或用支持 WebSocket 的客户端),看是否出现 `101` 握手。
+
+自部署注意:daemon 的长连接拨的是 `/api/daemon/ws`(不是 `/ws`),同样要直通后端;握手失败时 daemon 会静默回退到轮询,backend 日志里该路径反复出现 `status=400` 即中招。
+
容器只在创建时读取 `.env`,修改后需要重新创建:
```bash
@@ -116,6 +120,16 @@ docker compose -f docker-compose.selfhost.yml up -d
完整的反向代理示例见[自托管快速上手](/self-host-quickstart#3-选择访问方式)。
+## `multica setup` 报告服务器不可达
+
+CLI 的可达性探测会 GET `<server-url>/health` 并要求 200。backend 提供这个路径。新版 web 前端会把 `/health` 转发给 backend,旧版不会——把所有流量都转给旧版 frontend 的反向代理会返回 404,于是 CLI 误判服务不可用,而服务实际是健康的。
+
+在代理里把 `/health` 显式转给 backend(8080 端口),对所有版本都适用——[自托管快速上手](/self-host-quickstart#3-选择访问方式)里的两个 Caddy 示例都包含这条。确认方法:
+
+```bash
+curl -fsS <server-url>/health
+```
+
## 验证码与邀请邮件未送达
先查看 backend 启动日志。日志会说明当前使用 `SMTP relay`、`Resend API` 还是 `DEV mode`: