fix(workbench): bound runtime db pool from yaml (#1920)
This commit is contained in:
@@ -391,10 +391,28 @@
|
|||||||
"workbenchRuntime": {
|
"workbenchRuntime": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
"client": { "$ref": "#/$defs/workbenchRuntimeClient" },
|
||||||
|
"postgres": { "$ref": "#/$defs/workbenchRuntimePostgres" },
|
||||||
"cache": { "$ref": "#/$defs/workbenchRuntimeCache" }
|
"cache": { "$ref": "#/$defs/workbenchRuntimeCache" }
|
||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
|
"workbenchRuntimeClient": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"timeoutMs": { "type": "integer", "minimum": 1 }
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
|
"workbenchRuntimePostgres": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"poolMax": { "type": "integer", "minimum": 1 },
|
||||||
|
"queryTimeoutMs": { "type": "integer", "minimum": 1 },
|
||||||
|
"readyTimeoutMs": { "type": "integer", "minimum": 1 }
|
||||||
|
},
|
||||||
|
"additionalProperties": false
|
||||||
|
},
|
||||||
"workbenchRuntimeCache": {
|
"workbenchRuntimeCache": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
+6
-4
@@ -307,6 +307,12 @@ lanes:
|
|||||||
queryRetryInitialDelayMs: 250
|
queryRetryInitialDelayMs: 250
|
||||||
queryRetryMaxDelayMs: 5000
|
queryRetryMaxDelayMs: 5000
|
||||||
workbenchRuntime:
|
workbenchRuntime:
|
||||||
|
client:
|
||||||
|
timeoutMs: 4500
|
||||||
|
postgres:
|
||||||
|
poolMax: 4
|
||||||
|
queryTimeoutMs: 4500
|
||||||
|
readyTimeoutMs: 2000
|
||||||
cache:
|
cache:
|
||||||
redis:
|
redis:
|
||||||
enabled: true
|
enabled: true
|
||||||
@@ -557,7 +563,6 @@ lanes:
|
|||||||
HWLAB_BOOTSTRAP_ADMIN_API_KEY: secretRef:hwlab-v03-master-server-admin-api-key/api-key
|
HWLAB_BOOTSTRAP_ADMIN_API_KEY: secretRef:hwlab-v03-master-server-admin-api-key/api-key
|
||||||
HWLAB_USER_BILLING_URL: http://hwlab-user-billing.hwlab-v03.svc.cluster.local:6670
|
HWLAB_USER_BILLING_URL: http://hwlab-user-billing.hwlab-v03.svc.cluster.local:6670
|
||||||
HWLAB_WORKBENCH_RUNTIME_URL: http://hwlab-workbench-runtime.hwlab-v03.svc.cluster.local:6671
|
HWLAB_WORKBENCH_RUNTIME_URL: http://hwlab-workbench-runtime.hwlab-v03.svc.cluster.local:6671
|
||||||
HWLAB_WORKBENCH_RUNTIME_TIMEOUT_MS: "1800"
|
|
||||||
HWLAB_WORKBENCH_FACTS_QUERY_MAX_ATTEMPTS: "2"
|
HWLAB_WORKBENCH_FACTS_QUERY_MAX_ATTEMPTS: "2"
|
||||||
HWLAB_WORKBENCH_FACTS_QUERY_BACKOFF_BASE_MS: "120"
|
HWLAB_WORKBENCH_FACTS_QUERY_BACKOFF_BASE_MS: "120"
|
||||||
HWLAB_WORKBENCH_FACTS_QUERY_BACKOFF_MAX_MS: "250"
|
HWLAB_WORKBENCH_FACTS_QUERY_BACKOFF_MAX_MS: "250"
|
||||||
@@ -588,9 +593,6 @@ lanes:
|
|||||||
env:
|
env:
|
||||||
HWLAB_WORKBENCH_RUNTIME_DB_URL: secretRef:hwlab-cloud-api-v03-db/database-url
|
HWLAB_WORKBENCH_RUNTIME_DB_URL: secretRef:hwlab-cloud-api-v03-db/database-url
|
||||||
HWLAB_WORKBENCH_RUNTIME_PORT: "6671"
|
HWLAB_WORKBENCH_RUNTIME_PORT: "6671"
|
||||||
HWLAB_WORKBENCH_RUNTIME_DB_POOL_MAX: "32"
|
|
||||||
HWLAB_WORKBENCH_RUNTIME_QUERY_TIMEOUT_MS: "1500"
|
|
||||||
HWLAB_WORKBENCH_RUNTIME_READY_TIMEOUT_MS: "2000"
|
|
||||||
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: http://otel-collector.platform-infra.svc.cluster.local:4318/v1/traces
|
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: http://otel-collector.platform-infra.svc.cluster.local:4318/v1/traces
|
||||||
OTEL_SERVICE_NAME: hwlab-workbench-runtime
|
OTEL_SERVICE_NAME: hwlab-workbench-runtime
|
||||||
- serviceId: hwlab-user-billing
|
- serviceId: hwlab-user-billing
|
||||||
|
|||||||
@@ -939,6 +939,8 @@ function deployServicesForProfile(deploy, profile) {
|
|||||||
copy.env,
|
copy.env,
|
||||||
serviceDeclarationEnvForProfile(deploy, profile, service.serviceId),
|
serviceDeclarationEnvForProfile(deploy, profile, service.serviceId),
|
||||||
runtimeStoreEnvForProfile(deploy, profile, service.serviceId),
|
runtimeStoreEnvForProfile(deploy, profile, service.serviceId),
|
||||||
|
workbenchRuntimeClientEnvForProfile(deploy, profile, service.serviceId),
|
||||||
|
workbenchRuntimePostgresEnvForProfile(deploy, profile, service.serviceId),
|
||||||
workbenchRuntimeRedisEnvForProfile(deploy, profile, service.serviceId)
|
workbenchRuntimeRedisEnvForProfile(deploy, profile, service.serviceId)
|
||||||
);
|
);
|
||||||
return [service.serviceId, copy];
|
return [service.serviceId, copy];
|
||||||
@@ -952,6 +954,8 @@ function deployServicesForProfile(deploy, profile) {
|
|||||||
env: mergeEnvMaps(
|
env: mergeEnvMaps(
|
||||||
serviceDeclarationEnvForProfile(deploy, profile, override.serviceId),
|
serviceDeclarationEnvForProfile(deploy, profile, override.serviceId),
|
||||||
runtimeStoreEnvForProfile(deploy, profile, override.serviceId),
|
runtimeStoreEnvForProfile(deploy, profile, override.serviceId),
|
||||||
|
workbenchRuntimeClientEnvForProfile(deploy, profile, override.serviceId),
|
||||||
|
workbenchRuntimePostgresEnvForProfile(deploy, profile, override.serviceId),
|
||||||
workbenchRuntimeRedisEnvForProfile(deploy, profile, override.serviceId)
|
workbenchRuntimeRedisEnvForProfile(deploy, profile, override.serviceId)
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
@@ -1049,6 +1053,26 @@ function workbenchRuntimeRedisEnvForProfile(deploy, profile, serviceId) {
|
|||||||
return env;
|
return env;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function workbenchRuntimeClientEnvForProfile(deploy, profile, serviceId) {
|
||||||
|
if (!isRuntimeLane(profile) || serviceId !== "hwlab-cloud-api") return {};
|
||||||
|
const client = runtimeLaneConfig(deploy, profile)?.workbenchRuntime?.client;
|
||||||
|
if (!client || typeof client !== "object" || Array.isArray(client)) return {};
|
||||||
|
const env = {};
|
||||||
|
if (Number.isInteger(client.timeoutMs)) env.HWLAB_WORKBENCH_RUNTIME_TIMEOUT_MS = String(client.timeoutMs);
|
||||||
|
return env;
|
||||||
|
}
|
||||||
|
|
||||||
|
function workbenchRuntimePostgresEnvForProfile(deploy, profile, serviceId) {
|
||||||
|
if (!isRuntimeLane(profile) || serviceId !== "hwlab-workbench-runtime") return {};
|
||||||
|
const postgres = runtimeLaneConfig(deploy, profile)?.workbenchRuntime?.postgres;
|
||||||
|
if (!postgres || typeof postgres !== "object" || Array.isArray(postgres)) return {};
|
||||||
|
const env = {};
|
||||||
|
if (Number.isInteger(postgres.poolMax)) env.HWLAB_WORKBENCH_RUNTIME_DB_POOL_MAX = String(postgres.poolMax);
|
||||||
|
if (Number.isInteger(postgres.queryTimeoutMs)) env.HWLAB_WORKBENCH_RUNTIME_QUERY_TIMEOUT_MS = String(postgres.queryTimeoutMs);
|
||||||
|
if (Number.isInteger(postgres.readyTimeoutMs)) env.HWLAB_WORKBENCH_RUNTIME_READY_TIMEOUT_MS = String(postgres.readyTimeoutMs);
|
||||||
|
return env;
|
||||||
|
}
|
||||||
|
|
||||||
function workbenchRuntimeRedisConfigForProfile(deploy, profile) {
|
function workbenchRuntimeRedisConfigForProfile(deploy, profile) {
|
||||||
if (!isRuntimeLane(profile)) return null;
|
if (!isRuntimeLane(profile)) return null;
|
||||||
const label = `deploy.lanes.${profile}.workbenchRuntime.cache.redis`;
|
const label = `deploy.lanes.${profile}.workbenchRuntime.cache.redis`;
|
||||||
|
|||||||
Reference in New Issue
Block a user