{
  "id": "roleconfig.json",
  "$schema": "http://json-schema.org/draft-04/schema",
  "title": "Role configuration",
  "description": "Configuration of a single role",
  "type": [
    "object"
  ],
  "required": [],
  "properties": {
    "processing": {
      "type": "number",
      "description": "Mean job processing time",
      "unit": "seconds",
      "default": 10,
      "shorthand": "p"
    },
    "stddev": {
      "type": "number",
      "description": "Standard deviation (1σ) of job processing time: 68% completed within -+ this.",
      "unit": "seconds",
      "default": "50% of mean processing time"
    },
    "deadline": {
      "type": "number",
      "shorthand": "d",
      "description": "Time practically all jobs should be completed within.",
      "unit": "seconds",
      "default": 60
    },
    "boot": {
      "type": "number",
      "description": "Mean boot time for worker. From sending scale up message to processing jobs",
      "unit": "seconds",
      "default": 30
    },
    "concurrency": {
      "type": "number",
      "description": "Number of concurrent jobs the worker processes (prefetch in AMQP)",
      "default": 1,
      "unit": "jobs"
    },
    "dynosize": {
      "type": "string",
      "description": "Heroku dyno size used for the worker",
      "example": "perf-m",
      "default": "standard-1x"
    },
    "minimum": {
      "type": "number",
      "shorthand": "min",
      "description": "Minimum amount of workers",
      "unit": "workers",
      "default": 1
    },
    "maximum": {
      "type": "number",
      "shorthand": "max",
      "description": "Minimum amount of workers",
      "unit": "workers",
      "default": 5
    },
    "worker": {
      "type": "string",
      "description": "Worker name (dyno role)",
      "shorthand": "w",
      "default": "role name"
    },
    "queue": {
      "type": "string",
      "description": "Queue name",
      "default": "role name",
      "shorthand": "q"
    },
    "app": {
      "type": "string",
      "description": "Application name (ie on Heroku)",
      "default": "GUV_APP envvar"
    },
    "broker": {
      "type": "string",
      "description": "Broker (ie RabbitMQ) URL",
      "default": "CLOUDAMQP_URL or GUV_BROKER envvar"
    },
    "apikey": {
      "type": "string",
      "description": "Heroku API key",
      "default": "HEROKU_API_KEY envvar"
    },
    "statuspage": {
      "type": "string",
      "description": "Page id (for statuspage.io)",
      "default": "STATUSPAGE_ID envvar"
    },
    "metric": {
      "type": "string",
      "description": "Metric id (for statuspage.io)"
    },
    "percentile": {
      "type": "number",
      "unit": "%",
      "description": "Percentile of jobs that should happen within $deadline",
      "default": 99
    },
    "target": {
      "type": "number",
      "unit": "seconds",
      "description": "Calculated based on process time and variance, to meet percentile and deadline."
    },
    "pollinterval": {
      "type": "number",
      "unit": "seconds",
      "default": 30,
      "description": "How often to poll RabbitMQ, and possibly make changes"
    },
    "history": {
      "type": "number",
      "unit": "seconds",
      "description": "How long history to consider, before scaling workers down",
      "default": 120
    }
  }
}