diff --git a/schemas/vector/metatileQueuePopulator/full/v1.schema.json b/schemas/vector/metatileQueuePopulator/full/v1.schema.json new file mode 100644 index 00000000..f9466b99 --- /dev/null +++ b/schemas/vector/metatileQueuePopulator/full/v1.schema.json @@ -0,0 +1,45 @@ +{ + "$id": "https://mapcolonies.com/vector/metatileQueuePopulator/full/v1", + "type": "object", + "title": "metatileQueuePopulatorFullV1", + "description": "Metatile Queue Populator's full schema", + "unevaluatedProperties": false, + "allOf": [ + { + "$ref": "https://mapcolonies.com/vector/metatileQueuePopulator/shared/v1" + }, + { + "type": "object", + "required": ["db"], + "properties": { + "db": { + "$ref": "https://mapcolonies.com/common/db/full/v2" + } + } + }, + { + "$ref": "#/definitions/appSchema" + } + ], + "definitions": { + "appSchema": { + "type": "object", + "required": ["app"], + "properties": { + "app": { + "description": "app configuration", + "type": "object", + "default": {}, + "properties": { + "projectName": { + "type": "string", + "description": "The name of the project", + "x-env-value": "APP_PROJECT_NAME" + } + }, + "required": ["projectName"] + } + } + } + } +} diff --git a/schemas/vector/metatileQueuePopulator/shared/v1.configs.json b/schemas/vector/metatileQueuePopulator/shared/v1.configs.json new file mode 100644 index 00000000..31328057 --- /dev/null +++ b/schemas/vector/metatileQueuePopulator/shared/v1.configs.json @@ -0,0 +1,71 @@ +[ + { + "name": "vector-metatilequeuepopulator-shared", + "value": { + "telemetry": { + "shared": { + "serviceName": "metatileQueuePopulator" + }, + "tracing": { + "isEnabled": false + }, + "logger": { + "level": "info", + "prettyPrint": false + }, + "metrics": { + "enabled": true, + "buckets": [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 15, 50, 250, 500] + } + }, + "openapiConfig": { + "filePath": "./openapi3.yaml", + "basePath": "/docs", + "rawPath": "/api", + "uiPath": "/api" + }, + "server": { + "port": 8080, + "request": { + "payload": { + "limit": "1mb" + } + }, + "response": { + "compression": { + "enabled": true, + "options": null + } + } + }, + "app": { + "consumeCondition": { + "enabled": true, + "conditionCheckIntervalSec": 60, + "tilesQueueSizeLimit": 400000 + }, + "enableRequestQueueHandling": true, + "force": { + "api": false, + "expiredTiles": false + }, + "metatileSize": 8, + "requestQueueCheckIntervalSec": 30, + "tilesBatchSize": 10000 + }, + "db": { + "$ref": { "configName": "db-connection", "version": "latest", "schemaId": "https://mapcolonies.com/common/db/partial/v1" }, + "ssl": { + "enabled": false + } + }, + "queue": { + "expireInSeconds": 600, + "retryBackoff": true, + "retryLimit": 3, + "retryDelaySeconds": 60, + "retentionHours": 87660 + } + } + } +] diff --git a/schemas/vector/metatileQueuePopulator/v1.schema.json b/schemas/vector/metatileQueuePopulator/shared/v1.schema.json similarity index 73% rename from schemas/vector/metatileQueuePopulator/v1.schema.json rename to schemas/vector/metatileQueuePopulator/shared/v1.schema.json index 1cec9e63..6df48680 100644 --- a/schemas/vector/metatileQueuePopulator/v1.schema.json +++ b/schemas/vector/metatileQueuePopulator/shared/v1.schema.json @@ -1,8 +1,8 @@ { - "$id": "https://mapcolonies.com/vector/metatileQueuePopulator/v1", + "$id": "https://mapcolonies.com/vector/metatileQueuePopulator/shared/v1", "type": "object", - "title": "metatileQueuePopulatorV1", - "description": "Metatile Queue Populator's schema", + "title": "metatileQueuePopulatorSharedV1", + "description": "Metatile Queue Populator's shared schema", "allOf": [ { "$ref": "https://mapcolonies.com/common/boilerplate/v2" @@ -19,7 +19,7 @@ "required": ["db"], "properties": { "db": { - "$ref": "https://mapcolonies.com/common/db/full/v1" + "$ref": "https://mapcolonies.com/common/db/partial/v1" } } }, @@ -38,14 +38,7 @@ "app": { "description": "app configuration", "type": "object", - "default": {}, - "unevaluatedProperties": false, "properties": { - "projectName": { - "type": "string", - "description": "The name of the project", - "x-env-value": "APP_PROJECT_NAME" - }, "enableRequestQueueHandling": { "type": "boolean", "description": "Flag to enable request queue handling", @@ -53,42 +46,47 @@ "default": true }, "requestQueueCheckIntervalSec": { - "type": "integer", + "type": "number", "description": "Interval in seconds to check the request queue", "x-env-value": "APP_REQUEST_QUEUE_CHECK_INTERVAL_SEC", - "default": 30 + "default": 30, + "exclusiveMinimum": 0 }, "tilesBatchSize": { - "type": "integer", + "type": "number", "description": "Size of the tiles batch", "x-env-value": "APP_TILES_BATCH_SIZE", - "default": 10000 + "default": 10000, + "exclusiveMinimum": 0 }, "metatileSize": { - "type": "integer", + "type": "number", "description": "Size of the metatile", "x-env-value": "APP_METATILE_SIZE", - "default": 8 + "default": 8, + "exclusiveMinimum": 0 }, - "consumeDelay": { + "consumeCondition": { "type": "object", "description": "Configuration for consume delay", "properties": { "enabled": { "type": "boolean", "description": "Flag to enable consume delay", - "x-env-value": "APP_CONSUME_DELAY_ENABLED", + "x-env-value": "APP_CONSUME_CONDITION_ENABLED", "default": false }, - "delaySec": { - "type": "integer", + "conditionCheckIntervalSec": { + "type": "number", "description": "number of seconds for consume delay", - "x-env-value": "APP_CONSUME_DELAY_SEC" + "x-env-value": "APP_CONSUME_CONDITION_CHECK_INTERVAL_SEC", + "exclusiveMinimum": 0 }, "tilesQueueSizeLimit": { "type": "number", "description": "Limit of tiles queue size", - "x-env-value": "APP_CONSUME_DELAY_TILES_QUEUE_SIZE_LIMIT" + "x-env-value": "APP_CONSUME_CONDITION_TILES_QUEUE_SIZE_LIMIT", + "exclusiveMinimum": 0 } }, "if": { @@ -99,7 +97,15 @@ } }, "then": { - "required": ["delaySec", "tilesQueueSizeLimit"] + "required": ["conditionCheckIntervalSec", "tilesQueueSizeLimit"] + }, + "else": { + "allOf": [{ "not": { "required": ["conditionCheckIntervalSec"] } }, { "not": { "required": ["tilesQueueSizeLimit"] } }], + "properties": { + "enabled": { + "const": false + } + } } }, "force": { @@ -121,15 +127,7 @@ } } }, - "required": [ - "projectName", - "enableRequestQueueHandling", - "requestQueueCheckIntervalSec", - "tilesBatchSize", - "metatileSize", - "consumeDelay", - "force" - ] + "required": ["enableRequestQueueHandling", "requestQueueCheckIntervalSec", "tilesBatchSize", "metatileSize", "consumeCondition", "force"] } } }, @@ -141,13 +139,13 @@ "description": "queue configuration", "type": "object", "default": {}, - "unevaluatedProperties": false, "properties": { "expireInSeconds": { - "type": "integer", + "type": "number", "description": "Time in seconds before the queue expires", "x-env-value": "QUEUE_JOBS_EXPIRE_IN_SECONDS", - "default": 600 + "default": 600, + "exclusiveMinimum": 0 }, "retryBackoff": { "type": "boolean", @@ -156,22 +154,25 @@ "default": true }, "retryLimit": { - "type": "integer", + "type": "number", "description": "Maximum number of retry attempts", "x-env-value": "QUEUE_JOBS_RETRY_LIMIT", - "default": 3 + "default": 3, + "exclusiveMinimum": 0 }, "retryDelaySeconds": { - "type": "integer", + "type": "number", "description": "Delay in seconds between retry attempts", "x-env-value": "QUEUE_JOBS_RETRY_DELAY_SECONDS", - "default": 60 + "default": 60, + "exclusiveMinimum": 0 }, "retentionHours": { - "type": "integer", + "type": "number", "description": "Time in hours to retain the queue", "x-env-value": "QUEUE_JOBS_RETENTION_HOURS", - "default": 87660 + "default": 87660, + "exclusiveMinimum": 0 } }, "required": ["expireInSeconds", "retryBackoff", "retryLimit", "retryDelaySeconds", "retentionHours"] @@ -186,7 +187,6 @@ "description": "metrics configuration", "type": "object", "default": {}, - "unevaluatedProperties": false, "properties": { "enabled": { "type": "boolean",