diff --git a/INSTALL.md b/INSTALL.md index 881af881..68f66e67 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -187,6 +187,20 @@ npm start # Start Express serving client/dist on port 4820 Open **http://localhost:4820** in your browser. +`npm start` (and `ccam start`, its backgrounded form) only run while that +process is alive — a reboot loses it. On Linux, run the server as a systemd +`--user` service instead so it comes back on its own after every reboot, with +no manual step and no Claude Code (or any other tool) needed to trigger it: + +```bash +ccam service install # writes + enables ~/.config/systemd/user/ccam.service +ccam service status # systemctl --user status ccam +ccam service uninstall # disable and remove it +``` + +See [`README.md` → Run as a service](./README.md#run-as-a-service-auto-start-on-boot) +and, for plugin installs, [`docs/PLUGINS.md` → Auto-start on boot](docs/PLUGINS.md#auto-start-on-boot). + --- ## Optional: Local MCP server diff --git a/README.vi.md b/README.vi.md index 5583c11d..92ed1d6b 100644 --- a/README.vi.md +++ b/README.vi.md @@ -70,6 +70,28 @@ directory riêng của nó). `postinstall` ghi các hook entry Claude Code để dữ liệu cho dashboard — đừng chạy nó khi plugin `ccam` đã cài, không thì mỗi event bị đếm hai lần. +### Chạy như một service (tự khởi động khi boot máy) + +`npm start` chỉ chạy khi terminal đó (hoặc tiến trình nền của `ccam start`) +còn sống — reboot máy là mất. Trên Linux, `ccam service install` dựng một +systemd `--user` service thay vào đó, để `:4820` tự động chạy lại sau mỗi lần +reboot, không cần thao tác thủ công và không cần Claude Code (hay AI tool +nào) để kích hoạt: + +```bash +npm run build # service serve client đã build, giống npm start +ccam service install # ghi + enable ~/.config/systemd/user/ccam.service +ccam service status # systemctl --user status ccam +ccam service uninstall # disable và gỡ bỏ +``` + +`ccam service install` cũng thử chạy `loginctl enable-linger` để service khởi +động được cả khi cold boot (chưa ai login); nếu máy cần quyền cao hơn, lệnh +này sẽ in ra `sudo loginctl enable-linger ` để bạn tự chạy một lần. +Bản cài qua plugin cũng được tự khởi động tương tự — xem +[Auto-start on boot](docs/PLUGINS.md#auto-start-on-boot) trong +`docs/PLUGINS.md`. + ## CLI `ccam` được link sẵn bởi `npm run setup`; không thì gọi `node bin/ccam.js`. @@ -77,6 +99,7 @@ event bị đếm hai lần. ```bash ccam status # dashboard có đang chạy không ccam start # start ngầm (background) và chờ tới khi healthy +ccam service install # tự khởi động khi boot máy qua systemd --user (Linux) ccam sessions # session gần đây ccam lanes # danh sách lane kèm stage và progress ccam lanes pipeline # pipeline template của lane này, hoặc đổi nó