Skip to content

Instantly share code, notes, and snippets.

@zcstarr
Created June 25, 2019 22:12
Show Gist options
  • Save zcstarr/00755ac35fc6649d76c40c5bdd3ce0a9 to your computer and use it in GitHub Desktop.
Save zcstarr/00755ac35fc6649d76c40c5bdd3ce0a9 to your computer and use it in GitHub Desktop.
Tenative new Service Runner manifest json
{
"$id": "service-runner-config-schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "A Jade Service Runner manifest file format",
"type": "object",
"definitions": {
"shared" : {
"type" : "object",
"path" : {
"type": "string"
},
"link" : {
"type": "string"
}
},
"service": {
"type": "object",
"properties": {
"path": {
"type":"string"
},
"shared": {
"type":"array",
"items": {
"$ref": "#/definitions/shared"
}
},
"name": {
"type":"string"
},
"version" :{
"type":"string"
}
}
}
},
"properties": {
"version": {
"type":"string"
},
"lastModified": {
"type":"string"
},
"services": {
"type": "array",
"items": {
"$ref": "#/definitions/service"
}
}
},
"required": [ "version", "lastModified"]
}
{
"$id": "service-runner-config-schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"description": "A configuration service object",
"type": "object",
"definitions": {
"asset": {
"type": "array",
"items": {
"type": "string"
}
},
"args": {
"type": "array",
"items": {
"type": "string"
}
},
"health": {
"type": "object",
"port": {
"type": "string"
},
"interval": {
"type": "number"
},
"retries": {
"type": "number"
},
"protocol": {
"type": "string",
"oneOf":["udp","tcp"]
},
"required":["interval", "retries", "port", "protocol"]
},
"commandArgs": {
"start": {
"$ref": "#/definitions/args"
},
"stop": {
"$ref": "#/definitions/args"
},
"teardown": {
"$ref": "#/definitions/args"
}
},
"command": {
"cmd": {
"type": "string"
},
"args": {
"$ref": "#/definitions/args"
}
},
"setup": {
"type": "array",
"items": {
"type": "object",
"properties": {
"cmd": {
"type": "string"
},
"args": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
},
"commands": {
"type": "object",
"properties": {
"setup": {
"$ref": "#/definitions/setup"
},
"start": {
"$ref": "#/definitions/command"
},
"stop": {
"$ref": "#/definitions/command"
},
"teardown": {
"$ref": "#/definitions/command"
}
},
"required": ["setup", "start", "stop", "teardown"]
},
"environment": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"args": {
"$ref": "#/definitions/commandArgs"
},
"health": {
"$ref": "#/definitions/health"
},
"shared": {
"type":"array",
"items": {
"$ref": "#/definitions/shared"
}
}
},
"required": ["name"]
},
"osinfo": {
"type": "object",
"properties": {
"commands": {
"$ref": "#/definitions/commands"
},
"assets": {
"$ref": "#/definitions/asset"
}
}
},
"os": {
"type": "object",
"properties": {
"osx": {
"$ref": "#/definitions/osinfo"
},
"linux": {
"$ref": "#/definitions/osinfo"
},
"windows": {
"$ref": "#/definitions/osinfo"
}
},
"anyOf": [{
"required": ["osx"]
},
{
"required": ["windows"]
},
{
"required": ["linux"]
}
]
},
"assets": {
"type": "object",
"properties": {
"osx": {
"$ref": "#/definitions/asset"
},
"windows": {
"$ref": "#/definitions/asset"
},
"linux": {
"$ref": "#/definitions/asset"
}
},
"required": [
"osx", "windows", "linux"
]
},
"shared": {
"type":"object",
"properties": {
"minVersion": {
"type": "number"
},
"maxVersion": {
"type": "number"
},
"path" : {
"type": "string"
}
},
"required": [ "minVersion", "path" ]
},
"service": {
"type": "object",
"properties": {
"version" : {
"type": "string"
},
"name" : {
"type": "string"
},
"environments": {
"type": "array",
"items": {
"$ref": "#/definitions/environment"
}
},
"os": {
"$ref": "#/definitions/os"
},
"name": {
"type": "string"
}
},
"required": ["os", "environments", "name"]
}
},
"properties": {
"services": {
"type": "array",
"items": {
"$ref": "#/definitions/service"
}
}
}
}
@zcstarr
Copy link
Author

zcstarr commented Jun 25, 2019

The things to note here are the addition of shared, which denotes shared resources with a version scope. The aim here is that service runner will resolve version scoping for a resource, generate a temp dir and sym link the underlying location to match service expectations. This linkage will be listed in the service manifest.

If a service goes away, the shared resource will be maintained independently of the scoped directory. Additionally, the service runner is responsible for handling version linking, when appropriate minVersion is set, and a shared config is provided, for an environment. Otherwise the default silo creation is maintained.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment