tinybird-deploy
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTinybird Deployment Skill
Tinybird 部署技能
Deploy observability pipes and datasources to Tinybird Cloud.
将可观测性管道和数据源部署到Tinybird Cloud。
Requirements
前提条件
- tb CLI: Install with or
curl -sSL https://tinybird.co | bashpip install tinybird-cli - Must run from directory
enter.pollinations.ai/observability - Authenticated to Tinybird (run if needed)
tb login
- tb CLI:通过或
curl -sSL https://tinybird.co | bash安装pip install tinybird-cli - 必须在目录下运行
enter.pollinations.ai/observability - 已通过Tinybird身份验证(如有需要请运行)
tb login
Workspace Info
工作区信息
| Property | Value |
|---|---|
| Workspace | |
| Region | |
| UI | https://cloud.tinybird.co/gcp/europe-west2/pollinations_enter |
| 属性 | 值 |
|---|---|
| 工作区 | |
| 区域 | |
| 界面 | https://cloud.tinybird.co/gcp/europe-west2/pollinations_enter |
Directory Structure
目录结构
enter.pollinations.ai/observability/
├── datasources/ # Data source definitions (.datasource)
│ ├── generation_event.datasource
│ ├── polar_event.datasource
│ ├── stripe_event.datasource
│ └── ...
└── endpoints/ # Pipe definitions (.pipe)
├── weekly_usage_stats.pipe
├── weekly_active_users.pipe
├── daily_stripe_revenue.pipe
└── ...enter.pollinations.ai/observability/
├── datasources/ # 数据源定义文件(.datasource)
│ ├── generation_event.datasource
│ ├── polar_event.datasource
│ ├── stripe_event.datasource
│ └── ...
└── endpoints/ # 管道定义文件(.pipe)
├── weekly_usage_stats.pipe
├── weekly_active_users.pipe
├── daily_stripe_revenue.pipe
└── ...Commands
命令
Step 1: Validate (Dry Run)
步骤1:验证(试运行)
Always validate before deploying:
bash
cd enter.pollinations.ai/observability
tb --cloud deploy --check --waitThis shows exactly what will change without deploying. Safe to run anytime.
Example output:
| status | name | type | path |
|----------|-----------------------|----------|--------------------------------------|
| modified | weekly_usage_stats | endpoint | endpoints/weekly_usage_stats.pipe |部署前请务必先验证:
bash
cd enter.pollinations.ai/observability
tb --cloud deploy --check --wait该命令会显示所有即将发生的变更,但不会实际部署,可随时安全运行。
示例输出:
| status | name | type | path |
|----------|-----------------------|----------|--------------------------------------|
| modified | weekly_usage_stats | endpoint | endpoints/weekly_usage_stats.pipe |Step 2: Deploy
步骤2:部署
If validation passes:
bash
tb --cloud deploy --wait验证通过后执行部署:
bash
tb --cloud deploy --waitStep 3: Verify
步骤3:验证部署结果
Test the deployed pipe:
bash
undefined测试已部署的管道:
bash
undefinedGet Tinybird token from secrets
从密钥中获取Tinybird令牌
TINYBIRD_TOKEN=$(sops -d ../kpi/secrets/env.json | jq -r '.TINYBIRD_TOKEN')
TINYBIRD_TOKEN=$(sops -d ../kpi/secrets/env.json | jq -r '.TINYBIRD_TOKEN')
Test the pipe
测试管道
curl -s "https://api.europe-west2.gcp.tinybird.co/v0/pipes/weekly_usage_stats.json?weeks_back=12"
-H "Authorization: Bearer $TINYBIRD_TOKEN" | jq '.data | length'
-H "Authorization: Bearer $TINYBIRD_TOKEN" | jq '.data | length'
---curl -s "https://api.europe-west2.gcp.tinybird.co/v0/pipes/weekly_usage_stats.json?weeks_back=12"
-H "Authorization: Bearer $TINYBIRD_TOKEN" | jq '.data | length'
-H "Authorization: Bearer $TINYBIRD_TOKEN" | jq '.data | length'
---Safety Features
安全特性
| Flag | Description |
|---|---|
| Validates without making changes (dry run) |
| Waits for deployment to complete |
| Prevents removing datasources (default) |
| Required to delete datasources |
| 标志 | 描述 |
|---|---|
| 仅验证变更,不实际执行(试运行) |
| 等待部署完成 |
| 防止删除数据源(默认开启) |
| 删除数据源时必须使用该标志 |
Common Tasks
常见任务
Add a New Pipe
添加新管道
- Create file in
.pipeendpoints/ - Validate:
tb --cloud deploy --check --wait - Deploy:
tb --cloud deploy --wait
- 在目录下创建
endpoints/文件.pipe - 验证:
tb --cloud deploy --check --wait - 部署:
tb --cloud deploy --wait
Modify Existing Pipe
修改现有管道
- Edit the file
.pipe - Validate:
tb --cloud deploy --check --wait - Deploy:
tb --cloud deploy --wait
- 编辑对应的文件
.pipe - 验证:
tb --cloud deploy --check --wait - 部署:
tb --cloud deploy --wait
View Pipe in UI
在界面中查看管道
Troubleshooting
故障排除
"tb: command not found"
"tb: command not found"
bash
curl -sSL https://tinybird.co | bashbash
curl -sSL https://tinybird.co | bashOr
或者
pip install tinybird-cli
undefinedpip install tinybird-cli
undefined"Not authenticated"
"未通过身份验证"
bash
tb loginbash
tb loginFollow prompts to authenticate
按照提示完成身份验证
undefinedundefinedPipe Timeout Issues
管道超时问题
If a pipe times out with large :
weeks_back- Use instead of
uniq()for user counts (~10x faster)uniqExact() - Avoid CTE + JOIN patterns - use single-pass queries
- Consider materialized views for expensive aggregations
如果设置较大的时管道超时:
weeks_back- 统计用户数量时使用替代
uniq()(速度提升约10倍)uniqExact() - 避免使用CTE + JOIN模式,采用单遍查询
- 考虑为高开销的聚合操作使用物化视图
Important Notes
重要注意事项
- Always use : Without it, CLI tries to use Tinybird Local (Docker)
--cloud - Do NOT use : It's deprecated, use
tb pushtb --cloud deploy - Run from observability directory: Not from repo root
- 务必使用标志:如果省略,CLI会尝试连接Tinybird Local(Docker环境)
--cloud - 请勿使用:该命令已被弃用,请使用
tb pushtb --cloud deploy - 必须在observability目录下运行:不要从仓库根目录执行