Files
ai_site/ENV.md
2026-07-31 10:19:22 +08:00

87 lines
2.3 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 本地环境说明
更新时间2026-07-17
## 已就绪
| 组件 | 版本/状态 | 说明 |
|------|-----------|------|
| Go | 1.21.13 | 中台必需,已有 |
| Python | 3.13+ | AI / 蓝图校验,已有;已装 `jsonschema` |
| Node.js | v22 | 前端预留,已有 |
| Git | 2.52 | 已有 |
| PostgreSQL | 16.14 | **本次安装**,服务 `postgresql-x64-16` 自动启动 |
| Docker Desktop | 4.82 / engine 29.x | **本次安装**(可选;当前项目用本机 Postgres 即可) |
**不需要 Java。**
## 数据库连接
```text
Host: 127.0.0.1
Port: 5432
User: platform
Password: platform
Database: platform
```
连接串(已写入 `platform/etc/platform.yaml`
```text
postgres://platform:platform@127.0.0.1:5432/platform?sslmode=disable
```
超级用户(安装时设置):`postgres` / `platform`
`psql` 路径已加入用户 PATH`C:\Program Files\PostgreSQL\16\bin`
(新开终端后生效)
## 启动中台
```powershell
cd E:\project\ai建站\platform
go run . -f etc/platform.yaml
# 另开终端
go run .\scripts\smoke.go
```
正常日志应出现:`postgres engine enabled``memoryMode=false`
## Docker 注意
Docker Desktop 已安装,首次使用可能需要:
1. 从开始菜单打开 **Docker Desktop** 完成初始化
2. 若提示启用 WSL2按向导操作本机已有 WSL Ubuntu-22.04
3. 重启后再执行 `docker version`
### 国内镜像(已接入)
| 用途 | 源 |
|------|-----|
| Docker Hub 拉取 | DaoCloud / 1ms / 轩辕(`scripts\Apply-DockerMirrors.ps1` 写入 `%USERPROFILE%\.docker\daemon.json` |
| 基础镜像前缀 | `docker.m.daocloud.io/library`compose / Dockerfile可用环境变量 `DOCKER_BASE_REGISTRY` 覆盖) |
| Go modules | `goproxy.cn` |
| pip | 清华 `pypi.tuna.tsinghua.edu.cn` |
| npm | `registry.npmmirror.com``web/.npmrc` |
```powershell
# 仅写入 Docker Desktop 镜像配置(改完后建议重启一次 Docker Desktop
.\scripts\Apply-DockerMirrors.ps1
# 正常启动会自动 Apply + 优先走国内前缀拉镜像
.\start.ps1
```
本项目数据库也可用本机 PostgreSQLDocker 拉不动时会自动回退本机模式。
## 常用检查
```powershell
go version
python --version
node --version
psql -U platform -h 127.0.0.1 -d platform -c "SELECT 1"
Get-Service postgresql-x64-16
```