e97704d904
* bump worker version * Suggested glossary for the RunEngine, TBC * Removed BatchTaskRun changes from this branch, they were done in main * Set the BatchTaskRun status to completed when all runs are completed * When dequeuing respect passed in maxResources * Ported over the new run props: idempotencyKeyExpiresAt, versions, oneTimeUseToken, maxDurationInSeconds * Didn’t hit save… the new props when triggering tasks passed through * Idempotency expiration + waitpoint edge case * WIP on creating checkpoint, parking for now * fix worker routes * upgrade webapp node types to support generic event emitter * separate event bus handler singleton and run failure alerts * duration waits * fix execution snapshot debug spans * task waits * fix event bus types * temporary fix for react hook run handle type * disable run notifications for now * convert any typecasts to expect errors to more easily fix later * fix webapp types after node types upgrade * updateEnvConcurrencyLimits across marqs and the runqueue * Pass proper values into the run engine * RunQueue settings and removed unused rebalancing workers * Remove rebalancing prop * Tidied more things up * Update/remove queue limits for MARQS and RunQueue * taskQueue/concurrencyLimit changes ported back into the RunEngine * Reworked completing waitpoints to improve performance and reduce race conditions * Improved test robustness * Down to a single run lock only when a run is totally unblocked and ready to continue * warm starts, worker notifications, wait fixes * Fix for Run Engine poll interval env var * Expect the waitpoint to be completed quickly * If a run is locked then it’s too late to expire it * Added VALKEY_ env vars and plugged them into the run engine * Extracted and updated the guard queue function so it can be used when batching * Added logging and universal concurrency changes to trigger task v1 * Added notes back in * Bump @trigger.dev/worker to 3.3.7 * reportInvocationUsage for the runAttemptStarted event * improve execution snapshot span debug span start times * Unfriendly IDs * update lockfile * Created a shared determineEngineVersion function * disable unfinished commands * save new cli config to different location, misc fixes * add basic engine version check via current deploy * new run engine will default to node 22 runtime * block some actions for projects on previous run engine * fix worker group tests * fix triggerAndWait test * one typescript version to rule them all * redlock type patch * fix type issues caused by ts-reset * improve cleanup scripts * add missing socket.io dep * fix run notification handler type * fix worker group test again * generate prisma client for e2e tests * remove worker group tests for now * prevent image pull rate limits during unit tests * increase timeout for queue concurrency limit test * generate prisma client for preview release * same node types everywhere * Updated engine readme, removed legacy system notes * use default machine preset from platform package * worker instances plural in schema * disable pnpm update notifications * return worker group details from connect call * add workers admin route * fix heartbeat route return type * move deployment labels to core apps * refactor run controller env schema * Add firstAttemptStartedAt to TaskRun * RunEngine 2.0 batch trigger support (#1581) * Make it clear when BatchTriggerV2Service is used * Copy of BatchTriggerV2Service * WIP batch triggering * Allow blocking a run with multiple waitpoints at once. Made it atomic * Removed unused param * New batch service * Pass through the parentRunId and resumeParentOnCompletion * Use the new batch service, and correct trigger task version * Force V1 engine if using BatchTriggerV2Service, we’ve already done the check at this point * Removed the $transaction and early exit if nothing changed * Adedd a simple batch task to the hello world reference catalog * Fix for batch waits not working * Added parentRunId in a couple more places * Removed waitForBatch log * Added another parentRunId * Expanded the example to include all the different triggers * More changes to blocking to support continuing after idempotent completed runs * Fix for the wrong type when blocking a run * remove @map * optimise worker auth query * add engine version header to core api client requests * remove unique constraint for default group id * consolidate migrations * the first managed worker becomes the global default * Debug events off by default, added an admin toggle to show them * worker group name can't be an empty string * add exec helper to core * move machine resources to core * add pre-dequeue callback to determine max resources * optionally skip dequeue * bump worker package * move worker to core * fix ReadableStream type error * fix another type issue * update a few more tsconfigs * add metadata changes introduced in #1563 * Run Engine 2.0 trigger idempotency (#1613) * Return isCached from the trigger API endpoint * Fix for the wrong type when blocking a run * Render the idempotent run in the inspector * Event repository for idempotency * Debug events off by default, added an admin toggle to show them * triggerAndWait idempotency span * Some improvements to the reference idempotency task * Removed the cached tracing from the SDK * Server-side creating cached span * Improved idempotency test task * Create cached task spans in a better way * Idempotency span support inc batch trigger * Simplified how the spans are done, using more of the existing code * Improved the idempotency test task * Added Waitpoint Batch type, add to TaskRunWaitpoint with order * Pass batch ids through to the run engine when triggering * Added batchIndex * Better batch support in the run engine * Added settings to batch trigger service, before major overhaul * Allow the longer run/batch ids in the filters * Changed how batching works, includes breaking changes in CLI * Removed batch idempotency because it gets put on the runs instead * Added `runs` to the batch.retrieve call/API * Set firstAttemptStartedAt when creating the first attempt * Do nothing when receiving a BATCH waitpoint * Some fixes in the new batch trigger service… mostly just passing missing optional params through * Tweaked the idempotency test task for more situations * Only block with a batch if it’s a batchTriggerAndWait… 🤦♂️ * Added another case to the idempotency test task: multiple of the same idempotencyKey in a single batch * Support for the same run multiple times in the same batch * Small tweaks * Make sure to complete batches, even if they’re not andWait ones * Export RunDuplicateIdempotencyKeyError from the run engine * Latest lockfile * Trigger with a machine (old run engine) * RE2, allow setting machine when triggering * Fix for new glob patterns * add max run count to dequeue from version route * add worker instance name env var and header * queue consumer pre skip callback * poll for more runs after final execution errors * fix dequeue search param schema * add shortcut to debug switch * expose run engine timeouts as env vars * make warm start durations configurable * add optional status to json reply helper * fix preSkip hook, add debug logs * BLOCKED_BY_WAITPOINTS -> SUSPENDED * exit controller when run suspended * check if already replied before http reply * run controller will wait for next run after the current one is suspended * cancel run button shortcut * minimal event repository environment type * fix update metadata call * run suspension and misc fixes wip * change debug shortcut to shift + D * Started work on the Dev supervisor * Formatting * Fix for bad imports * Before rebuilding SSE * Presence updating from the CLI working via SSE * add worker notification debug logs * send run:stop when exiting run phase * skip current snapshot poll on worker notification * add more logs and route to submit run debug logs * add worker and runner ids to snapshots * improve run notification debug logs * add workload debug log route * misc run controller fixes and refactor * prevent parallel execution of critical functions * update bun to 1.2.1 * WIP with dev dequeuing * Method to convert friendlyIds to non-friendly, do nothing with actual ids * Set the engine on BackgroundWorker, lazily upgrade projects to engine V2 * Runs with ttls were getting immediately expired… oops. * Pass the Waiting for deploy reason through, so we have it on the execution snapshots * Fixed the logic for getting the right background worker for a run * Use the correct ID when dequeuing… * determineEngineVersion is now fully functional * Rate limiter ignores the dev endpoints * Retrieving a batch gives you the runIds * Set a unique version for the RE2 BatchTaskRun * add provisional changeset * The start of dev run execution is working * First dev run working * Moved the dev run controller closer to what Nick did with the managed one * export exec output type * Heartbeat fix: don’t heartbeat if _isHeartbeating == false * Dev runs get notifications, some dev bug fixes * Improved logging or dequeuing * We need to dequeue runs from the latest version too, for triggerAndWait * Ported Eric’s validateWorkerManifest with nicer errors * When flattening an idempotency key if part is undefined, return undefined * Dev logging fixes * Remove sigterm listener * Deprecating workers. Don’t specify a BackgroundWorker when dequeuing an environment * Deleted some old files. Renamed “managed” to “deploy” * When a build finishes, always copy the build dir (otherwise the first one gets trampled on by the 2nd) * Dev master queues should work differently * Deleting old workers * Added debounce function to core * Improvement to canceling * WIP on debounce canceling on socket disconnection * Added environment data to execution snapshots * Dev runs that have stalled get “Canceled” with a reason explaining why * Show CLI messaged when a connection to the platform is lost/restored * Fix TriggerTask after merge * Add trigger task v2 max attempts, replace some findUniques * Port the new queue logic to the run engine * More fixes post-merge * We weren’t setting a `retryConfig` up for the tests… it’s now required * Start the Redis worker inside the Run Engine… 🤦♂️ * Trying to make the testcontainers more reliable * Added keyPrefix: "engine:” * Badly placed bracket in trigger task * Better Redis namespacing * Fix for expired run not getting removed from the queue * Don’t create a redis client in the testcontainers, return the redisOptions instead * Cleanup redis client in the run lock tests * Fix for the RunQueue not supporting keyPrefix * Updated more of the RunQueue scripts rebalancing * Trying to make Redis more robust in the tests… * Improved test resiliciency more * Fix for delays (checkpoint check) * Increase the timeout slightly to fix ttl test * Added priority support when triggering * More wip trying to make test containers more reliable * batchTriggerAndWait test is still failing… some wip to try fix it * Fixed redis tests now we’re not providing a client * Separate Redis clients for the run engine worker/queue/runlock * Made the wait for duration test more resilient * Added idempotencyKeyExpiresAt to Waitpoints * Waitpoint timeouts and idempotency expiry * Use finishWaitpoint, removed extra worker job * Added waitpoint idempotency tests * Creating resume tokens is working * Some improvements to the resume tokens * Moved resumeTokens to just be wait functions 🥳 * Delete old RuntimeManagers * Wait for token is working * Better test for the wait tokens * Improved the test task some more * Hide the accessories in the span inspector * WIP on waitpoint inspector * WIP on complete waitpoint form * Span overview panel can be changed based on the entity type * Improved the waitpoint display * WIP on completing waitpoint form * Use the existing CodeBlock for the tip * Style improvements * Complete waitpoint * All waitpoint sidebar variants * Waits now use a pause icon * Durations waits use the API to create/block with a waitpoint, not the runtime * Fix for engine.blockRunWithWaitpoint required org id * Removed old wait code from the run controllers/task run process * Form action for skipping a datetime waitpoint * Move testDockerCheckpoint to a separate core package export (it can’t be bundled on the client) * Fix for glitchy hourglass animation * Completed waitpoints display better * Increase Redis maxRetriesPerRequest to 20 (default) * Completing and skipping waitpoints is working * Remove the database prisma dev command, since we need to use create only now. Updated docs * Added skip timeout, reworked the UI * Tweaked spacing * Added payload limit to waitpoint token completion from dashboard * Test idempotency works on wait.for and wait.until * Moved the worker-actions to /engine/ from /api/ * Moved dev engine endpoints to /engine/ from /api/ * Separate /engine/ rate limiter * Added parallel wait prevention, it’s working for duration waits but not well for triggerAndWait yet * WIP post-merge conflicts * Set taskEventStore column in the new engine * Remove duplicate keys * Post-merge fixes * Fix for span merge layout * Use executedAt instead of firstAttemptStartedAt --------- Co-authored-by: Matt Aitken <matt@mattaitken.com>
659 lines
27 KiB
TypeScript
659 lines
27 KiB
TypeScript
import { SecretStoreOptionsSchema } from "./services/secrets/secretStoreOptionsSchema.server";
|
|
import { z } from "zod";
|
|
import { isValidRegex } from "./utils/regex";
|
|
import { isValidDatabaseUrl } from "./utils/db";
|
|
|
|
const EnvironmentSchema = z.object({
|
|
NODE_ENV: z.union([z.literal("development"), z.literal("production"), z.literal("test")]),
|
|
DATABASE_URL: z
|
|
.string()
|
|
.refine(
|
|
isValidDatabaseUrl,
|
|
"DATABASE_URL is invalid, for details please check the additional output above this message."
|
|
),
|
|
DATABASE_CONNECTION_LIMIT: z.coerce.number().int().default(10),
|
|
DATABASE_POOL_TIMEOUT: z.coerce.number().int().default(60),
|
|
DATABASE_CONNECTION_TIMEOUT: z.coerce.number().int().default(20),
|
|
DIRECT_URL: z
|
|
.string()
|
|
.refine(
|
|
isValidDatabaseUrl,
|
|
"DIRECT_URL is invalid, for details please check the additional output above this message."
|
|
),
|
|
DATABASE_READ_REPLICA_URL: z.string().optional(),
|
|
SESSION_SECRET: z.string(),
|
|
MAGIC_LINK_SECRET: z.string(),
|
|
ENCRYPTION_KEY: z.string(),
|
|
WHITELISTED_EMAILS: z
|
|
.string()
|
|
.refine(isValidRegex, "WHITELISTED_EMAILS must be a valid regex.")
|
|
.optional(),
|
|
ADMIN_EMAILS: z.string().refine(isValidRegex, "ADMIN_EMAILS must be a valid regex.").optional(),
|
|
REMIX_APP_PORT: z.string().optional(),
|
|
LOGIN_ORIGIN: z.string().default("http://localhost:3030"),
|
|
APP_ORIGIN: z.string().default("http://localhost:3030"),
|
|
API_ORIGIN: z.string().optional(),
|
|
STREAM_ORIGIN: z.string().optional(),
|
|
ELECTRIC_ORIGIN: z.string().default("http://localhost:3060"),
|
|
APP_ENV: z.string().default(process.env.NODE_ENV),
|
|
SERVICE_NAME: z.string().default("trigger.dev webapp"),
|
|
SECRET_STORE: SecretStoreOptionsSchema.default("DATABASE"),
|
|
POSTHOG_PROJECT_KEY: z.string().default("phc_LFH7kJiGhdIlnO22hTAKgHpaKhpM8gkzWAFvHmf5vfS"),
|
|
TELEMETRY_TRIGGER_API_KEY: z.string().optional(),
|
|
TELEMETRY_TRIGGER_API_URL: z.string().optional(),
|
|
TRIGGER_TELEMETRY_DISABLED: z.string().optional(),
|
|
HIGHLIGHT_PROJECT_ID: z.string().optional(),
|
|
AUTH_GITHUB_CLIENT_ID: z.string().optional(),
|
|
AUTH_GITHUB_CLIENT_SECRET: z.string().optional(),
|
|
EMAIL_TRANSPORT: z.enum(["resend", "smtp", "aws-ses"]).optional(),
|
|
FROM_EMAIL: z.string().optional(),
|
|
REPLY_TO_EMAIL: z.string().optional(),
|
|
RESEND_API_KEY: z.string().optional(),
|
|
SMTP_HOST: z.string().optional(),
|
|
SMTP_PORT: z.coerce.number().optional(),
|
|
SMTP_SECURE: z.coerce.boolean().optional(),
|
|
SMTP_USER: z.string().optional(),
|
|
SMTP_PASSWORD: z.string().optional(),
|
|
|
|
PLAIN_API_KEY: z.string().optional(),
|
|
RUNTIME_PLATFORM: z.enum(["docker-compose", "ecs", "local"]).default("local"),
|
|
WORKER_SCHEMA: z.string().default("graphile_worker"),
|
|
WORKER_CONCURRENCY: z.coerce.number().int().default(10),
|
|
WORKER_POLL_INTERVAL: z.coerce.number().int().default(1000),
|
|
/** The number of days a failed Graphile task should stay before getting cleaned up */
|
|
WORKER_CLEANUP_TTL_DAYS: z.coerce.number().int().default(3),
|
|
EXECUTION_WORKER_CONCURRENCY: z.coerce.number().int().default(10),
|
|
EXECUTION_WORKER_POLL_INTERVAL: z.coerce.number().int().default(1000),
|
|
WORKER_ENABLED: z.string().default("true"),
|
|
EXECUTION_WORKER_ENABLED: z.string().default("true"),
|
|
TASK_OPERATION_WORKER_ENABLED: z.string().default("true"),
|
|
TASK_OPERATION_WORKER_CONCURRENCY: z.coerce.number().int().default(10),
|
|
TASK_OPERATION_WORKER_POLL_INTERVAL: z.coerce.number().int().default(1000),
|
|
GRACEFUL_SHUTDOWN_TIMEOUT: z.coerce.number().int().default(60000),
|
|
/** Optional. Only used if you use the apps/proxy */
|
|
AWS_SQS_REGION: z.string().optional(),
|
|
/** Optional. Only used if you use the apps/proxy */
|
|
AWS_SQS_ACCESS_KEY_ID: z.string().optional(),
|
|
/** Optional. Only used if you use the apps/proxy */
|
|
AWS_SQS_SECRET_ACCESS_KEY: z.string().optional(),
|
|
/** Optional. Only used if you use the apps/proxy */
|
|
AWS_SQS_QUEUE_URL: z.string().optional(),
|
|
AWS_SQS_BATCH_SIZE: z.coerce.number().int().optional().default(1),
|
|
AWS_SQS_WAIT_TIME_MS: z.coerce.number().int().optional().default(100),
|
|
DISABLE_SSE: z.string().optional(),
|
|
OPENAI_API_KEY: z.string().optional(),
|
|
|
|
// Redis options
|
|
REDIS_HOST: z.string().optional(),
|
|
REDIS_READER_HOST: z.string().optional(),
|
|
REDIS_READER_PORT: z.coerce.number().optional(),
|
|
REDIS_PORT: z.coerce.number().optional(),
|
|
REDIS_USERNAME: z.string().optional(),
|
|
REDIS_PASSWORD: z.string().optional(),
|
|
REDIS_TLS_DISABLED: z.string().optional(),
|
|
|
|
RATE_LIMIT_REDIS_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_HOST),
|
|
RATE_LIMIT_REDIS_READER_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_READER_HOST),
|
|
RATE_LIMIT_REDIS_READER_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform(
|
|
(v) =>
|
|
v ?? (process.env.REDIS_READER_PORT ? parseInt(process.env.REDIS_READER_PORT) : undefined)
|
|
),
|
|
RATE_LIMIT_REDIS_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform((v) => v ?? (process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT) : undefined)),
|
|
RATE_LIMIT_REDIS_USERNAME: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_USERNAME),
|
|
RATE_LIMIT_REDIS_PASSWORD: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_PASSWORD),
|
|
RATE_LIMIT_REDIS_TLS_DISABLED: z.string().default(process.env.REDIS_TLS_DISABLED ?? "false"),
|
|
RATE_LIMIT_REDIS_CLUSTER_MODE_ENABLED: z.string().default("0"),
|
|
|
|
CACHE_REDIS_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_HOST),
|
|
CACHE_REDIS_READER_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_READER_HOST),
|
|
CACHE_REDIS_READER_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform(
|
|
(v) =>
|
|
v ?? (process.env.REDIS_READER_PORT ? parseInt(process.env.REDIS_READER_PORT) : undefined)
|
|
),
|
|
CACHE_REDIS_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform((v) => v ?? (process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT) : undefined)),
|
|
CACHE_REDIS_USERNAME: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_USERNAME),
|
|
CACHE_REDIS_PASSWORD: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_PASSWORD),
|
|
CACHE_REDIS_TLS_DISABLED: z.string().default(process.env.REDIS_TLS_DISABLED ?? "false"),
|
|
CACHE_REDIS_CLUSTER_MODE_ENABLED: z.string().default("0"),
|
|
|
|
PUBSUB_REDIS_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_HOST),
|
|
PUBSUB_REDIS_READER_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_READER_HOST),
|
|
PUBSUB_REDIS_READER_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform(
|
|
(v) =>
|
|
v ?? (process.env.REDIS_READER_PORT ? parseInt(process.env.REDIS_READER_PORT) : undefined)
|
|
),
|
|
PUBSUB_REDIS_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform((v) => v ?? (process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT) : undefined)),
|
|
PUBSUB_REDIS_USERNAME: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_USERNAME),
|
|
PUBSUB_REDIS_PASSWORD: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_PASSWORD),
|
|
PUBSUB_REDIS_TLS_DISABLED: z.string().default(process.env.REDIS_TLS_DISABLED ?? "false"),
|
|
PUBSUB_REDIS_CLUSTER_MODE_ENABLED: z.string().default("0"),
|
|
|
|
DEFAULT_ENV_EXECUTION_CONCURRENCY_LIMIT: z.coerce.number().int().default(10),
|
|
DEFAULT_ORG_EXECUTION_CONCURRENCY_LIMIT: z.coerce.number().int().default(10),
|
|
DEFAULT_DEV_ENV_EXECUTION_ATTEMPTS: z.coerce.number().int().positive().default(1),
|
|
|
|
TUNNEL_HOST: z.string().optional(),
|
|
TUNNEL_SECRET_KEY: z.string().optional(),
|
|
|
|
//API Rate limiting
|
|
/**
|
|
* @example "60s"
|
|
* @example "1m"
|
|
* @example "1h"
|
|
* @example "1d"
|
|
* @example "1000ms"
|
|
* @example "1000s"
|
|
*/
|
|
API_RATE_LIMIT_REFILL_INTERVAL: z.string().default("10s"), // refill 250 tokens every 10 seconds
|
|
API_RATE_LIMIT_MAX: z.coerce.number().int().default(750), // allow bursts of 750 requests
|
|
API_RATE_LIMIT_REFILL_RATE: z.coerce.number().int().default(250), // refix 250 tokens every 10 seconds
|
|
API_RATE_LIMIT_REQUEST_LOGS_ENABLED: z.string().default("0"),
|
|
API_RATE_LIMIT_REJECTION_LOGS_ENABLED: z.string().default("1"),
|
|
API_RATE_LIMIT_LIMITER_LOGS_ENABLED: z.string().default("0"),
|
|
|
|
API_RATE_LIMIT_JWT_WINDOW: z.string().default("1m"),
|
|
API_RATE_LIMIT_JWT_TOKENS: z.coerce.number().int().default(60),
|
|
|
|
//Realtime rate limiting
|
|
/**
|
|
* @example "60s"
|
|
* @example "1m"
|
|
* @example "1h"
|
|
* @example "1d"
|
|
* @example "1000ms"
|
|
* @example "1000s"
|
|
*/
|
|
REALTIME_RATE_LIMIT_WINDOW: z.string().default("1m"),
|
|
REALTIME_RATE_LIMIT_TOKENS: z.coerce.number().int().default(100),
|
|
REALTIME_RATE_LIMIT_REQUEST_LOGS_ENABLED: z.string().default("0"),
|
|
REALTIME_RATE_LIMIT_REJECTION_LOGS_ENABLED: z.string().default("1"),
|
|
REALTIME_RATE_LIMIT_LIMITER_LOGS_ENABLED: z.string().default("0"),
|
|
|
|
//Ingesting event rate limit
|
|
INGEST_EVENT_RATE_LIMIT_WINDOW: z.string().default("60s"),
|
|
INGEST_EVENT_RATE_LIMIT_MAX: z.coerce.number().int().optional(),
|
|
|
|
//v3
|
|
V3_ENABLED: z.string().default("false"),
|
|
PROVIDER_SECRET: z.string().default("provider-secret"),
|
|
COORDINATOR_SECRET: z.string().default("coordinator-secret"),
|
|
DEPOT_TOKEN: z.string().optional(),
|
|
DEPOT_PROJECT_ID: z.string().optional(),
|
|
DEPOT_ORG_ID: z.string().optional(),
|
|
DEPOT_REGION: z.string().default("us-east-1"),
|
|
CONTAINER_REGISTRY_ORIGIN: z.string().optional(),
|
|
CONTAINER_REGISTRY_USERNAME: z.string().optional(),
|
|
CONTAINER_REGISTRY_PASSWORD: z.string().optional(),
|
|
ENABLE_REGISTRY_PROXY: z.string().optional(),
|
|
DEPLOY_REGISTRY_HOST: z.string().optional(),
|
|
DEPLOY_REGISTRY_USERNAME: z.string().optional(),
|
|
DEPLOY_REGISTRY_PASSWORD: z.string().optional(),
|
|
DEPLOY_REGISTRY_NAMESPACE: z.string().default("trigger"),
|
|
DEPLOY_TIMEOUT_MS: z.coerce
|
|
.number()
|
|
.int()
|
|
.default(60 * 1000 * 8), // 8 minutes
|
|
OBJECT_STORE_BASE_URL: z.string().optional(),
|
|
OBJECT_STORE_ACCESS_KEY_ID: z.string().optional(),
|
|
OBJECT_STORE_SECRET_ACCESS_KEY: z.string().optional(),
|
|
EVENTS_BATCH_SIZE: z.coerce.number().int().default(100),
|
|
EVENTS_BATCH_INTERVAL: z.coerce.number().int().default(1000),
|
|
EVENTS_DEFAULT_LOG_RETENTION: z.coerce.number().int().default(7),
|
|
SHARED_QUEUE_CONSUMER_POOL_SIZE: z.coerce.number().int().default(10),
|
|
SHARED_QUEUE_CONSUMER_INTERVAL_MS: z.coerce.number().int().default(100),
|
|
SHARED_QUEUE_CONSUMER_NEXT_TICK_INTERVAL_MS: z.coerce.number().int().default(100),
|
|
SHARED_QUEUE_CONSUMER_EMIT_RESUME_DEPENDENCY_TIMEOUT_MS: z.coerce.number().int().default(1000),
|
|
SHARED_QUEUE_CONSUMER_RESOLVE_PAYLOADS_BATCH_SIZE: z.coerce.number().int().default(25),
|
|
|
|
MANAGED_WORKER_SECRET: z.string().default("managed-secret"),
|
|
|
|
// Development OTEL environment variables
|
|
DEV_OTEL_EXPORTER_OTLP_ENDPOINT: z.string().optional(),
|
|
// If this is set to 1, then the below variables are used to configure the batch processor for spans and logs
|
|
DEV_OTEL_BATCH_PROCESSING_ENABLED: z.string().default("0"),
|
|
DEV_OTEL_SPAN_MAX_EXPORT_BATCH_SIZE: z.string().default("64"),
|
|
DEV_OTEL_SPAN_SCHEDULED_DELAY_MILLIS: z.string().default("200"),
|
|
DEV_OTEL_SPAN_EXPORT_TIMEOUT_MILLIS: z.string().default("30000"),
|
|
DEV_OTEL_SPAN_MAX_QUEUE_SIZE: z.string().default("512"),
|
|
DEV_OTEL_LOG_MAX_EXPORT_BATCH_SIZE: z.string().default("64"),
|
|
DEV_OTEL_LOG_SCHEDULED_DELAY_MILLIS: z.string().default("200"),
|
|
DEV_OTEL_LOG_EXPORT_TIMEOUT_MILLIS: z.string().default("30000"),
|
|
DEV_OTEL_LOG_MAX_QUEUE_SIZE: z.string().default("512"),
|
|
|
|
PROD_OTEL_BATCH_PROCESSING_ENABLED: z.string().default("0"),
|
|
PROD_OTEL_SPAN_MAX_EXPORT_BATCH_SIZE: z.string().default("64"),
|
|
PROD_OTEL_SPAN_SCHEDULED_DELAY_MILLIS: z.string().default("200"),
|
|
PROD_OTEL_SPAN_EXPORT_TIMEOUT_MILLIS: z.string().default("30000"),
|
|
PROD_OTEL_SPAN_MAX_QUEUE_SIZE: z.string().default("512"),
|
|
PROD_OTEL_LOG_MAX_EXPORT_BATCH_SIZE: z.string().default("64"),
|
|
PROD_OTEL_LOG_SCHEDULED_DELAY_MILLIS: z.string().default("200"),
|
|
PROD_OTEL_LOG_EXPORT_TIMEOUT_MILLIS: z.string().default("30000"),
|
|
PROD_OTEL_LOG_MAX_QUEUE_SIZE: z.string().default("512"),
|
|
|
|
CHECKPOINT_THRESHOLD_IN_MS: z.coerce.number().int().default(30000),
|
|
|
|
// Internal OTEL environment variables
|
|
INTERNAL_OTEL_TRACE_EXPORTER_URL: z.string().optional(),
|
|
INTERNAL_OTEL_TRACE_EXPORTER_AUTH_HEADERS: z.string().optional(),
|
|
INTERNAL_OTEL_TRACE_LOGGING_ENABLED: z.string().default("1"),
|
|
// this means 1/20 traces or 5% of traces will be sampled (sampled = recorded)
|
|
INTERNAL_OTEL_TRACE_SAMPLING_RATE: z.string().default("20"),
|
|
INTERNAL_OTEL_TRACE_INSTRUMENT_PRISMA_ENABLED: z.string().default("0"),
|
|
INTERNAL_OTEL_TRACE_DISABLED: z.string().default("0"),
|
|
|
|
INTERNAL_OTEL_LOG_EXPORTER_URL: z.string().optional(),
|
|
|
|
ORG_SLACK_INTEGRATION_CLIENT_ID: z.string().optional(),
|
|
ORG_SLACK_INTEGRATION_CLIENT_SECRET: z.string().optional(),
|
|
|
|
/** These enable the alerts feature in v3 */
|
|
ALERT_EMAIL_TRANSPORT: z.enum(["resend", "smtp", "aws-ses"]).optional(),
|
|
ALERT_FROM_EMAIL: z.string().optional(),
|
|
ALERT_REPLY_TO_EMAIL: z.string().optional(),
|
|
ALERT_RESEND_API_KEY: z.string().optional(),
|
|
ALERT_SMTP_HOST: z.string().optional(),
|
|
ALERT_SMTP_PORT: z.coerce.number().optional(),
|
|
ALERT_SMTP_SECURE: z.coerce.boolean().optional(),
|
|
ALERT_SMTP_USER: z.string().optional(),
|
|
ALERT_SMTP_PASSWORD: z.string().optional(),
|
|
ALERT_RATE_LIMITER_EMISSION_INTERVAL: z.coerce.number().int().default(2_500),
|
|
ALERT_RATE_LIMITER_BURST_TOLERANCE: z.coerce.number().int().default(10_000),
|
|
ALERT_RATE_LIMITER_REDIS_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_HOST),
|
|
ALERT_RATE_LIMITER_REDIS_READER_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_READER_HOST),
|
|
ALERT_RATE_LIMITER_REDIS_READER_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform(
|
|
(v) =>
|
|
v ?? (process.env.REDIS_READER_PORT ? parseInt(process.env.REDIS_READER_PORT) : undefined)
|
|
),
|
|
ALERT_RATE_LIMITER_REDIS_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform((v) => v ?? (process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT) : undefined)),
|
|
ALERT_RATE_LIMITER_REDIS_USERNAME: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_USERNAME),
|
|
ALERT_RATE_LIMITER_REDIS_PASSWORD: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_PASSWORD),
|
|
ALERT_RATE_LIMITER_REDIS_TLS_DISABLED: z
|
|
.string()
|
|
.default(process.env.REDIS_TLS_DISABLED ?? "false"),
|
|
ALERT_RATE_LIMITER_REDIS_CLUSTER_MODE_ENABLED: z.string().default("0"),
|
|
|
|
MAX_SEQUENTIAL_INDEX_FAILURE_COUNT: z.coerce.number().default(96),
|
|
|
|
LOOPS_API_KEY: z.string().optional(),
|
|
MARQS_DISABLE_REBALANCING: z.coerce.boolean().default(false),
|
|
MARQS_VISIBILITY_TIMEOUT_MS: z.coerce
|
|
.number()
|
|
.int()
|
|
.default(60 * 1000 * 15),
|
|
MARQS_SHARED_QUEUE_LIMIT: z.coerce.number().int().default(1000),
|
|
MARQS_DEV_QUEUE_LIMIT: z.coerce.number().int().default(1000),
|
|
MARQS_MAXIMUM_NACK_COUNT: z.coerce.number().int().default(64),
|
|
MARQS_CONCURRENCY_LIMIT_BIAS: z.coerce.number().default(0.75),
|
|
MARQS_AVAILABLE_CAPACITY_BIAS: z.coerce.number().default(0.3),
|
|
MARQS_QUEUE_AGE_RANDOMIZATION_BIAS: z.coerce.number().default(0.25),
|
|
MARQS_REUSE_SNAPSHOT_COUNT: z.coerce.number().int().default(0),
|
|
MARQS_MAXIMUM_ENV_COUNT: z.coerce.number().int().optional(),
|
|
|
|
PROD_TASK_HEARTBEAT_INTERVAL_MS: z.coerce.number().int().optional(),
|
|
|
|
VERBOSE_GRAPHILE_LOGGING: z.string().default("false"),
|
|
V2_MARQS_ENABLED: z.string().default("0"),
|
|
V2_MARQS_CONSUMER_POOL_ENABLED: z.string().default("0"),
|
|
V2_MARQS_CONSUMER_POOL_SIZE: z.coerce.number().int().default(10),
|
|
V2_MARQS_CONSUMER_POLL_INTERVAL_MS: z.coerce.number().int().default(1000),
|
|
V2_MARQS_QUEUE_SELECTION_COUNT: z.coerce.number().int().default(36),
|
|
V2_MARQS_VISIBILITY_TIMEOUT_MS: z.coerce
|
|
.number()
|
|
.int()
|
|
.default(60 * 1000 * 15),
|
|
V2_MARQS_DEFAULT_ENV_CONCURRENCY: z.coerce.number().int().default(100),
|
|
V2_MARQS_VERBOSE: z.string().default("0"),
|
|
V3_MARQS_CONCURRENCY_MONITOR_ENABLED: z.string().default("0"),
|
|
V2_MARQS_CONCURRENCY_MONITOR_ENABLED: z.string().default("0"),
|
|
/* Usage settings */
|
|
USAGE_EVENT_URL: z.string().optional(),
|
|
PROD_USAGE_HEARTBEAT_INTERVAL_MS: z.coerce.number().int().optional(),
|
|
|
|
CENTS_PER_VCPU_SECOND: z.coerce.number().default(0),
|
|
CENTS_PER_GB_RAM_SECOND: z.coerce.number().default(0),
|
|
CENTS_PER_RUN: z.coerce.number().default(0),
|
|
|
|
USAGE_OPEN_METER_API_KEY: z.string().optional(),
|
|
USAGE_OPEN_METER_BASE_URL: z.string().optional(),
|
|
EVENT_LOOP_MONITOR_ENABLED: z.string().default("1"),
|
|
MAXIMUM_LIVE_RELOADING_EVENTS: z.coerce.number().int().default(1000),
|
|
MAXIMUM_TRACE_SUMMARY_VIEW_COUNT: z.coerce.number().int().default(25_000),
|
|
TASK_PAYLOAD_OFFLOAD_THRESHOLD: z.coerce.number().int().default(524_288), // 512KB
|
|
TASK_PAYLOAD_MAXIMUM_SIZE: z.coerce.number().int().default(3_145_728), // 3MB
|
|
BATCH_TASK_PAYLOAD_MAXIMUM_SIZE: z.coerce.number().int().default(1_000_000), // 1MB
|
|
TASK_RUN_METADATA_MAXIMUM_SIZE: z.coerce.number().int().default(262_144), // 256KB
|
|
|
|
MAXIMUM_DEV_QUEUE_SIZE: z.coerce.number().int().optional(),
|
|
MAXIMUM_DEPLOYED_QUEUE_SIZE: z.coerce.number().int().optional(),
|
|
MAX_BATCH_V2_TRIGGER_ITEMS: z.coerce.number().int().default(500),
|
|
MAX_BATCH_AND_WAIT_V2_TRIGGER_ITEMS: z.coerce.number().int().default(500),
|
|
|
|
REALTIME_STREAM_VERSION: z.enum(["v1", "v2"]).default("v1"),
|
|
REALTIME_STREAM_MAX_LENGTH: z.coerce.number().int().default(1000),
|
|
REALTIME_STREAM_TTL: z.coerce
|
|
.number()
|
|
.int()
|
|
.default(60 * 60 * 24), // 1 day in seconds
|
|
BATCH_METADATA_OPERATIONS_FLUSH_INTERVAL_MS: z.coerce.number().int().default(1000),
|
|
BATCH_METADATA_OPERATIONS_FLUSH_ENABLED: z.string().default("1"),
|
|
BATCH_METADATA_OPERATIONS_FLUSH_LOGGING_ENABLED: z.string().default("1"),
|
|
|
|
// Run Engine 2.0
|
|
RUN_ENGINE_WORKER_COUNT: z.coerce.number().int().default(4),
|
|
RUN_ENGINE_TASKS_PER_WORKER: z.coerce.number().int().default(10),
|
|
RUN_ENGINE_WORKER_POLL_INTERVAL: z.coerce.number().int().default(100),
|
|
RUN_ENGINE_TIMEOUT_PENDING_EXECUTING: z.coerce.number().int().default(60_000),
|
|
RUN_ENGINE_TIMEOUT_PENDING_CANCEL: z.coerce.number().int().default(60_000),
|
|
RUN_ENGINE_TIMEOUT_EXECUTING: z.coerce.number().int().default(60_000),
|
|
RUN_ENGINE_TIMEOUT_EXECUTING_WITH_WAITPOINTS: z.coerce.number().int().default(60_000),
|
|
RUN_ENGINE_DEBUG_WORKER_NOTIFICATIONS: z.coerce.boolean().default(false),
|
|
|
|
RUN_ENGINE_WORKER_REDIS_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_HOST),
|
|
RUN_ENGINE_WORKER_REDIS_READER_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_READER_HOST),
|
|
RUN_ENGINE_WORKER_REDIS_READER_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform(
|
|
(v) =>
|
|
v ?? (process.env.REDIS_READER_PORT ? parseInt(process.env.REDIS_READER_PORT) : undefined)
|
|
),
|
|
RUN_ENGINE_WORKER_REDIS_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform((v) => v ?? (process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT) : undefined)),
|
|
RUN_ENGINE_WORKER_REDIS_USERNAME: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_USERNAME),
|
|
RUN_ENGINE_WORKER_REDIS_PASSWORD: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_PASSWORD),
|
|
RUN_ENGINE_WORKER_REDIS_TLS_DISABLED: z
|
|
.string()
|
|
.default(process.env.REDIS_TLS_DISABLED ?? "false"),
|
|
|
|
RUN_ENGINE_RUN_QUEUE_REDIS_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_HOST),
|
|
RUN_ENGINE_RUN_QUEUE_REDIS_READER_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_READER_HOST),
|
|
RUN_ENGINE_RUN_QUEUE_REDIS_READER_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform(
|
|
(v) =>
|
|
v ?? (process.env.REDIS_READER_PORT ? parseInt(process.env.REDIS_READER_PORT) : undefined)
|
|
),
|
|
RUN_ENGINE_RUN_QUEUE_REDIS_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform((v) => v ?? (process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT) : undefined)),
|
|
RUN_ENGINE_RUN_QUEUE_REDIS_USERNAME: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_USERNAME),
|
|
RUN_ENGINE_RUN_QUEUE_REDIS_PASSWORD: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_PASSWORD),
|
|
RUN_ENGINE_RUN_QUEUE_REDIS_TLS_DISABLED: z
|
|
.string()
|
|
.default(process.env.REDIS_TLS_DISABLED ?? "false"),
|
|
|
|
RUN_ENGINE_RUN_LOCK_REDIS_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_HOST),
|
|
RUN_ENGINE_RUN_LOCK_REDIS_READER_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_READER_HOST),
|
|
RUN_ENGINE_RUN_LOCK_REDIS_READER_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform(
|
|
(v) =>
|
|
v ?? (process.env.REDIS_READER_PORT ? parseInt(process.env.REDIS_READER_PORT) : undefined)
|
|
),
|
|
RUN_ENGINE_RUN_LOCK_REDIS_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform((v) => v ?? (process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT) : undefined)),
|
|
RUN_ENGINE_RUN_LOCK_REDIS_USERNAME: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_USERNAME),
|
|
RUN_ENGINE_RUN_LOCK_REDIS_PASSWORD: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_PASSWORD),
|
|
RUN_ENGINE_RUN_LOCK_REDIS_TLS_DISABLED: z
|
|
.string()
|
|
.default(process.env.REDIS_TLS_DISABLED ?? "false"),
|
|
|
|
RUN_ENGINE_DEV_PRESENCE_REDIS_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_HOST),
|
|
RUN_ENGINE_DEV_PRESENCE_REDIS_READER_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_READER_HOST),
|
|
RUN_ENGINE_DEV_PRESENCE_REDIS_READER_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform(
|
|
(v) =>
|
|
v ?? (process.env.REDIS_READER_PORT ? parseInt(process.env.REDIS_READER_PORT) : undefined)
|
|
),
|
|
RUN_ENGINE_DEV_PRESENCE_REDIS_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform((v) => v ?? (process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT) : undefined)),
|
|
RUN_ENGINE_DEV_PRESENCE_REDIS_USERNAME: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_USERNAME),
|
|
RUN_ENGINE_DEV_PRESENCE_REDIS_PASSWORD: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_PASSWORD),
|
|
RUN_ENGINE_DEV_PRESENCE_REDIS_TLS_DISABLED: z
|
|
.string()
|
|
.default(process.env.REDIS_TLS_DISABLED ?? "false"),
|
|
|
|
//API Rate limiting
|
|
/**
|
|
* @example "60s"
|
|
* @example "1m"
|
|
* @example "1h"
|
|
* @example "1d"
|
|
* @example "1000ms"
|
|
* @example "1000s"
|
|
*/
|
|
RUN_ENGINE_RATE_LIMIT_REFILL_INTERVAL: z.string().default("10s"), // refill 250 tokens every 10 seconds
|
|
RUN_ENGINE_RATE_LIMIT_MAX: z.coerce.number().int().default(1200), // allow bursts of 750 requests
|
|
RUN_ENGINE_RATE_LIMIT_REFILL_RATE: z.coerce.number().int().default(400), // refix 250 tokens every 10 seconds
|
|
RUN_ENGINE_RATE_LIMIT_REQUEST_LOGS_ENABLED: z.string().default("0"),
|
|
RUN_ENGINE_RATE_LIMIT_REJECTION_LOGS_ENABLED: z.string().default("1"),
|
|
RUN_ENGINE_RATE_LIMIT_LIMITER_LOGS_ENABLED: z.string().default("0"),
|
|
|
|
/** How long should the presence ttl last */
|
|
DEV_PRESENCE_TTL_MS: z.coerce.number().int().default(30_000),
|
|
DEV_PRESENCE_POLL_INTERVAL_MS: z.coerce.number().int().default(5_000),
|
|
DEV_PRESENCE_RECONNECT_THRESHOLD_MS: z.coerce.number().int().default(2_000),
|
|
/** How many ms to wait until dequeuing again, if there was a run last time */
|
|
DEV_DEQUEUE_INTERVAL_WITH_RUN: z.coerce.number().int().default(250),
|
|
/** How many ms to wait until dequeuing again, if there was no run last time */
|
|
DEV_DEQUEUE_INTERVAL_WITHOUT_RUN: z.coerce.number().int().default(1_000),
|
|
/** The max number of runs per API call that we'll dequeue in DEV */
|
|
DEV_DEQUEUE_MAX_RUNS_PER_PULL: z.coerce.number().int().default(10),
|
|
|
|
LEGACY_RUN_ENGINE_WORKER_ENABLED: z.string().default(process.env.WORKER_ENABLED ?? "true"),
|
|
LEGACY_RUN_ENGINE_WORKER_CONCURRENCY_WORKERS: z.coerce.number().int().default(2),
|
|
LEGACY_RUN_ENGINE_WORKER_CONCURRENCY_TASKS_PER_WORKER: z.coerce.number().int().default(1),
|
|
LEGACY_RUN_ENGINE_WORKER_POLL_INTERVAL: z.coerce.number().int().default(1000),
|
|
LEGACY_RUN_ENGINE_WORKER_IMMEDIATE_POLL_INTERVAL: z.coerce.number().int().default(50),
|
|
LEGACY_RUN_ENGINE_WORKER_CONCURRENCY_LIMIT: z.coerce.number().int().default(100),
|
|
|
|
LEGACY_RUN_ENGINE_WORKER_REDIS_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_HOST),
|
|
LEGACY_RUN_ENGINE_WORKER_REDIS_READER_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_READER_HOST),
|
|
LEGACY_RUN_ENGINE_WORKER_REDIS_READER_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform(
|
|
(v) =>
|
|
v ?? (process.env.REDIS_READER_PORT ? parseInt(process.env.REDIS_READER_PORT) : undefined)
|
|
),
|
|
LEGACY_RUN_ENGINE_WORKER_REDIS_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform((v) => v ?? (process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT) : undefined)),
|
|
LEGACY_RUN_ENGINE_WORKER_REDIS_USERNAME: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_USERNAME),
|
|
LEGACY_RUN_ENGINE_WORKER_REDIS_PASSWORD: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_PASSWORD),
|
|
LEGACY_RUN_ENGINE_WORKER_REDIS_TLS_DISABLED: z
|
|
.string()
|
|
.default(process.env.REDIS_TLS_DISABLED ?? "false"),
|
|
LEGACY_RUN_ENGINE_WORKER_REDIS_CLUSTER_MODE_ENABLED: z.string().default("0"),
|
|
|
|
LEGACY_RUN_ENGINE_WAITING_FOR_DEPLOY_BATCH_SIZE: z.coerce.number().int().default(100),
|
|
LEGACY_RUN_ENGINE_WAITING_FOR_DEPLOY_BATCH_STAGGER_MS: z.coerce.number().int().default(1_000),
|
|
|
|
COMMON_WORKER_ENABLED: z.string().default(process.env.WORKER_ENABLED ?? "true"),
|
|
COMMON_WORKER_CONCURRENCY_WORKERS: z.coerce.number().int().default(2),
|
|
COMMON_WORKER_CONCURRENCY_TASKS_PER_WORKER: z.coerce.number().int().default(10),
|
|
COMMON_WORKER_POLL_INTERVAL: z.coerce.number().int().default(1000),
|
|
COMMON_WORKER_IMMEDIATE_POLL_INTERVAL: z.coerce.number().int().default(50),
|
|
COMMON_WORKER_CONCURRENCY_LIMIT: z.coerce.number().int().default(100),
|
|
|
|
COMMON_WORKER_REDIS_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_HOST),
|
|
COMMON_WORKER_REDIS_READER_HOST: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_READER_HOST),
|
|
COMMON_WORKER_REDIS_READER_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform(
|
|
(v) =>
|
|
v ?? (process.env.REDIS_READER_PORT ? parseInt(process.env.REDIS_READER_PORT) : undefined)
|
|
),
|
|
COMMON_WORKER_REDIS_PORT: z.coerce
|
|
.number()
|
|
.optional()
|
|
.transform((v) => v ?? (process.env.REDIS_PORT ? parseInt(process.env.REDIS_PORT) : undefined)),
|
|
COMMON_WORKER_REDIS_USERNAME: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_USERNAME),
|
|
COMMON_WORKER_REDIS_PASSWORD: z
|
|
.string()
|
|
.optional()
|
|
.transform((v) => v ?? process.env.REDIS_PASSWORD),
|
|
COMMON_WORKER_REDIS_TLS_DISABLED: z.string().default(process.env.REDIS_TLS_DISABLED ?? "false"),
|
|
COMMON_WORKER_REDIS_CLUSTER_MODE_ENABLED: z.string().default("0"),
|
|
|
|
TASK_EVENT_PARTITIONING_ENABLED: z.string().default("0"),
|
|
TASK_EVENT_PARTITIONED_WINDOW_IN_SECONDS: z.coerce.number().int().default(60), // 1 minute
|
|
});
|
|
|
|
export type Environment = z.infer<typeof EnvironmentSchema>;
|
|
export const env = EnvironmentSchema.parse(process.env);
|