deploy-pipeline
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDeploy Pipeline (Stripe / Supabase / Vercel)
部署流水线(Stripe / Supabase / Vercel)
Coordinate staged releases across Stripe, Supabase, and Vercel from the shell using the Composio CLI. One script kicks off the whole "ship it" sequence: product/price updates, DB migrations, frontend deploy, smoke checks, changelog post.
通过Shell使用Composio CLI协调Stripe、Supabase和Vercel的分阶段发布。单个脚本即可启动整个"发布"流程:产品/价格更新、数据库迁移、前端部署、冒烟测试、更新变更日志。
When to Use
使用场景
- Full-stack product launch that touches billing, database, and frontend together.
- Promoting a preview Vercel build to production with a Stripe price flip and a Supabase migration.
- Weekly release trains where the same sequence repeats and you want it reliable.
- 同时涉及计费系统、数据库和前端的全栈产品发布。
- 将Vercel预览构建版本升级至生产环境,同时切换Stripe定价并执行Supabase迁移。
- 重复执行相同流程的每周发布周期,需要确保流程可靠性。
Prereqs
前置条件
bash
curl -fsSL https://composio.dev/install | bash
composio login
composio link stripe
composio link supabase
composio link vercel
composio link slack # for release announcementsbash
curl -fsSL https://composio.dev/install | bash
composio login
composio link stripe
composio link supabase
composio link vercel
composio link slack # 用于发布通知Discover Tools
探索工具
bash
composio search "create price" --toolkits stripe
composio search "apply migration" --toolkits supabase
composio search "create deployment" --toolkits vercel
composio tools list stripe
composio tools list supabase
composio tools list vercelCommon slugs (verify with ):
--get-schemaStripe
STRIPE_CREATE_PRODUCTSTRIPE_CREATE_PRICESTRIPE_UPDATE_PRODUCTSTRIPE_LIST_PRICES
Supabase
SUPABASE_LIST_PROJECTSSUPABASE_RUN_SQL_QUERYSUPABASE_LIST_MIGRATIONSSUPABASE_APPLY_MIGRATION
Vercel
VERCEL_CREATE_A_NEW_DEPLOYMENTVERCEL_GET_A_DEPLOYMENT_BY_ID_OR_URLVERCEL_LIST_DEPLOYMENTSVERCEL_PROMOTE_DEPLOYMENT
bash
composio search "create price" --toolkits stripe
composio search "apply migration" --toolkits supabase
composio search "create deployment" --toolkits vercel
composio tools list stripe
composio tools list supabase
composio tools list vercel常用标识(可通过验证):
--get-schemaStripe
STRIPE_CREATE_PRODUCTSTRIPE_CREATE_PRICESTRIPE_UPDATE_PRODUCTSTRIPE_LIST_PRICES
Supabase
SUPABASE_LIST_PROJECTSSUPABASE_RUN_SQL_QUERYSUPABASE_LIST_MIGRATIONSSUPABASE_APPLY_MIGRATION
Vercel
VERCEL_CREATE_A_NEW_DEPLOYMENTVERCEL_GET_A_DEPLOYMENT_BY_ID_OR_URLVERCEL_LIST_DEPLOYMENTSVERCEL_PROMOTE_DEPLOYMENT
The Pipeline
流水线流程
The order matters: Stripe → Supabase → Vercel → Verify → Announce. Billing changes before DB, DB before frontend.
执行顺序至关重要:Stripe → Supabase → Vercel → 验证 → 通知。计费变更先于数据库操作,数据库操作先于前端部署。
1. Stripe: Create or Update the Price
1. Stripe:创建或更新定价
bash
composio execute STRIPE_CREATE_PRICE -d '{
"product":"prod_abc123",
"unit_amount":2900,
"currency":"usd",
"recurring":{"interval":"month"},
"lookup_key":"team-plan-v2"
}'bash
composio execute STRIPE_CREATE_PRICE -d '{
"product":"prod_abc123",
"unit_amount":2900,
"currency":"usd",
"recurring":{"interval":"month"},
"lookup_key":"team-plan-v2"
}'2. Supabase: Apply Migrations
2. Supabase:执行迁移
bash
composio execute SUPABASE_APPLY_MIGRATION -d '{
"project_id":"abcxyz",
"name":"add_team_tier_column",
"query":"alter table teams add column tier text default '\''free'\'';"
}'Sanity-check the schema after:
bash
composio execute SUPABASE_RUN_SQL_QUERY -d '{
"project_id":"abcxyz",
"query":"select column_name from information_schema.columns where table_name='\''teams'\'' and column_name='\''tier'\'';"
}'bash
composio execute SUPABASE_APPLY_MIGRATION -d '{
"project_id":"abcxyz",
"name":"add_team_tier_column",
"query":"alter table teams add column tier text default '\''free'\'';"
}'迁移后检查数据库结构:
bash
composio execute SUPABASE_RUN_SQL_QUERY -d '{
"project_id":"abcxyz",
"query":"select column_name from information_schema.columns where table_name='\''teams'\'' and column_name='\''tier'\'';"
}'3. Vercel: Deploy + Promote
3. Vercel:部署并升级
bash
undefinedbash
undefinedTrigger a production deployment from a git ref
从Git引用触发生产环境部署
composio execute VERCEL_CREATE_A_NEW_DEPLOYMENT -d '{
"name":"web",
"target":"production",
"gitSource":{"type":"github","ref":"main","repoId":123456}
}'
Poll until ready:
```bash
composio execute VERCEL_GET_A_DEPLOYMENT_BY_ID_OR_URL -d '{"idOrUrl":"dpl_xxx"}' \
| jq '.readyState'composio execute VERCEL_CREATE_A_NEW_DEPLOYMENT -d '{
"name":"web",
"target":"production",
"gitSource":{"type":"github","ref":"main","repoId":123456}
}'
轮询等待部署完成:
```bash
composio execute VERCEL_GET_A_DEPLOYMENT_BY_ID_OR_URL -d '{"idOrUrl":"dpl_xxx"}' \
| jq '.readyState'4. Verify
4. 验证
bash
curl -fsS https://app.acme.com/api/health
composio execute SUPABASE_RUN_SQL_QUERY -d '{
"project_id":"abcxyz","query":"select count(*) from teams where tier is null;"
}'bash
curl -fsS https://app.acme.com/api/health
composio execute SUPABASE_RUN_SQL_QUERY -d '{
"project_id":"abcxyz","query":"select count(*) from teams where tier is null;"
}'5. Announce
5. 发布通知
bash
composio execute SLACK_SEND_MESSAGE -d '{
"channel":"releases",
"text":"✅ Team Plan v2 shipped. Stripe price `team-plan-v2` live, Supabase migration applied, Vercel production promoted."
}'bash
composio execute SLACK_SEND_MESSAGE -d '{
"channel":"releases",
"text":"✅ Team Plan v2已发布。Stripe定价`team-plan-v2`生效,Supabase迁移完成,Vercel生产环境部署升级完毕。"
}'Pipeline as a Workflow File
流水线工作流文件
scripts/ship.tscomposio run --file scripts/ship.ts -- --ref maints
const ref = process.argv[process.argv.indexOf("--ref") + 1] ?? "main";
// 1. Stripe
const price = await execute("STRIPE_CREATE_PRICE", {
product: "prod_abc123", unit_amount: 2900, currency: "usd",
recurring: { interval: "month" }, lookup_key: "team-plan-v2"
});
// 2. Supabase
await execute("SUPABASE_APPLY_MIGRATION", {
project_id: "abcxyz",
name: "add_team_tier_column",
query: "alter table teams add column tier text default 'free';"
});
// 3. Vercel
const dep = await execute("VERCEL_CREATE_A_NEW_DEPLOYMENT", {
name: "web", target: "production",
gitSource: { type: "github", ref, repoId: 123456 }
});
// 4. Wait for ready
let state = "QUEUED";
while (state !== "READY" && state !== "ERROR") {
await new Promise(r => setTimeout(r, 4000));
const d = await execute("VERCEL_GET_A_DEPLOYMENT_BY_ID_OR_URL", { idOrUrl: dep.id });
state = d.readyState;
}
if (state !== "READY") throw new Error("Vercel deploy failed");
// 5. Announce
await execute("SLACK_SEND_MESSAGE", {
channel: "releases",
text: `✅ Shipped ${ref}. Stripe price ${price.id}, Vercel ${dep.url}.`
});scripts/ship.tscomposio run --file scripts/ship.ts -- --ref maints
const ref = process.argv[process.argv.indexOf("--ref") + 1] ?? "main";
// 1. Stripe
const price = await execute("STRIPE_CREATE_PRICE", {
product: "prod_abc123", unit_amount: 2900, currency: "usd",
recurring: { interval: "month" }, lookup_key: "team-plan-v2"
});
// 2. Supabase
await execute("SUPABASE_APPLY_MIGRATION", {
project_id: "abcxyz",
name: "add_team_tier_column",
query: "alter table teams add column tier text default 'free';"
});
// 3. Vercel
const dep = await execute("VERCEL_CREATE_A_NEW_DEPLOYMENT", {
name: "web", target: "production",
gitSource: { type: "github", ref, repoId: 123456 }
});
// 4. 等待部署就绪
let state = "QUEUED";
while (state !== "READY" && state !== "ERROR") {
await new Promise(r => setTimeout(r, 4000));
const d = await execute("VERCEL_GET_A_DEPLOYMENT_BY_ID_OR_URL", { idOrUrl: dep.id });
state = d.readyState;
}
if (state !== "READY") throw new Error("Vercel部署失败");
// 5. 发布通知
await execute("SLACK_SEND_MESSAGE", {
channel: "releases",
text: `✅ 已发布${ref}版本。Stripe定价ID:${price.id},Vercel部署地址:${dep.url}。`
});Rollback Plan
回滚方案
If verification fails, undo in reverse order:
- Vercel: to the previous deployment ID.
VERCEL_PROMOTE_DEPLOYMENT - Supabase: apply the down migration (always write the paired before shipping).
down.sql - Stripe: to hide the new price (
STRIPE_UPDATE_PRODUCT); do not delete — Stripe objects are immutable in practice and affect historical invoices.active:false - Slack: announce the rollback.
如果验证失败,按逆序执行回滚:
- Vercel:使用切换至之前的部署ID。
VERCEL_PROMOTE_DEPLOYMENT - Supabase:执行回滚迁移(发布前务必编写对应的)。
down.sql - Stripe:使用隐藏新定价(设置
STRIPE_UPDATE_PRODUCT);请勿删除——Stripe对象实际不可变,删除会影响历史账单。active:false - Slack:发布回滚通知。
Troubleshooting
故障排查
- Stripe price visible but checkout still shows old one → cache on your app side; confirm is what checkout fetches.
lookup_key - Supabase migration hangs → another connection holds a lock; run .
select pid, state, query from pg_stat_activity where state <> 'idle'; - Vercel deploy stuck in → check build logs via
QUEUEDwithVERCEL_GET_A_DEPLOYMENT_BY_ID_OR_URL.?logs=1 - Ordering bug (frontend reads a column before migration applies) → always serialize the pipeline; never across Stripe/Supabase/Vercel.
--parallel
Full CLI reference: docs.composio.dev/docs/cli
- Stripe新定价已可见但结账仍显示旧定价 → 检查应用端缓存;确认结账时获取的正确。
lookup_key - Supabase迁移卡住 → 其他连接持有锁;执行排查。
select pid, state, query from pg_stat_activity where state <> 'idle'; - Vercel部署一直处于状态 → 通过带
QUEUED参数的?logs=1查看构建日志。VERCEL_GET_A_DEPLOYMENT_BY_ID_OR_URL - 顺序错误(前端在迁移完成前读取新增字段) → 务必串行执行流水线;禁止在Stripe/Supabase/Vercel之间使用并行执行。
--parallel
完整CLI文档:docs.composio.dev/docs/cli