SuperAPI AI 工具集

deploy

部署与运维

查看项目

更新于 10-15 21:44

技能介绍

用途:将 Pitfal Solutions 网站部署到 AWS,适用于用户说 deploy、push to production 或更新线上站点时。

主要能力与流程:

  1. 部署前检查:运行 pnpm test 验证测试通过,pnpm type-check 验证 TypeScript 编译,git status 检查未提交更改。
  2. 构建:运行 pnpm build 构建 Next.js 应用,并确认生成 out/ 目录。
  3. 基础设施部署:进入 infrastructure/terraform,按需执行 terraform init,运行 terraform plan -out=tfplan,向用户展示计划摘要并确认后再执行 terraform apply tfplan。
  4. 静态站点部署:用 aws s3 sync out/ s3://pitfal-static-site 同步资源,非 HTML 文件使用 --delete 与长缓存(public, max-age=31536000, immutable),HTML 文件使用 no-cache(public, max-age=0, must-revalidate),均指定 --profile pitfal。
  5. 部署后:获取 CloudFront Distribution ID(可通过 terraform output cloudfront_distribution_id、aws cloudfront list-distributions 查询 pitfal.solutions,或导出为环境变量 DISTRIBUTION_ID),再执行 aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths "/*" --profile pitfal --no-cli-pager 失效缓存。缓存全局生效需 1-5 分钟,随后验证 https://pitfal.solutions 可访问,并运行可用的冒烟测试。
  6. 回滚:部署失败时检查 terraform state list,必要时恢复之前的 S3 版本,并根据失败点提供具体回滚说明。

限制:资料未提供该技能的具体安装方式、依赖版本、权限配置细节及收费信息。