kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
feat: deploy gateway to CF workers
rodzic
48c480eb00
commit
65a16d8453
|
@ -5,6 +5,7 @@ import * as Sentry from '@sentry/node'
|
||||||
Sentry.init({
|
Sentry.init({
|
||||||
dsn: process.env.SENTRY_DSN, // eslint-disable-line no-process-env
|
dsn: process.env.SENTRY_DSN, // eslint-disable-line no-process-env
|
||||||
environment: process.env.ENVIRONMENT || 'development', // eslint-disable-line no-process-env
|
environment: process.env.ENVIRONMENT || 'development', // eslint-disable-line no-process-env
|
||||||
|
integrations: [Sentry.extraErrorDataIntegration()],
|
||||||
tracesSampleRate: 1.0,
|
tracesSampleRate: 1.0,
|
||||||
integrations: [Sentry.extraErrorDataIntegration()]
|
sendDefaultPii: true
|
||||||
})
|
})
|
||||||
|
|
|
@ -14,13 +14,13 @@
|
||||||
"source": "./src/worker.ts",
|
"source": "./src/worker.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "wrangler dev",
|
"dev": "wrangler dev",
|
||||||
"deploy": "wrangler deploy --var SENTRY_RELEASE:$(sentry-cli releases propose-version)",
|
"deploy": "wrangler deploy --env production --outdir dist --upload-source-maps --var SENTRY_RELEASE:$(sentry-cli releases propose-version)",
|
||||||
"cf-clear-cache": "del .wrangler",
|
"cf-clear-cache": "del .wrangler",
|
||||||
"clean": "del dist",
|
"clean": "del dist",
|
||||||
"test": "run-s test:*",
|
"test": "run-s test:*",
|
||||||
"test:typecheck": "tsc --noEmit",
|
"test:typecheck": "tsc --noEmit",
|
||||||
"test:unit": "vitest run",
|
"test:unit": "vitest run",
|
||||||
"sentry:sourcemaps": "_SENTRY_RELEASE=$(sentry-cli releases propose-version) && sentry-cli releases new $_SENTRY_RELEASE --org=agentic-platform --project=node && sentry-cli sourcemaps upload --org=agentic-platform --project=node --release=$_SENTRY_RELEASE --strip-prefix 'dist/..' dist",
|
"sentry:sourcemaps": "_SENTRY_RELEASE=$(sentry-cli releases propose-version) && sentry-cli releases new $_SENTRY_RELEASE --org=agentic-platform --project=gateway && sentry-cli sourcemaps upload --org=agentic-platform --project=gateway --release=$_SENTRY_RELEASE --strip-prefix 'dist/..' dist",
|
||||||
"postdeploy": "pnpm sentry:sourcemaps"
|
"postdeploy": "pnpm sentry:sourcemaps"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -13,7 +13,9 @@ export default Sentry.withSentry(
|
||||||
(env: RawEnv) => ({
|
(env: RawEnv) => ({
|
||||||
dsn: env.SENTRY_DSN,
|
dsn: env.SENTRY_DSN,
|
||||||
environment: env.ENVIRONMENT,
|
environment: env.ENVIRONMENT,
|
||||||
integrations: [Sentry.extraErrorDataIntegration()]
|
integrations: [Sentry.extraErrorDataIntegration()],
|
||||||
|
tracesSampleRate: 1.0,
|
||||||
|
sendDefaultPii: true
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
async fetch(
|
async fetch(
|
||||||
|
|
|
@ -13,12 +13,6 @@
|
||||||
"enabled": true,
|
"enabled": true,
|
||||||
"head_sampling_rate": 1
|
"head_sampling_rate": 1
|
||||||
},
|
},
|
||||||
"routes": [
|
|
||||||
{
|
|
||||||
"pattern": "gateway.agentic.so",
|
|
||||||
"custom_domain": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"migrations": [
|
"migrations": [
|
||||||
{
|
{
|
||||||
"tag": "v1",
|
"tag": "v1",
|
||||||
|
@ -29,26 +23,73 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"durable_objects": {
|
"vars": {
|
||||||
"bindings": [
|
"ENVIRONMENT": "production",
|
||||||
{
|
"AGENTIC_API_BASE_URL": "https://api.agentic.so"
|
||||||
"class_name": "DurableRateLimiter",
|
|
||||||
"name": "DO_RATE_LIMITER"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"class_name": "DurableMcpServer",
|
|
||||||
"name": "DO_MCP_SERVER"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"class_name": "DurableMcpClient",
|
|
||||||
"name": "DO_MCP_CLIENT"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
"analytics_engine_datasets": [
|
"env": {
|
||||||
{
|
"development": {
|
||||||
"binding": "AE_USAGE_DATASET",
|
"vars": {
|
||||||
"dataset": "agentic_gateway_usage"
|
"ENVIRONMENT": "development",
|
||||||
|
"AGENTIC_API_BASE_URL": "http://localhost:3001"
|
||||||
|
},
|
||||||
|
// TODO: double-check whether all of this needs to be duplicated for each environment
|
||||||
|
"durable_objects": {
|
||||||
|
"bindings": [
|
||||||
|
{
|
||||||
|
"class_name": "DurableRateLimiter",
|
||||||
|
"name": "DO_RATE_LIMITER"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"class_name": "DurableMcpServer",
|
||||||
|
"name": "DO_MCP_SERVER"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"class_name": "DurableMcpClient",
|
||||||
|
"name": "DO_MCP_CLIENT"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"analytics_engine_datasets": [
|
||||||
|
{
|
||||||
|
"binding": "AE_USAGE_DATASET",
|
||||||
|
"dataset": "agentic_gateway_usage"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"production": {
|
||||||
|
"routes": [
|
||||||
|
{
|
||||||
|
"pattern": "gateway.agentic.so",
|
||||||
|
"custom_domain": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"vars": {
|
||||||
|
"ENVIRONMENT": "production",
|
||||||
|
"AGENTIC_API_BASE_URL": "https://api.agentic.so"
|
||||||
|
},
|
||||||
|
"durable_objects": {
|
||||||
|
"bindings": [
|
||||||
|
{
|
||||||
|
"class_name": "DurableRateLimiter",
|
||||||
|
"name": "DO_RATE_LIMITER"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"class_name": "DurableMcpServer",
|
||||||
|
"name": "DO_MCP_SERVER"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"class_name": "DurableMcpClient",
|
||||||
|
"name": "DO_MCP_CLIENT"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"analytics_engine_datasets": [
|
||||||
|
{
|
||||||
|
"binding": "AE_USAGE_DATASET",
|
||||||
|
"dataset": "agentic_gateway_usage"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
}
|
}
|
||||||
|
|
Ładowanie…
Reference in New Issue