mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-19 18:47:41 +08:00
feat: add CLI commands documentation and service management features
- Updated the VitePress configuration to include links to CLI commands in both English and Chinese. - Enhanced the AstrBot deployment documentation with instructions for installing it as a system service. - Created comprehensive CLI commands documentation covering initialization, service management, configuration, and plugin management. - Added tests for CLI command aliases and service functionalities to ensure proper command registration and behavior. - Implemented service log management features, including enabling application logging and controlling log visibility.
This commit is contained in:
@@ -20,5 +20,71 @@ AstrBot requires Python 3.12 or later. Use `--python 3.12` to ensure that `uv` c
|
||||
|
||||
```bash
|
||||
uv tool install astrbot --python 3.12
|
||||
astrbot
|
||||
astrbot init # Only required for the first deployment
|
||||
astrbot run
|
||||
```
|
||||
|
||||
## Install as a System Service
|
||||
|
||||
After initialization, install AstrBot as a user-level service so it starts with the user session:
|
||||
|
||||
```bash
|
||||
astrbot service install --now
|
||||
```
|
||||
|
||||
The command uses the `astrbot` executable found on `PATH` (usually generated by `uv tool install`) and uses the current directory as the AstrBot working directory. Each platform uses its native user-level service mechanism:
|
||||
|
||||
- Linux: `systemd --user`
|
||||
- macOS: `LaunchAgent`
|
||||
- Windows: Task Scheduler
|
||||
|
||||
To specify the AstrBot working directory or executable path explicitly:
|
||||
|
||||
```bash
|
||||
astrbot service install --workdir /path/to/astrbot-root --executable /path/to/astrbot --now
|
||||
```
|
||||
|
||||
To inspect the service state and WebUI health:
|
||||
|
||||
```bash
|
||||
astrbot service status
|
||||
```
|
||||
|
||||
The status output includes the service manager state, AstrBot working directory, Dashboard port, WebUI URL, WebUI accessibility, and the overall health state.
|
||||
|
||||
You can also manage the service lifecycle with:
|
||||
|
||||
```bash
|
||||
astrbot service start
|
||||
astrbot service stop
|
||||
astrbot service restart
|
||||
astrbot service uninstall
|
||||
```
|
||||
|
||||
To view service logs:
|
||||
|
||||
```bash
|
||||
astrbot service logs
|
||||
astrbot service logs -f
|
||||
```
|
||||
|
||||
On macOS and Windows, this shows stdout logs by default. To include stderr:
|
||||
|
||||
```bash
|
||||
astrbot service logs --include-stderr
|
||||
```
|
||||
|
||||
To read the AstrBot application log file at `data/logs/astrbot.log`, enable application file logging first and restart the service:
|
||||
|
||||
```bash
|
||||
astrbot service logs enable
|
||||
astrbot service restart
|
||||
astrbot service logs --source app
|
||||
```
|
||||
|
||||
To inspect or disable application file logging:
|
||||
|
||||
```bash
|
||||
astrbot service logs status
|
||||
astrbot service logs disable
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user