Skip to content

Commit 1494e9f

Browse files
authored
Merge pull request #63 from wirjo/feat/reliability-improvements
feat: Reliability improvements with optional monitoring
2 parents 7ea4c78 + c42f5a5 commit 1494e9f

2 files changed

Lines changed: 326 additions & 26 deletions

File tree

README.md

Lines changed: 59 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,11 @@ You (WhatsApp/Telegram/Discord)
156156
You (receive response)
157157
```
158158

159-
- **EC2**: Runs OpenClaw gateway (~1GB RAM)
159+
- **EC2**: Runs OpenClaw gateway (~1GB RAM, c7g.large recommended)
160160
- **Bedrock**: Model inference via IAM (no API keys)
161161
- **SSM**: Secure access, no public ports
162-
- **VPC Endpoints**: Private network to Bedrock (optional, +$22/mo)
162+
- **VPC Endpoints**: Private network to Bedrock (optional, +$29/mo)
163+
- **CloudWatch**: Auto-recovery, health monitoring, log shipping (optional, +$4/mo)
163164

164165
---
165166

@@ -188,15 +189,25 @@ Switch models with one CloudFormation parameter — no code changes:
188189

189190
### Typical Monthly Cost (Light Usage)
190191

191-
| Component | Cost |
192-
|-----------|------|
193-
| EC2 (c7g.large, Graviton) | $58 |
194-
| EBS (30GB gp3) | $2.40 |
195-
| VPC Endpoints (optional) | $22 |
196-
| Bedrock (Nova 2 Lite, ~100 conv/day) | $5-8 |
197-
| **Total** | **$65-90** |
198-
199-
> Use `t4g.medium` ($24/mo) to bring total down to ~$31-56 if you don't need the extra CPU headroom.
192+
| Component | Cost | Optional |
193+
|-----------|------|----------|
194+
| EC2 (c7g.large, Graviton) | ~$58 | Default |
195+
| EBS (30GB gp3 x2) | $4.80 ||
196+
| VPC Endpoints | $29 | ✅ Disable to save |
197+
| CloudWatch Monitoring | ~$4 | ✅ Disable to save |
198+
| Bedrock (Nova 2 Lite, ~100 conv/day) | $5-8 | Pay-per-use |
199+
| **Total (all options)** | **$96-101** | |
200+
| **Total (minimal)** | **$63-67** | VPCe + CW off |
201+
202+
> Use `t4g.medium` ($24/mo) or `r7g.medium` ($30/mo, 8GB RAM) to reduce cost.
203+
204+
**Always included at no extra cost:**
205+
- 2GB swap (prevents OOM crashes)
206+
- Health check cron (port + HTTP + channel connectivity)
207+
- OS security patches (unattended-upgrades)
208+
- IMDSv2 enforcement
209+
- `openclaw doctor --fix` post-install
210+
- systemd memory limits (graceful restart before OOM)
200211

201212
### Save Money
202213

@@ -221,21 +232,24 @@ Switch models with one CloudFormation parameter — no code changes:
221232

222233
| Type | Monthly | RAM | Architecture | Use case |
223234
|------|---------|-----|-------------|----------|
224-
| t4g.small | $12 | 2GB | Graviton ARM | Personal |
235+
| t4g.small | $12 | 2GB | Graviton ARM | Personal (minimal) |
225236
| t4g.medium | $24 | 4GB | Graviton ARM | Small teams |
226237
| t4g.large | $48 | 8GB | Graviton ARM | Medium teams |
227-
| **c7g.large** | **$58** | **4GB** | **Graviton ARM** | **Balanced performance (default)** |
228-
| c7g.xlarge | $108 | 8GB | Graviton ARM | High performance |
229-
| t3.medium | $30 | 4GB | x86 | x86 compatibility |
238+
| **c7g.large** | **$58** | **4GB** | **Graviton ARM** | **Recommended (default)** |
239+
| r7g.medium | $30 | 8GB | Graviton ARM | Memory-optimized alternative |
240+
| r7g.large | $60 | 16GB | Graviton ARM | Heavy usage / plugins |
241+
| c7g.large | $58 | 4GB | Graviton ARM | Compute-intensive |
242+
| r5.large | $91 | 16GB | x86 | x86 + memory |
230243

231244
### Parameters
232245

233246
| Parameter | Default | Description |
234247
|-----------|---------|-------------|
235248
| `OpenClawModel` | Nova 2 Lite | Bedrock model ID |
236249
| `OpenClawVersion` | 2026.3.24 | `2026.3.24` (default, no model approval needed, WeChat compatible), `2026.4.5` (auto-discovery, embeddings), or `latest` |
237-
| `InstanceType` | c7g.large | EC2 instance type |
238-
| `CreateVPCEndpoints` | false | Private networking (+$22/mo) |
250+
| `InstanceType` | c7g.large | EC2 instance type (compute-optimized, 2 vCPU) |
251+
| `CreateVPCEndpoints` | false | Private networking (+$29/mo) |
252+
| `EnableMonitoring` | true | CloudWatch monitoring, auto-recovery, log shipping (+~$4/mo) |
239253
| `EnableSandbox` | true | Docker isolation for code execution |
240254
| `EnableDataProtection` | false | Retain EBS volume on stack deletion |
241255
| `KeyPairName` | none | EC2 key pair (optional, for emergency SSH) |
@@ -365,6 +379,7 @@ Uses SiliconFlow (DeepSeek, Qwen, GLM) instead of Bedrock. Requires a SiliconFlo
365379
| Layer | What it does |
366380
|-------|-------------|
367381
| **IAM Roles** | No API keys — automatic credential rotation |
382+
| **IMDSv2 Enforced** | Instance metadata requires secure token (no v1 fallback) |
368383
| **SSM Session Manager** | No public ports, session logging |
369384
| **VPC Endpoints** | Bedrock traffic stays on private network |
370385
| **SSM Parameter Store** | Gateway token stored as SecureString, never on disk |
@@ -376,6 +391,33 @@ Uses SiliconFlow (DeepSeek, Qwen, GLM) instead of Bedrock. Requires a SiliconFlo
376391

377392
---
378393

394+
## Reliability
395+
396+
The stack includes multiple layers of self-healing (always enabled, no extra cost):
397+
398+
| Layer | What it does | Frequency |
399+
|-------|-------------|----------|
400+
| **Port health check** | Detects dead gateway process, auto-restarts | Every 5 min |
401+
| **HTTP health check** | Detects hung/deadlocked gateway, auto-restarts | Every 5 min |
402+
| **Channel monitoring** | Detects disconnected Telegram/Discord/WhatsApp via `openclaw status`, auto-restarts | Every 30 min |
403+
| **systemd Restart=always** | Auto-restarts on crash | Immediate |
404+
| **2GB swap** | Prevents hard OOM kills on low-memory instances | Always on |
405+
| **systemd MemoryMax** | Graceful restart at 80% memory (before OOM killer) | Always on |
406+
| **Node.js version pin** | Prevents breakage from bad Node releases (pinned to 22.22.0) | At install |
407+
| **OS security patches** | Unattended-upgrades for security fixes | Daily |
408+
| **`openclaw doctor`** | Config validation and auto-repair post-install | At install |
409+
410+
**With `EnableMonitoring=true` (default, +~$4/mo):**
411+
412+
| Layer | What it does |
413+
|-------|-------------|
414+
| **EC2 auto-recovery** | Recovers instance on underlying hardware failure |
415+
| **EC2 reboot alarm** | Reboots on instance status check failure |
416+
| **CloudWatch metrics** | Memory, disk, swap usage (5-min intervals) |
417+
| **CloudWatch Logs** | Setup, health check, and update logs shipped to CloudWatch |
418+
419+
---
420+
379421
## Community Skills
380422

381423
Optional extensions for OpenClaw:

0 commit comments

Comments
 (0)