truefoundry-deploy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseRouting note: For ambiguous user intents, use the shared clarification templates in references/intent-clarification.md.
路由注意:如果用户意图不明确,请使用 references/intent-clarification.md 中的通用澄清模板。
Deploy to TrueFoundry
部署到TrueFoundry
Route user intent to the right deployment workflow. Load only the references you need.
将用户意图路由到正确的部署工作流。仅加载你需要的参考文档。
Intent Router
意图路由器
| User Intent | Action | Reference |
|---|---|---|
| "deploy", "deploy my app", "ship this" | Single HTTP service | deploy-service.md |
| "mount this file", "mount config file", "mount certificate file", "mount key file" | Single service with file mounts (no image rebuild) | deploy-service.md |
| "tfy apply", "apply manifest", "deploy from yaml" | Declarative manifest apply | deploy-apply.md |
| "deploy everything", "full stack", docker-compose, "docker-compose.yaml", "compose.yaml" | Multi-service: use compose as source of truth | deploy-multi.md + compose-translation.md |
| "async service", "queue consumer", "worker" | Async/queue service | deploy-async.md |
| "deploy LLM", "serve model" | Model serving intent (may be ambiguous) | Ask user: dedicated model serving ( |
| "deploy helm chart" | Helm chart intent | Confirm Helm path and collect chart details, then proceed with |
| "deploy postgres docker", "dockerized postgres", "deploy redis docker", "database in docker/container" | Containerized database intent | Proceed with |
| "deploy database", "deploy postgres", "deploy redis" | Ambiguous infra intent | Ask user: Helm chart ( |
Load only the reference file matching the user's intent. Do not preload all references.
| 用户意图 | 动作 | 参考文档 |
|---|---|---|
| "deploy", "deploy my app", "ship this" | 单HTTP服务 | deploy-service.md |
| "mount this file", "mount config file", "mount certificate file", "mount key file" | 带文件挂载的单服务(无需重建镜像) | deploy-service.md |
| "tfy apply", "apply manifest", "deploy from yaml" | 声明式清单应用 | deploy-apply.md |
| "deploy everything", "full stack", docker-compose, "docker-compose.yaml", "compose.yaml" | 多服务:以compose为事实来源 | deploy-multi.md + compose-translation.md |
| "async service", "queue consumer", "worker" | 异步/队列服务 | deploy-async.md |
| "deploy LLM", "serve model" | 模型服务意图(可能存在歧义) | 询问用户:专用模型服务( |
| "deploy helm chart" | Helm chart意图 | 确认Helm路径并收集chart详情,然后执行 |
| "deploy postgres docker", "dockerized postgres", "deploy redis docker", "database in docker/container" | 容器化数据库意图 | 执行 |
| "deploy database", "deploy postgres", "deploy redis" | 模糊的基础设施意图 | 询问用户:Helm chart( |
仅加载与用户意图匹配的参考文件。 不要预加载所有参考文档。
Prerequisites (All Workflows)
前置要求(所有工作流)
bash
undefinedbash
undefined1. Check credentials
1. 检查凭证
grep '^TFY_' .env 2>/dev/null || true
env | grep '^TFY_' 2>/dev/null || true
grep '^TFY_' .env 2>/dev/null || true
env | grep '^TFY_' 2>/dev/null || true
2. Derive TFY_HOST for CLI (MUST run before any tfy command)
2. 为CLI推导TFY_HOST(执行任何tfy命令前必须运行)
export TFY_HOST="${TFY_HOST:-${TFY_BASE_URL%/}}"
export TFY_HOST="${TFY_HOST:-${TFY_BASE_URL%/}}"
3. Check CLI
3. 检查CLI
tfy --version 2>/dev/null || echo "Install: pip install 'truefoundry==0.5.0'"
tfy --version 2>/dev/null || echo "Install: pip install 'truefoundry==0.5.0'"
4. Check for existing manifests
4. 检查现有清单
ls tfy-manifest.yaml truefoundry.yaml 2>/dev/null
- `TFY_BASE_URL` and `TFY_API_KEY` must be set (env or `.env`).
- **`TFY_HOST` must be set before any `tfy` CLI command.** The export above handles this automatically.
- `TFY_WORKSPACE_FQN` required. **HARD RULE: Never auto-pick a workspace. Always ask the user to confirm, even if only one workspace exists or a preference is saved.** See `references/prerequisites.md` for the full workspace confirmation flow.
- For full credential setup, see `references/prerequisites.md`.
> **WARNING:** Never use `source .env`. The `tfy-api.sh` script handles `.env` parsing automatically. For shell access: `grep KEY .env | cut -d= -f2-`ls tfy-manifest.yaml truefoundry.yaml 2>/dev/null
- 必须设置`TFY_BASE_URL`和`TFY_API_KEY`(环境变量或`.env`文件中)。
- **在执行任何`tfy` CLI命令前必须设置`TFY_HOST`。** 上面的导出命令会自动处理这一点。
- 需要`TFY_WORKSPACE_FQN`。**硬性规则:永远不要自动选择工作区。即使用户只有一个工作区或保存了偏好,也要始终请用户确认。** 完整的工作区确认流程请查看`references/prerequisites.md`。
- 完整的凭证设置说明请查看`references/prerequisites.md`。
> **警告:** 永远不要使用`source .env`。`tfy-api.sh`脚本会自动解析`.env`。如需获取shell访问权限,请使用:`grep KEY .env | cut -d= -f2-`Quick Ops (Inline)
快速操作(内联)
Apply a manifest (most common)
应用清单(最常用)
bash
undefinedbash
undefinedtfy CLI expects TFY_HOST when TFY_API_KEY is set
当TFY_API_KEY已设置时,tfy CLI需要TFY_HOST参数
export TFY_HOST="${TFY_HOST:-${TFY_BASE_URL%/}}"
export TFY_HOST="${TFY_HOST:-${TFY_BASE_URL%/}}"
Preview changes
预览变更
tfy apply -f tfy-manifest.yaml --dry-run --show-diff
tfy apply -f tfy-manifest.yaml --dry-run --show-diff
Apply
应用变更
tfy apply -f tfy-manifest.yaml
undefinedtfy apply -f tfy-manifest.yaml
undefinedDeploy from source (local code or git)
从源码部署(本地代码或git仓库)
bash
undefinedbash
undefinedtfy CLI expects TFY_HOST when TFY_API_KEY is set
当TFY_API_KEY已设置时,tfy CLI需要TFY_HOST参数
export TFY_HOST="${TFY_HOST:-${TFY_BASE_URL%/}}"
export TFY_HOST="${TFY_HOST:-${TFY_BASE_URL%/}}"
tfy deploy builds remotely — use for local code or git sources
tfy deploy会执行远程构建 — 适用于本地代码或git源码
tfy deploy -f truefoundry.yaml --no-wait
> **`tfy apply` does NOT support `build_source`.** Use `tfy deploy -f` for source-based deployments.tfy deploy -f truefoundry.yaml --no-wait
> **`tfy apply`不支持`build_source`。** 基于源码的部署请使用`tfy deploy -f`Minimal service manifest template
最简服务清单模板
yaml
name: my-service
type: service
image:
type: image
image_uri: docker.io/myorg/my-api:v1.0
ports:
- port: 8000
expose: true
app_protocol: http
resources:
cpu_request: 0.5
cpu_limit: 1
memory_request: 512
memory_limit: 1024
ephemeral_storage_request: 1000
ephemeral_storage_limit: 2000
env:
LOG_LEVEL: info
replicas: 1
workspace_fqn: "WORKSPACE_FQN_HERE"yaml
name: my-service
type: service
image:
type: image
image_uri: docker.io/myorg/my-api:v1.0
ports:
- port: 8000
expose: true
app_protocol: http
resources:
cpu_request: 0.5
cpu_limit: 1
memory_request: 512
memory_limit: 1024
ephemeral_storage_request: 1000
ephemeral_storage_limit: 2000
env:
LOG_LEVEL: info
replicas: 1
workspace_fqn: "WORKSPACE_FQN_HERE"Check deployment status
检查部署状态
bash
TFY_API_SH=~/.claude/skills/truefoundry-deploy/scripts/tfy-api.sh
bash $TFY_API_SH GET '/api/svc/v1/apps?workspaceFqn=WORKSPACE_FQN&applicationName=SERVICE_NAME'Or use the skill.
applicationsbash
TFY_API_SH=~/.claude/skills/truefoundry-deploy/scripts/tfy-api.sh
bash $TFY_API_SH GET '/api/svc/v1/apps?workspaceFqn=WORKSPACE_FQN&applicationName=SERVICE_NAME'或者使用 skill。
applicationsPost-Deploy Verification (Automatic)
部署后验证(自动)
After any successful deploy/apply action, verify deployment status automatically without asking an extra prompt.
Preferred verification path:
- Use MCP tool call first:
tfy_applications_list(filters={"workspace_fqn": "WORKSPACE_FQN", "application_name": "SERVICE_NAME"})- If MCP tool calls are unavailable, fall back to:
bash
TFY_API_SH=~/.claude/skills/truefoundry-deploy/scripts/tfy-api.sh
bash $TFY_API_SH GET '/api/svc/v1/apps?workspaceFqn=WORKSPACE_FQN&applicationName=SERVICE_NAME'Always report the observed status (, , , , etc.) in the same response.
BUILDINGDEPLOYINGDEPLOY_SUCCESSDEPLOY_FAILEDIf status is or , follow deploy-debugging.md: fetch logs (use skill), identify cause, apply one fix and retry once; if still failed, report to user with summary and log excerpt and stop.
DEPLOY_FAILEDBUILD_FAILEDlogs任何部署/应用操作成功后,无需额外询问即可自动验证部署状态。
推荐的验证路径:
- 优先使用MCP工具调用:
tfy_applications_list(filters={"workspace_fqn": "WORKSPACE_FQN", "application_name": "SERVICE_NAME"})- 如果无法使用MCP工具调用,降级使用:
bash
TFY_API_SH=~/.claude/skills/truefoundry-deploy/scripts/tfy-api.sh
bash $TFY_API_SH GET '/api/svc/v1/apps?workspaceFqn=WORKSPACE_FQN&applicationName=SERVICE_NAME'请始终在同一条响应中返回观察到的状态(、、、等)。
BUILDINGDEPLOYINGDEPLOY_SUCCESSDEPLOY_FAILED如果状态为或,请遵循deploy-debugging.md:获取日志(使用 skill)、定位问题、应用修复并重试一次;如果仍然失败,向用户返回摘要和日志片段后终止流程。
DEPLOY_FAILEDBUILD_FAILEDlogsREST API fallback (when CLI unavailable)
REST API降级方案(CLI不可用时)
See for converting YAML to JSON and deploying via .
references/cli-fallback.mdtfy-api.sh如需将YAML转换为JSON并通过部署,请查看。
tfy-api.shreferences/cli-fallback.mdAuto-Detection: Single vs Multi-Service
自动检测:单服务vs多服务
Before creating any manifest, scan the project:
- Check for ,
docker-compose.yml, ordocker-compose.yamlfirst. If present (or user mentions docker-compose), treat it as the primary source of truth: load deploy-multi.md and compose-translation.md, generate manifests from the compose file, wire services per service-wiring.md, then complete deployment. Do not ask the user to manually create manifests when a compose file exists.compose.yaml - Look for multiple files across the project
Dockerfile - Check for service directories with their own dependency files in ,
services/,apps/,frontend/backend/
- Compose file present or user says "docker-compose" → Multi-service from compose: load +
deploy-multi.mdcompose-translation.md - Single service → Load
references/deploy-service.md - Multiple services (no compose) → Load
references/deploy-multi.md
在创建任何清单前,请先扫描项目:
- 优先检查是否存在、
docker-compose.yml或docker-compose.yaml。 如果存在(或用户提到docker-compose),将其视为首要事实来源:加载deploy-multi.md和compose-translation.md,从compose文件生成清单,按照service-wiring.md连接服务,然后完成部署。当存在compose文件时,不要要求用户手动创建清单。compose.yaml - 扫描项目中是否存在多个文件
Dockerfile - 检查、
services/、apps/、frontend/目录下是否存在自带依赖文件的服务目录backend/
- 存在Compose文件或用户提到"docker-compose" → 基于compose的多服务部署:加载+
deploy-multi.mdcompose-translation.md - 单服务 → 加载
references/deploy-service.md - 多服务(无compose) → 加载
references/deploy-multi.md
Secrets Handling (Default: Secret Groups)
密钥处理(默认:密钥组)
By default, do not put secrets in env as raw values. For any env var that looks sensitive (e.g. , , , , , with credentials):
*PASSWORD**SECRET**TOKEN**KEY**API_KEY**DATABASE_URL*- Create a secret group (use the skill or API) with those keys.
secrets - Reference them in the manifest with format.
tfy-secret://
yaml
env:
LOG_LEVEL: info # plain text OK
DB_PASSWORD: tfy-secret://my-org:my-service-secrets:DB_PASSWORD # sensitivePattern: where TENANT_NAME is the subdomain of .
tfy-secret://<TENANT_NAME>:<SECRET_GROUP_NAME>:<SECRET_KEY>TFY_BASE_URLUse the skill for guided secret group creation. For the full workflow, see (Secrets Handling section).
secretsreferences/deploy-service.md默认情况下,不要将密钥以明文形式放在环境变量中。 对于任何看起来敏感的环境变量(例如、、、、、带凭证的):
*PASSWORD**SECRET**TOKEN**KEY**API_KEY**DATABASE_URL*- (使用skill或API)创建包含这些密钥的密钥组。
secrets - 在清单中使用格式引用它们。
tfy-secret://
yaml
env:
LOG_LEVEL: info # 明文允许
DB_PASSWORD: tfy-secret://my-org:my-service-secrets:DB_PASSWORD # 敏感数据格式:,其中TENANT_NAME是的子域名。
tfy-secret://<TENANT_NAME>:<SECRET_GROUP_NAME>:<SECRET_KEY>TFY_BASE_URL如需引导式创建密钥组,请使用 skill。完整工作流请查看(密钥处理章节)。
secretsreferences/deploy-service.mdFile Mounts (Config, Secrets, Shared Data)
文件挂载(配置、密钥、共享数据)
When users ask to mount files into a deployment, prefer manifest over Dockerfile edits:
mounts- for sensitive file content (keys, certs, credentials)
type: secret - for non-sensitive config files
type: config_map - for writable/shared runtime data
type: volume
See (File Mounts section) for the end-to-end workflow.
references/deploy-service.md当用户要求将文件挂载到部署中时,优先使用清单的配置而非修改Dockerfile:
mounts- 用于敏感文件内容(密钥、证书、凭证)
type: secret - 用于非敏感配置文件
type: config_map - 用于可写/共享运行时数据
type: volume
端到端工作流请查看(文件挂载章节)。
references/deploy-service.mdShared References
共享参考文档
These references are available for all workflows — load as needed:
| Reference | Contents |
|---|---|
| Complete YAML field reference (single source of truth) |
| Per-service-type defaults with YAML templates |
| CLI detection and REST API fallback pattern |
| Extract cluster ID, base domains, available GPUs |
| CPU, memory, GPU sizing rules of thumb |
| Startup, readiness, liveness probe configuration |
| GPU types and VRAM reference |
| Pinned container image versions |
| Credential setup and .env configuration |
| Full REST API manifest reference |
| 参考文档 | 内容 |
|---|---|
| 完整YAML字段参考(唯一事实来源) |
| 各服务类型默认配置与YAML模板 |
| CLI检测与REST API降级方案 |
| 提取集群ID、基础域名、可用GPU |
| CPU、内存、GPU sizing经验规则 |
| 启动探针、就绪探针、存活探针配置 |
| GPU类型与显存参考 |
| 固定版本的容器镜像 |
| 凭证设置与.env配置 |
| 完整REST API清单参考 |
Workflow-Specific References
工作流专属参考文档
| Reference | Used By |
|---|---|
| deploy-service |
| deploy-service |
| deploy-service |
| deploy-service |
| deploy-service |
| deploy-apply |
| deploy-apply |
| deploy-multi |
| deploy-multi |
| deploy-multi |
| deploy-multi |
| deploy-multi |
| All deploy/apply (when status is failed) |
| deploy-async |
| deploy-async |
| deploy-async |
| deploy-async |
| 参考文档 | 适用工作流 |
|---|---|
| deploy-service |
| deploy-service |
| deploy-service |
| deploy-service |
| deploy-service |
| deploy-apply |
| deploy-apply |
| deploy-multi |
| deploy-multi |
| deploy-multi |
| deploy-multi |
| deploy-multi |
| 所有deploy/apply(状态失败时) |
| deploy-async |
| deploy-async |
| deploy-async |
| deploy-async |
Composability
可组合性
- Find workspace: Use skill
workspaces - Check what's deployed: Use skill
applications - View logs: Use skill
logs - Manage secrets: Use skill
secrets - Deploy Helm charts: Use skill
helm - Deploy LLMs: Use skill
llm-deploy - Test after deploy: Use skill
service-test
- 查找工作区:使用skill
workspaces - 检查已部署内容:使用skill
applications - 查看日志:使用skill
logs - 管理密钥:使用skill
secrets - 部署Helm charts:使用skill
helm - 部署LLMs:使用skill
llm-deploy - 部署后测试:使用skill
service-test
Success Criteria
成功标准
- User confirmed service name, resources, port, and deployment source before deploying
- Deployment URL and status reported back to the user
- Deployment status verified automatically immediately after apply/deploy (no extra prompt)
- Health probes configured for production deployments
- Secrets stored securely (not hardcoded in manifests)
- For multi-service: all services wired together and working end-to-end
- 部署前用户已确认服务名称、资源、端口和部署源
- 已向用户返回部署URL和状态
- 应用/部署完成后立即自动验证了部署状态(无额外询问)
- 生产环境部署已配置健康检查探针
- 密钥已安全存储(未硬编码在清单中)
- 多服务部署:所有服务已互相连接且端到端正常运行