Skip to content

Commit 59d81bc

Browse files
authored
docs: add upgrade instructions to installation page (EN+VI+ZH) (#39)
Add "Updating to Latest Version" section covering all 4 installation paths: binary re-install, bare metal git pull + build, Docker rebuild, and upgrade overlay. Includes GOCLAW_AUTO_UPGRADE env var docs and upgrade troubleshooting table.
1 parent 687ba3f commit 59d81bc

3 files changed

Lines changed: 237 additions & 3 deletions

File tree

getting-started/installation.md

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,6 +457,84 @@ sudo mkdir -p /backup
457457

458458
---
459459

460+
## Updating to Latest Version
461+
462+
Already running GoClaw and want to upgrade? Follow the steps for your installation path.
463+
464+
### Path 1: Quick Install (Binary)
465+
466+
Re-run the install script — it downloads the latest release and overwrites the existing binary:
467+
468+
```bash
469+
curl -fsSL https://raw.githubusercontent.com/nextlevelbuilder/goclaw/main/scripts/install.sh | bash
470+
```
471+
472+
Then upgrade the database schema:
473+
474+
```bash
475+
source .env.local && goclaw upgrade
476+
```
477+
478+
> **Tip:** Run `goclaw upgrade --status` first to check if a schema upgrade is needed, or `goclaw upgrade --dry-run` to preview changes.
479+
480+
### Path 2: Bare Metal
481+
482+
```bash
483+
cd goclaw
484+
git pull origin main
485+
go build -o goclaw .
486+
./goclaw upgrade
487+
```
488+
489+
The `goclaw upgrade` command applies pending SQL migrations and runs data hooks. It is safe to run multiple times (idempotent).
490+
491+
### Path 3 & 4: Docker (Local / VPS)
492+
493+
```bash
494+
cd /path/to/goclaw # or /opt/goclaw on VPS
495+
git pull origin main
496+
docker compose \
497+
-f docker-compose.yml \
498+
-f docker-compose.postgres.yml \
499+
-f docker-compose.selfservice.yml \
500+
up -d --build
501+
```
502+
503+
GoClaw automatically runs pending migrations on startup — no manual `goclaw upgrade` needed.
504+
505+
**Alternative: use the upgrade overlay** for a one-shot database upgrade without restarting the gateway:
506+
507+
```bash
508+
# Preview changes
509+
docker compose -f docker-compose.yml -f docker-compose.postgres.yml \
510+
-f docker-compose.upgrade.yml run --rm upgrade --dry-run
511+
512+
# Apply upgrade
513+
docker compose -f docker-compose.yml -f docker-compose.postgres.yml \
514+
-f docker-compose.upgrade.yml run --rm upgrade
515+
```
516+
517+
### Auto-upgrade on Startup
518+
519+
Set the `GOCLAW_AUTO_UPGRADE` environment variable to automatically run migrations when the gateway starts — useful for CI/CD and Docker deployments:
520+
521+
```bash
522+
# .env or .env.local
523+
GOCLAW_AUTO_UPGRADE=true
524+
```
525+
526+
When enabled, GoClaw applies pending SQL migrations and data hooks inline during startup. If you prefer manual control, leave this unset and run `goclaw upgrade` yourself.
527+
528+
### Troubleshooting Upgrades
529+
530+
| Problem | Solution |
531+
|---------|----------|
532+
| `database schema is dirty` | A previous migration failed. Run `goclaw migrate force <version-1>` then `goclaw upgrade` |
533+
| `schema is newer than this binary` | Your binary is older than your database. Update the binary first |
534+
| `UPGRADE NEEDED` on gateway start | Run `goclaw upgrade` or set `GOCLAW_AUTO_UPGRADE=true` |
535+
536+
---
537+
460538
## Verify Installation
461539

462540
Works for all three paths:
@@ -491,4 +569,4 @@ docker compose logs goclaw
491569
- [Quick Start](#quick-start) — Run your first agent
492570
- [Configuration](#configuration) — Customize GoClaw settings
493571

494-
<!-- goclaw-source: 0bce640 | updated: 2026-03-24 -->
572+
<!-- goclaw-source: 175e052 | updated: 2026-03-29 -->

vi/getting-started/installation.md

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,84 @@ sudo mkdir -p /backup
459459

460460
---
461461

462+
## Cập nhật lên phiên bản mới nhất
463+
464+
Đã cài GoClaw rồi và muốn nâng cấp? Làm theo hướng dẫn cho cách cài đặt của bạn.
465+
466+
### Cách 1: Cài nhanh (Binary)
467+
468+
Chạy lại script cài đặt — nó tải bản mới nhất và ghi đè binary cũ:
469+
470+
```bash
471+
curl -fsSL https://raw.githubusercontent.com/nextlevelbuilder/goclaw/main/scripts/install.sh | bash
472+
```
473+
474+
Sau đó nâng cấp database schema:
475+
476+
```bash
477+
source .env.local && goclaw upgrade
478+
```
479+
480+
> **Mẹo:** Chạy `goclaw upgrade --status` trước để kiểm tra xem có cần nâng cấp schema không, hoặc `goclaw upgrade --dry-run` để xem trước thay đổi.
481+
482+
### Cách 2: Cài trực tiếp
483+
484+
```bash
485+
cd goclaw
486+
git pull origin main
487+
go build -o goclaw .
488+
./goclaw upgrade
489+
```
490+
491+
Lệnh `goclaw upgrade` chạy các SQL migration đang chờ và data hooks. An toàn khi chạy nhiều lần (idempotent).
492+
493+
### Cách 3 & 4: Docker (Local / VPS)
494+
495+
```bash
496+
cd /path/to/goclaw # hoặc /opt/goclaw trên VPS
497+
git pull origin main
498+
docker compose \
499+
-f docker-compose.yml \
500+
-f docker-compose.postgres.yml \
501+
-f docker-compose.selfservice.yml \
502+
up -d --build
503+
```
504+
505+
GoClaw tự động chạy migration đang chờ khi khởi động — không cần chạy `goclaw upgrade` thủ công.
506+
507+
**Cách khác: dùng upgrade overlay** để nâng cấp database một lần mà không cần restart gateway:
508+
509+
```bash
510+
# Xem trước thay đổi
511+
docker compose -f docker-compose.yml -f docker-compose.postgres.yml \
512+
-f docker-compose.upgrade.yml run --rm upgrade --dry-run
513+
514+
# Chạy nâng cấp
515+
docker compose -f docker-compose.yml -f docker-compose.postgres.yml \
516+
-f docker-compose.upgrade.yml run --rm upgrade
517+
```
518+
519+
### Tự động nâng cấp khi khởi động
520+
521+
Đặt biến môi trường `GOCLAW_AUTO_UPGRADE` để tự động chạy migration khi gateway khởi động — hữu ích cho CI/CD và Docker:
522+
523+
```bash
524+
# .env hoặc .env.local
525+
GOCLAW_AUTO_UPGRADE=true
526+
```
527+
528+
Khi bật, GoClaw chạy SQL migration và data hooks đang chờ trong quá trình khởi động. Nếu muốn kiểm soát thủ công, không đặt biến này và chạy `goclaw upgrade` riêng.
529+
530+
### Xử lý lỗi khi nâng cấp
531+
532+
| Vấn đề | Giải pháp |
533+
|--------|-----------|
534+
| `database schema is dirty` | Migration trước đó thất bại. Chạy `goclaw migrate force <version-1>` rồi `goclaw upgrade` |
535+
| `schema is newer than this binary` | Binary cũ hơn database. Cập nhật binary trước |
536+
| `UPGRADE NEEDED` khi khởi động gateway | Chạy `goclaw upgrade` hoặc đặt `GOCLAW_AUTO_UPGRADE=true` |
537+
538+
---
539+
462540
## Kiểm tra cài đặt
463541

464542
Áp dụng cho cả ba cách:
@@ -493,4 +571,4 @@ docker compose logs goclaw
493571
- [Quick Start](#quick-start) — Chạy agent đầu tiên của bạn
494572
- [Configuration](#configuration) — Tùy chỉnh cài đặt GoClaw
495573

496-
<!-- goclaw-source: 0bce640 | cập nhật: 2026-03-24 -->
574+
<!-- goclaw-source: 175e052 | cập nhật: 2026-03-29 -->

zh/getting-started/installation.md

Lines changed: 79 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,84 @@ sudo mkdir -p /backup
459459

460460
---
461461

462+
## 更新到最新版本
463+
464+
已经在运行 GoClaw 并想升级?按照你的安装方式执行相应步骤。
465+
466+
### 方式一:快速安装(二进制)
467+
468+
重新运行安装脚本——它会下载最新版本并覆盖现有二进制文件:
469+
470+
```bash
471+
curl -fsSL https://raw.githubusercontent.com/nextlevelbuilder/goclaw/main/scripts/install.sh | bash
472+
```
473+
474+
然后升级数据库 schema:
475+
476+
```bash
477+
source .env.local && goclaw upgrade
478+
```
479+
480+
> **提示:** 先运行 `goclaw upgrade --status` 检查是否需要升级 schema,或 `goclaw upgrade --dry-run` 预览变更。
481+
482+
### 方式二:裸机安装
483+
484+
```bash
485+
cd goclaw
486+
git pull origin main
487+
go build -o goclaw .
488+
./goclaw upgrade
489+
```
490+
491+
`goclaw upgrade` 命令执行待处理的 SQL 迁移和 data hooks。可安全多次运行(幂等)。
492+
493+
### 方式三和四:Docker(本地 / VPS)
494+
495+
```bash
496+
cd /path/to/goclaw # VPS 上为 /opt/goclaw
497+
git pull origin main
498+
docker compose \
499+
-f docker-compose.yml \
500+
-f docker-compose.postgres.yml \
501+
-f docker-compose.selfservice.yml \
502+
up -d --build
503+
```
504+
505+
GoClaw 启动时自动运行待处理的迁移——无需手动执行 `goclaw upgrade`
506+
507+
**替代方案:使用 upgrade overlay** 在不重启 gateway 的情况下一次性升级数据库:
508+
509+
```bash
510+
# 预览变更
511+
docker compose -f docker-compose.yml -f docker-compose.postgres.yml \
512+
-f docker-compose.upgrade.yml run --rm upgrade --dry-run
513+
514+
# 执行升级
515+
docker compose -f docker-compose.yml -f docker-compose.postgres.yml \
516+
-f docker-compose.upgrade.yml run --rm upgrade
517+
```
518+
519+
### 启动时自动升级
520+
521+
设置 `GOCLAW_AUTO_UPGRADE` 环境变量,在 gateway 启动时自动运行迁移——适用于 CI/CD 和 Docker 部署:
522+
523+
```bash
524+
# .env 或 .env.local
525+
GOCLAW_AUTO_UPGRADE=true
526+
```
527+
528+
启用后,GoClaw 在启动过程中自动执行待处理的 SQL 迁移和 data hooks。如果你希望手动控制,不设置此变量,自行运行 `goclaw upgrade`
529+
530+
### 升级故障排除
531+
532+
| 问题 | 解决方案 |
533+
|------|----------|
534+
| `database schema is dirty` | 之前的迁移失败。运行 `goclaw migrate force <version-1>` 然后 `goclaw upgrade` |
535+
| `schema is newer than this binary` | 二进制文件比数据库旧,先更新二进制文件 |
536+
| 启动 gateway 时显示 `UPGRADE NEEDED` | 运行 `goclaw upgrade` 或设置 `GOCLAW_AUTO_UPGRADE=true` |
537+
538+
---
539+
462540
## 验证安装
463541

464542
适用于所有方式:
@@ -493,4 +571,4 @@ docker compose logs goclaw
493571
- [快速开始](#quick-start) — 运行你的第一个 agent
494572
- [配置](#configuration) — 自定义 GoClaw 设置
495573

496-
<!-- goclaw-source: 0bce640 | 更新: 2026-03-24 -->
574+
<!-- goclaw-source: 175e052 | 更新: 2026-03-29 -->

0 commit comments

Comments
 (0)