# instinct: cure の n8n は Docker Compose 管理・PM2 は使っていない

## 要約

cure のサービス構成は **systemd** が正本。PM2 は `pm2-logrotate` モジュールのみで、アプリプロセスは管理していない。

## cure サービス構成(2026-07-27確認)

| サービス | 管理 | 起動コマンド |
|---|---|---|
| playwright-service | systemd | `/usr/bin/python3 /home/ubuntu/playwright_service.py` |
| discord-bot | systemd | `/usr/bin/python3 /home/ubuntu/services/discord_bot.py` |
| openclaw-api | systemd | `/usr/bin/python3 /home/ubuntu/services/openclaw_api.py` |
| n8n | Docker Compose | `cd /home/ubuntu/services && docker compose up -d n8n` |
| postgresql | systemd | `postgresql@16-main.service` |

## n8n が止まっていたら

```bash
cd /home/ubuntu/services && docker compose up -d n8n
curl -s http://localhost:5678/healthz # 200 で確認
```

- `restart: unless-stopped` が設定されているが、OS 再起動後に Docker daemon が再起動された場合は自動復旧する
- サーバー異常終了(OOM 等)後は `docker compose up -d` が必要な場合がある

## discord-bot と n8n の依存関係

- `discord-bot.service` → `POST http://localhost:5678/webhook/discord-bot` → n8n → OpenClaw GPT-5.5
- n8n が止まると discord-bot はエラー応答を返すが、自身はクラッシュしない(systemd が discord-bot を再起動する必要はない)

## npm キャッシュ残骸

- `~/.npm/_npx/a8a7eec953f1f314/` は `npx n8n` で一時実行した残骸(2.4GB)
- Docker Compose 版 n8n とは無関係 → 削除可能
- 2026-07-27 に削除済み(cure ディスク 77% → 73%)