Files
RemoteCompilation/deploy/windows/README.md
T

45 lines
2.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Windows 服务部署
本目录脚本以管理员权限运行,使用 [WinSW 2.12.0](https://github.com/winsw/winsw/releases/tag/v2.12.0) 官方 x64 包装器将 Go 程序注册为 Windows 服务。配置遵循 [WinSW 2.x 文档](https://winsw.github.io/v2/doc/xmlConfigFile/)。
将以下文件放入同一目录:
- `remotecompile-windows-amd64.exe`
- `WinSW-x64-v2.12.0.exe`(从官方固定版本下载)
- `install.ps1`
- `verify.ps1`
管理员 PowerShell:
```powershell
.\install.ps1 -JavaHome 'C:\工具链\jdk-17' -AndroidHome 'D:\AndroidSdk\Windows'
.\verify.ps1
```
默认根目录 `C:\ProgramData\VibeCodingRemoteCompilation`:
| 位置 | 内容 |
| --- | --- |
| `bin\remotecompile.exe` | Go 服务 |
| `bin\RemoteCompileService.exe` | WinSW(与 Go 程序不同名称,避免 Windows 大小写碰撞) |
| `bin\RemoteCompileService.xml` | 配置、工具链路径与随机 Token |
| `data\` | 工作区和产物 |
| `home\` | 独立 Gradle 缓存和调试签名 |
| `logs\` | 包装器与应用日志 |
服务名 `RemoteCompile`,自动延迟启动,以 `NT AUTHORITY\LocalService` 运行。配置及程序目录只向管理员、SYSTEM 和 LocalService 授权;LocalService 仅可写数据、日志、home 和 temp。LocalService 是系统内置共享低权限账户,不是不可信构建沙箱。
仅监听 `127.0.0.1:8765`。通过 SSH 隧道访问,不新开防火墙入站规则。Token 副本导出到部署用户的 `.remotecompile-service-token.txt`,并限制 ACL;不会保存 SSH 登录密码。
`verify.ps1` 验证 JDK 启动、android-35 平台读取、35.0.0 aapt2 执行、同步、模拟构建及产物摘要。它生成的测试文件不是有效 Android APK。
管理:
```powershell
Get-Service RemoteCompile
Restart-Service RemoteCompile
Get-Content 'C:\ProgramData\VibeCodingRemoteCompilation\logs\*.log' -Tail 30
```
调整 JDK/SDK 时编辑 XML 对应 env 后重启。服务不修改机器全局 Java 或 Android 环境变量,不自动安装缺失的 SDK 组件。真实构建需要选择与项目 Gradle/AGP 兼容的 JDK。