instantly-deploy-integration
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInstantly Deploy Integration
Instantly 部署集成
Overview
概述
Deploy Instantly-powered applications to popular platforms with proper secrets management.
将基于Instantly的应用部署至主流平台,并进行规范的密钥管理。
Prerequisites
前置条件
- Instantly API keys for production environment
- Platform CLI installed (vercel, fly, or gcloud)
- Application code ready for deployment
- Environment variables documented
- 生产环境的Instantly API密钥
- 已安装对应平台的CLI(vercel、fly或gcloud)
- 应用代码已准备好部署
- 环境变量已整理归档
Vercel Deployment
Vercel 部署
Environment Setup
环境配置
bash
undefinedbash
undefinedAdd Instantly secrets to Vercel
Add Instantly secrets to Vercel
vercel secrets add instantly_api_key sk_live_***
vercel secrets add instantly_webhook_secret whsec_***
vercel secrets add instantly_api_key sk_live_***
vercel secrets add instantly_webhook_secret whsec_***
Link to project
Link to project
vercel link
vercel link
Deploy preview
Deploy preview
vercel
vercel
Deploy production
Deploy production
vercel --prod
undefinedvercel --prod
undefinedvercel.json Configuration
vercel.json 配置
json
{
"env": {
"INSTANTLY_API_KEY": "@instantly_api_key"
},
"functions": {
"api/**/*.ts": {
"maxDuration": 30
}
}
}json
{
"env": {
"INSTANTLY_API_KEY": "@instantly_api_key"
},
"functions": {
"api/**/*.ts": {
"maxDuration": 30
}
}
}Fly.io Deployment
Fly.io 部署
fly.toml
fly.toml
toml
app = "my-instantly-app"
primary_region = "iad"
[env]
NODE_ENV = "production"
[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = true
auto_start_machines = truetoml
app = "my-instantly-app"
primary_region = "iad"
[env]
NODE_ENV = "production"
[http_service]
internal_port = 3000
force_https = true
auto_stop_machines = true
auto_start_machines = trueSecrets
密钥配置
bash
undefinedbash
undefinedSet Instantly secrets
Set Instantly secrets
fly secrets set INSTANTLY_API_KEY=sk_live_***
fly secrets set INSTANTLY_WEBHOOK_SECRET=whsec_***
fly secrets set INSTANTLY_API_KEY=sk_live_***
fly secrets set INSTANTLY_WEBHOOK_SECRET=whsec_***
Deploy
Deploy
fly deploy
undefinedfly deploy
undefinedGoogle Cloud Run
Google Cloud Run 部署
Dockerfile
Dockerfile
dockerfile
FROM node:20-slim
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
CMD ["npm", "start"]dockerfile
FROM node:20-slim
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
CMD ["npm", "start"]Deploy Script
部署脚本
bash
#!/bin/bashbash
#!/bin/bashdeploy-cloud-run.sh
deploy-cloud-run.sh
PROJECT_ID="${GOOGLE_CLOUD_PROJECT}"
SERVICE_NAME="instantly-service"
REGION="us-central1"
PROJECT_ID="${GOOGLE_CLOUD_PROJECT}"
SERVICE_NAME="instantly-service"
REGION="us-central1"
Build and push image
Build and push image
gcloud builds submit --tag gcr.io/$PROJECT_ID/$SERVICE_NAME
gcloud builds submit --tag gcr.io/$PROJECT_ID/$SERVICE_NAME
Deploy to Cloud Run
Deploy to Cloud Run
gcloud run deploy $SERVICE_NAME
--image gcr.io/$PROJECT_ID/$SERVICE_NAME
--region $REGION
--platform managed
--allow-unauthenticated
--set-secrets=INSTANTLY_API_KEY=instantly-api-key:latest
--image gcr.io/$PROJECT_ID/$SERVICE_NAME
--region $REGION
--platform managed
--allow-unauthenticated
--set-secrets=INSTANTLY_API_KEY=instantly-api-key:latest
undefinedgcloud run deploy $SERVICE_NAME
--image gcr.io/$PROJECT_ID/$SERVICE_NAME
--region $REGION
--platform managed
--allow-unauthenticated
--set-secrets=INSTANTLY_API_KEY=instantly-api-key:latest
--image gcr.io/$PROJECT_ID/$SERVICE_NAME
--region $REGION
--platform managed
--allow-unauthenticated
--set-secrets=INSTANTLY_API_KEY=instantly-api-key:latest
undefinedEnvironment Configuration Pattern
环境配置模式
typescript
// config/instantly.ts
interface InstantlyConfig {
apiKey: string;
environment: 'development' | 'staging' | 'production';
webhookSecret?: string;
}
export function getInstantlyConfig(): InstantlyConfig {
const env = process.env.NODE_ENV || 'development';
return {
apiKey: process.env.INSTANTLY_API_KEY!,
environment: env as InstantlyConfig['environment'],
webhookSecret: process.env.INSTANTLY_WEBHOOK_SECRET,
};
}typescript
// config/instantly.ts
interface InstantlyConfig {
apiKey: string;
environment: 'development' | 'staging' | 'production';
webhookSecret?: string;
}
export function getInstantlyConfig(): InstantlyConfig {
const env = process.env.NODE_ENV || 'development';
return {
apiKey: process.env.INSTANTLY_API_KEY!,
environment: env as InstantlyConfig['environment'],
webhookSecret: process.env.INSTANTLY_WEBHOOK_SECRET,
};
}Health Check Endpoint
健康检查端点
typescript
// api/health.ts
export async function GET() {
const instantlyStatus = await checkInstantlyConnection();
return Response.json({
status: instantlyStatus ? 'healthy' : 'degraded',
services: {
instantly: instantlyStatus,
},
timestamp: new Date().toISOString(),
});
}typescript
// api/health.ts
export async function GET() {
const instantlyStatus = await checkInstantlyConnection();
return Response.json({
status: instantlyStatus ? 'healthy' : 'degraded',
services: {
instantly: instantlyStatus,
},
timestamp: new Date().toISOString(),
});
}Instructions
操作步骤
Step 1: Choose Deployment Platform
步骤1:选择部署平台
Select the platform that best fits your infrastructure needs and follow the platform-specific guide below.
根据你的基础设施需求选择合适的平台,然后遵循下方对应平台的指南操作。
Step 2: Configure Secrets
步骤2:配置密钥
Store Instantly API keys securely using the platform's secrets management.
使用平台的密钥管理工具安全存储Instantly API密钥。
Step 3: Deploy Application
步骤3:部署应用
Use the platform CLI to deploy your application with Instantly integration.
使用平台的CLI工具部署集成了Instantly的应用。
Step 4: Verify Health
步骤4:验证健康状态
Test the health check endpoint to confirm Instantly connectivity.
测试健康检查端点,确认与Instantly的连接正常。
Output
输出结果
- Application deployed to production
- Instantly secrets securely configured
- Health check endpoint functional
- Environment-specific configuration in place
- 应用已部署至生产环境
- Instantly密钥已安全配置
- 健康检查端点可正常使用
- 已配置好环境专属的配置项
Error Handling
错误处理
| Issue | Cause | Solution |
|---|---|---|
| Secret not found | Missing configuration | Add secret via platform CLI |
| Deploy timeout | Large build | Increase build timeout |
| Health check fails | Wrong API key | Verify environment variable |
| Cold start issues | No warm-up | Configure minimum instances |
| 问题 | 原因 | 解决方案 |
|---|---|---|
| 密钥未找到 | 缺少配置 | 通过平台CLI添加密钥 |
| 部署超时 | 构建包过大 | 延长构建超时时间 |
| 健康检查失败 | API密钥错误 | 验证环境变量 |
| 冷启动问题 | 未配置预热 | 配置最小实例数 |
Examples
示例
Quick Deploy Script
快速部署脚本
bash
#!/bin/bashbash
#!/bin/bashPlatform-agnostic deploy helper
Platform-agnostic deploy helper
case "$1" in
vercel)
vercel secrets add instantly_api_key "$INSTANTLY_API_KEY"
vercel --prod
;;
fly)
fly secrets set INSTANTLY_API_KEY="$INSTANTLY_API_KEY"
fly deploy
;;
esac
undefinedcase "$1" in
vercel)
vercel secrets add instantly_api_key "$INSTANTLY_API_KEY"
vercel --prod
;;
fly)
fly secrets set INSTANTLY_API_KEY="$INSTANTLY_API_KEY"
fly deploy
;;
esac
undefinedResources
参考资源
Next Steps
下一步
For webhook handling, see .
instantly-webhooks-events如需了解Webhook处理,请查看。
instantly-webhooks-events