feat(deploy): support macOS arm64 installation with launchd
This commit is contained in:
@@ -106,18 +106,56 @@ python3 /tmp/bolt_http_test.py # HTTP 端到端
|
||||
- Windows(基础功能:`cmd /C`、`taskkill /T` 杀进程树;无信号优雅退出)
|
||||
## 在其他设备上部署(最快方式)
|
||||
|
||||
单文件二进制已发布到 Gitea Release,配合一键脚本,目标设备(Linux amd64 + systemd)只需两条命令:
|
||||
一键脚本支持 Linux(systemd)和 macOS(launchd),自动识别 amd64 / arm64;Apple Silicon 即使在 Rosetta 终端中也优先选择 arm64。安装需要 root 权限。
|
||||
|
||||
默认下载 `v0.1.0` 的 `bolt-<平台>-<架构>` 附件,例如 `bolt-linux-amd64`、`bolt-darwin-arm64`。对应附件需要事先发布到 Gitea Release;可通过 `BOLT_VERSION` 指定版本,或通过 `BOLT_DL_URL` / `--binary` 指定其他来源。
|
||||
|
||||
```bash
|
||||
# 1. 下载并执行安装脚本(私有仓库下载附件需先 export 下载令牌)
|
||||
export BOLT_DL_TOKEN=你的Gitea令牌
|
||||
curl -fsSL https://git.jocay.qzz.io/jocay/bolt/raw/branch/main/deploy/install.sh | sh -s -- --http 0.0.0.0:8080
|
||||
curl -fsSL -H "Authorization: token $BOLT_DL_TOKEN" https://git.draws.qzz.io/jocay/bolt/raw/branch/main/deploy/install.sh -o install.sh
|
||||
sudo BOLT_DL_TOKEN="$BOLT_DL_TOKEN" sh install.sh --http 127.0.0.1:8080
|
||||
|
||||
# 2. 完成(脚本自动:下载二进制 → 装到 /usr/local/bin → 写 /etc/bolt.env 与
|
||||
# systemd 单元 → 开机自启 → 启动服务)。看状态:
|
||||
systemctl status bolt
|
||||
```
|
||||
|
||||
### macOS arm64(Apple Silicon)
|
||||
|
||||
在 Mac 上运行上面的安装命令,脚本会下载 `bolt-darwin-arm64`,安装到 `/usr/local/bin/bolt`,并创建以 root 运行的 launchd 系统服务 `io.jocay.bolt`。
|
||||
|
||||
`v0.1.0` Release 提供 `bolt-darwin-arm64` 附件。也可以将该二进制下载或拷到 Mac 后安装:
|
||||
|
||||
```bash
|
||||
sudo sh deploy/install.sh --binary ./bolt-darwin-arm64 --http 127.0.0.1:8080 --token 你的令牌
|
||||
```
|
||||
|
||||
配置保存在 `/Library/Application Support/bolt/io.jocay.bolt.plist`,包含监听地址、认证令牌、命令规则和超时。启用开机自启时,脚本还会复制配置到 `/Library/LaunchDaemons/io.jocay.bolt.plist`。两份配置均仅 root 可读写;更改参数建议重新运行安装脚本,以保持一致。
|
||||
|
||||
`--no-enable` 只保留手动启动配置,取消本服务的开机配置,仍可立即启动;`--no-start` 本次不加载服务,已运行的本服务也会卸载,下次开机是否启动由 `--no-enable` 决定。两个参数可一起使用。
|
||||
|
||||
```bash
|
||||
# 查看服务 / 重启已加载的服务 / 停止并卸载
|
||||
sudo launchctl print system/io.jocay.bolt
|
||||
sudo launchctl kickstart -k system/io.jocay.bolt
|
||||
sudo launchctl bootout system/io.jocay.bolt
|
||||
|
||||
# 停止后或使用 --no-start 安装后,手动加载并启动
|
||||
sudo launchctl bootstrap system '/Library/Application Support/bolt/io.jocay.bolt.plist'
|
||||
|
||||
# 查看日志
|
||||
sudo tail -f /var/log/bolt/stdout.log /var/log/bolt/stderr.log
|
||||
```
|
||||
|
||||
macOS 服务的工作目录为 `/var/root`,PATH 包含 `/opt/homebrew/bin` 和 `/opt/homebrew/sbin`,不会加载个人 shell 配置。认证下载使用 `BOLT_DL_TOKEN`,HTTP 服务认证使用 `--token`,两者独立。
|
||||
|
||||
该附件交叉编译为 `aarch64-apple-darwin`,最低目标系统为 macOS 11.0,未进行 Mac 实机运行验证。SHA-256:
|
||||
|
||||
```text
|
||||
39274c7d1f965ae924ee51d4e9e4d8a260a84d083971cd50dc6ce645245cc4b8 bolt-darwin-arm64
|
||||
```
|
||||
|
||||
常用安装参数(全部可选):
|
||||
|
||||
| 参数 | 含义 |
|
||||
|
||||
Reference in New Issue
Block a user