diff --git a/schemas/vector/metatileQueuePopulator/full/v2.schema.json b/schemas/vector/metatileQueuePopulator/full/v2.schema.json new file mode 100644 index 00000000..ff14c57a --- /dev/null +++ b/schemas/vector/metatileQueuePopulator/full/v2.schema.json @@ -0,0 +1,45 @@ +{ + "$id": "https://mapcolonies.com/vector/metatileQueuePopulator/full/v2", + "type": "object", + "title": "metatileQueuePopulatorFullV2", + "description": "Metatile Queue Populator's full schema", + "unevaluatedProperties": false, + "allOf": [ + { + "$ref": "https://mapcolonies.com/vector/metatileQueuePopulator/shared/v2" + }, + { + "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/v2.configs.json b/schemas/vector/metatileQueuePopulator/shared/v2.configs.json new file mode 100644 index 00000000..9f480c5b --- /dev/null +++ b/schemas/vector/metatileQueuePopulator/shared/v2.configs.json @@ -0,0 +1,73 @@ +[ + { + "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 + }, + "createSchema": false, + "migrate": false + }, + "queue": { + "expireInSeconds": 600, + "retryBackoff": true, + "retryLimit": 3, + "retryDelaySeconds": 60, + "retentionSeconds": 87660 + } + } + } +] diff --git a/schemas/vector/metatileQueuePopulator/shared/v2.schema.json b/schemas/vector/metatileQueuePopulator/shared/v2.schema.json new file mode 100644 index 00000000..e0df83d2 --- /dev/null +++ b/schemas/vector/metatileQueuePopulator/shared/v2.schema.json @@ -0,0 +1,245 @@ +{ + "$id": "https://mapcolonies.com/vector/metatileQueuePopulator/shared/v2", + "type": "object", + "title": "metatileQueuePopulatorSharedV2", + "description": "Metatile Queue Populator's shared schema", + "allOf": [ + { + "$ref": "https://mapcolonies.com/common/boilerplate/v2" + }, + { + "properties": { + "telemetry": { + "$ref": "#/definitions/metricsSchema" + } + } + }, + { + "type": "object", + "required": ["db"], + "$ref": "#/definitions/dbSchema" + }, + { + "$ref": "#/definitions/appSchema" + }, + { + "$ref": "#/definitions/queueSchema" + } + ], + "definitions": { + "appSchema": { + "type": "object", + "required": ["app"], + "properties": { + "app": { + "description": "app configuration", + "type": "object", + "properties": { + "enableRequestQueueHandling": { + "type": "boolean", + "description": "Flag to enable request queue handling", + "x-env-value": "APP_ENABLE_REQUEST_QUEUE_HANDLING", + "default": true + }, + "requestQueueCheckIntervalSec": { + "type": "number", + "description": "Interval in seconds to check the request queue", + "x-env-value": "APP_REQUEST_QUEUE_CHECK_INTERVAL_SEC", + "default": 30, + "exclusiveMinimum": 0 + }, + "tilesBatchSize": { + "type": "number", + "description": "Size of the tiles batch", + "x-env-value": "APP_TILES_BATCH_SIZE", + "default": 10000, + "exclusiveMinimum": 0 + }, + "metatileSize": { + "type": "number", + "description": "Size of the metatile", + "x-env-value": "APP_METATILE_SIZE", + "default": 8, + "exclusiveMinimum": 0 + }, + "consumeCondition": { + "type": "object", + "description": "Configuration for consume delay", + "properties": { + "enabled": { + "type": "boolean", + "description": "Flag to enable consume delay", + "x-env-value": "APP_CONSUME_CONDITION_ENABLED", + "default": false + }, + "conditionCheckIntervalSec": { + "type": "number", + "description": "number of seconds for consume delay", + "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_CONDITION_TILES_QUEUE_SIZE_LIMIT", + "exclusiveMinimum": 0 + } + }, + "if": { + "properties": { + "enabled": { + "const": true + } + } + }, + "then": { + "required": ["conditionCheckIntervalSec", "tilesQueueSizeLimit"] + }, + "else": { + "allOf": [ + { + "not": { + "required": ["conditionCheckIntervalSec"] + } + }, + { + "not": { + "required": ["tilesQueueSizeLimit"] + } + } + ], + "properties": { + "enabled": { + "const": false + } + } + } + }, + "force": { + "type": "object", + "description": "Force configuration", + "properties": { + "api": { + "type": "boolean", + "description": "Flag to force API", + "x-env-value": "FORCE_API", + "default": false + }, + "expiredTiles": { + "type": "boolean", + "description": "Flag to force expired tiles", + "x-env-value": "FORCE_EXPIRED_TILES", + "default": false + } + } + } + }, + "required": ["enableRequestQueueHandling", "requestQueueCheckIntervalSec", "tilesBatchSize", "metatileSize", "consumeCondition", "force"] + } + } + }, + "queueSchema": { + "type": "object", + "required": ["queue"], + "properties": { + "queue": { + "description": "queue configuration", + "type": "object", + "default": {}, + "properties": { + "expireInSeconds": { + "type": "number", + "description": "Time in seconds before the queue expires", + "x-env-value": "QUEUE_JOBS_EXPIRE_IN_SECONDS", + "default": 600, + "exclusiveMinimum": 0 + }, + "retryBackoff": { + "type": "boolean", + "description": "Flag to enable retry backoff", + "x-env-value": "QUEUE_JOBS_RETRY_BACKOFF", + "default": true + }, + "retryLimit": { + "type": "number", + "description": "Maximum number of retry attempts", + "x-env-value": "QUEUE_JOBS_RETRY_LIMIT", + "default": 3, + "exclusiveMinimum": 0 + }, + "retryDelaySeconds": { + "type": "number", + "description": "Delay in seconds between retry attempts", + "x-env-value": "QUEUE_JOBS_RETRY_DELAY_SECONDS", + "default": 60, + "exclusiveMinimum": 0 + }, + "retentionSeconds": { + "type": "number", + "description": "Time in seconds to retain the queue", + "x-env-value": "QUEUE_JOBS_RETENTION_SECONDS", + "default": 87660, + "exclusiveMinimum": 0 + } + }, + "required": ["expireInSeconds", "retryBackoff", "retryLimit", "retryDelaySeconds", "retentionSeconds"] + } + } + }, + "metricsSchema": { + "type": "object", + "required": ["metrics"], + "properties": { + "metrics": { + "description": "metrics configuration", + "type": "object", + "default": {}, + "properties": { + "enabled": { + "type": "boolean", + "default": true + }, + "buckets": { + "type": "array", + "items": { + "type": "number" + }, + "default": [0.005, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 15, 50, 250, 500] + } + }, + "required": ["enabled", "buckets"] + } + } + }, + "dbSchema": { + "type": "object", + "required": ["db"], + "properties": { + "db": { + "allOf": [ + { + "$ref": "https://mapcolonies.com/common/db/partial/v1" + }, + { + "type": "object", + "properties": { + "createSchema": { + "type": "boolean", + "description": "Flag to enable schema creation if not exists", + "x-env-value": "DB_CREATE_SCHEMA", + "default": false + }, + "migrate": { + "type": "boolean", + "description": "Flag to enable migrations on startup", + "x-env-value": "DB_RUN_MIGRATE", + "default": false + } + } + } + ] + } + } + } + } +}