# Deploy Layout

`deploy/` 目录按角色拆分为四套部署与测试入口：

- `server/`: 本仓库 RTR Server（`src/main.rs`）容器化部署
- `client/`: 本仓库 `rtr_debug_client` 容器化部署
- `rpki-rs-client/`: 基于外部 `rpki-rs` client API 的测试客户端容器化部署
- `frr/`: FRR 作为黑盒 RTR Client 的配置与 compose

---

## 1) Server

路径：
- `deploy/server/Dockerfile`
- `deploy/server/docker-compose.yml`
- `deploy/server/DEPLOYMENT.md`

单独 build 镜像：

```bash
docker build -f deploy/server/Dockerfile -t rpki-rtr:latest .
```

启动：

```bash
docker compose -f deploy/server/docker-compose.yml up -d --build
```

停止：

```bash
docker compose -f deploy/server/docker-compose.yml down
```

日志：

```bash
docker compose -f deploy/server/docker-compose.yml logs -f rpki-rtr
```

---

## 2) Debug Client

路径：
- `deploy/client/Dockerfile`
- `deploy/client/docker-compose.yml`
- `deploy/client/docker-compose.clients.yml`

单独 build 镜像：

```bash
docker build -f deploy/client/Dockerfile -t rpki-rtr-debug-client:latest .
```

单实例启动（交互调试）：

```bash
docker compose -f deploy/client/docker-compose.yml up --build
```

单实例停止：

```bash
docker compose -f deploy/client/docker-compose.yml down
```

单实例日志：

```bash
docker compose -f deploy/client/docker-compose.yml logs -f rtr-debug-client
```

多实例启动（5 个并发 client）：

```bash
docker compose -f deploy/client/docker-compose.clients.yml up -d
```

多实例停止：

```bash
docker compose -f deploy/client/docker-compose.clients.yml down
```

多实例日志：

```bash
docker compose -f deploy/client/docker-compose.clients.yml logs -f
```

---

## 3) rpki-rs Client

路径：
- `deploy/rpki-rs-client/Dockerfile`
- `deploy/rpki-rs-client/docker-compose.yml`

单独 build 镜像：

```bash
docker build -f deploy/rpki-rs-client/Dockerfile -t rpki-rs-test-client:latest .
```

默认启动（自动 serial 测试）：

```bash
docker compose -f deploy/rpki-rs-client/docker-compose.yml up --build
```

覆盖默认参数运行：

```bash
docker compose -f deploy/rpki-rs-client/docker-compose.yml run --rm \
  rpki-rs-test-client 127.0.0.1:323 2 reset --steps 1 --assert-min-records 1
```

停止：

```bash
docker compose -f deploy/rpki-rs-client/docker-compose.yml down
```

日志：

```bash
docker compose -f deploy/rpki-rs-client/docker-compose.yml logs -f rpki-rs-test-client
```

---

## 4) FRR Client

路径：
- `deploy/frr/docker-compose.yml`
- `deploy/frr/daemons.example`
- `deploy/frr/frr.conf.example`
- `deploy/frr/README.md`
- `deploy/frr/README.zh.md`

启动：

```bash
docker compose -f deploy/frr/docker-compose.yml up -d
```

检查连接：

```bash
docker exec -it frr-rpki-client vtysh -c "show rpki cache-connection"
docker exec -it frr-rpki-client vtysh -c "show rpki prefix-table"
```

停止：

```bash
docker compose -f deploy/frr/docker-compose.yml down
```

日志：

```bash
docker compose -f deploy/frr/docker-compose.yml logs -f frr-rpki-client
```

---

## 5) BIRD Client

路径:
- `deploy/bird/Dockerfile`
- `deploy/bird/docker-compose.yml`
- `deploy/bird/docker-compose.tls.yml`
- `deploy/bird/bird.conf.example`
- `deploy/bird/bird.conf.tls.example`
- `deploy/bird/README.md`
- `deploy/bird/README.zh.md`

启动:
```bash
docker compose -f deploy/bird/docker-compose.yml up --build
```

观察活动:

```bash
docker logs -f bird-rpki-client
```

停止:
```bash
docker compose -f deploy/bird/docker-compose.yml down
```

日志:
```bash
docker compose -f deploy/bird/docker-compose.yml logs -f bird-rpki-client
```

TLS/mTLS:
```bash
docker compose -f deploy/bird/docker-compose.yml -f deploy/bird/docker-compose.tls.yml up --build
docker logs -f bird-rpki-client
```
