fix: pin headscale image to v0.29.0 and drop removed config keys

新版 headscale 移除了部分設定鍵,搭配 watchtower 自動更新 :latest
導致容器啟動即 FATAL、無限重啟,所有節點離線。

- config.yaml: 註解 randomize_client_port(FATAL)與 ephemeral_node_inactivity_timeout(已改名)
- docker-compose.yml: image 釘到 v0.29.0,停止破壞性自動升級
- OPERATIONS.md / CLAUDE.md: 補上故障排除與升級注意事項

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-18 18:10:31 +08:00
parent 7d9e1453ee
commit e404dd9036
4 changed files with 36 additions and 4 deletions

View File

@@ -243,6 +243,30 @@ dig @1.1.1.1 example.com
### 常見問題
#### 升級後容器無限重啟、所有節點離線(設定鍵被移除)
**症狀**:所有 tailscale/headscale 節點突然全部連不上;`docker ps` 顯示 headscale 一直 `restarting``RestartCount` 持續飆高)。
**原因**:本服務使用 `headscale/headscale:latest` 並開啟 watchtower 自動更新,新版可能**移除舊設定鍵**,使容器一啟動就 FATAL 而陷入重啟迴圈。已知案例:
- `randomize_client_port`(頂層)— **FATAL**,已移除,改到 policy 檔設定 `"randomizeClientPort": true`
- `ephemeral_node_inactivity_timeout` — WARN改名為 `node.ephemeral.inactivity_timeout`
**診斷**
```bash
docker inspect headscale --format 'Status={{.State.Status}} RestartCount={{.RestartCount}}'
docker logs --tail 20 headscale # 找 FATAL 那行,會指出是哪個設定鍵
```
**修復**:依日誌把被移除的鍵在 `config/config.yaml` 註解掉(或依新版語法遷移),再重建容器:
```bash
docker-compose up -d --force-recreate
docker inspect headscale --format '{{.State.Status}} {{.RestartCount}}' # 應為 running / 0
curl -s -o /dev/null -w "%{http_code}\n" http://127.0.0.1:8080/health # 應為 200
```
**根治建議**:把 image 釘到固定版本(如 `headscale/headscale:v0.26.0`),或移除 watchtower 標籤改為手動升級,避免破壞性更新自動套用(見「日常維護」)。
#### 設備無法連接
1. **檢查服務狀態**
@@ -368,6 +392,7 @@ headscale nodes list
- [ ] 備份驗證測試
- [ ] 檢查磁碟空間
- [ ] 更新 Docker 映像:`docker pull headscale/headscale:latest`
> ⚠️ 升級前先看 [CHANGELOG](https://github.com/juanfont/headscale/blob/main/CHANGELOG.md) 的 BREAKING 段落,確認沒有被移除的設定鍵;建議釘版本而非用 `:latest` 自動更新(參見「故障排除 → 升級後容器無限重啟」)。
- [ ] 檢查系統資源使用
- [ ] 清理舊的日誌檔案