Files

89 lines
2.2 KiB
Markdown
Raw Permalink 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.
# WorkPod 实例管理指南
## 快速概览
| 实例 | SSH | Web | 用途 | 状态 |
|------|-----|-----|------|------|
| workpod-alpine | 2222 | 7681 | 基础开发环境 | `registry.yaml` |
| ws-flux-dev | 2201 | 7701 | Flux 项目 | `registry.yaml` |
| workpod-test | 2223 | 7682 | 测试实例 | `registry.yaml` |
详细注册表见 **[registry.yaml](./registry.yaml)**
---
## 端口分配规则
### 本机
| 类型 | SSH 范围 | Web 范围 | 说明 |
|------|---------|---------|------|
| 基础/通用 | 2201-2210 | 7681-7690 | base, test 等通用实例 |
| **项目开发** | **2211-2290** | **7701-7790** | 各业务项目专用 |
### 已分配
| 端口 | 实例 | 备注 |
|------|------|------|
| 2222 / 7681 | workpod-alpine | 基础实例 |
| 2223 / 7682 | workpod-test | 测试实例 |
| **2201 / 7701** | **ws-flux-dev** | **Flux 项目** |
| 2211 / 7711 | (预留) | suke |
| 2212 / 7712 | (预留) | case |
| 2213 / 7713 | (预留) | hszd |
### 测试服 (flux_dev)
复用本机规则 + 偏移,详见 registry.yaml → `remote` 段。
---
## 新建项目实例(3 步)
```bash
# 1. 从模板创建
mkdir -p instances/{name}
cp instances/.template/docker-compose.yml instances/{name}/
# 2. 编辑 compose 文件,修改以下占位符:
# {name} → 实例名
# {SSH_PORT} → 按 2211+ 分配
# {WEB_PORT} → 按 7711+ 分配
# {PROJECT_PATH} → E:/wk-{name}
# 3. 注册到 registry.yaml 并启动
cd instances/{name} && docker compose up -d --build
```
如需自定义镜像(如加 JDK),在 `instances/{name}/` 下创建 Dockerfile
```dockerfile
FROM workpod-alpine:latest
# 额外的 LABEL、VOLUME 声明等
ENTRYPOINT ["/entrypoint.sh"]
```
---
## 常用命令
```bash
# 查看所有实例状态
docker ps --filter name=workpod --format "table {{.Names}}\t{{.Status}}\t{{.Ports}"
# 启动指定实例
cd instances/{name} && docker compose up -d
# 停止指定实例
cd instances/{name} && docker compose down
# 重建(修改 Dockerfile/compose 后)
cd instances/{name} && docker compose up -d --build
# 进入容器
docker exec -it {container_name} bash
# 查看日志
docker logs -f {container_name}
```