This document defines the specification for application JSON implementation for Facets.Cloud.
For the actual schema, you can refer to the following GitHub pages:
To understand how a complete application specification looks like, check this JSON file in Github for Self-Hosting Kill Bill application .
The Application Schema has one native key, namely, loadbalancing
and 4 sets of keys referenced from the Job Schema, namely, release
, runtime
, permission
, and env
.
Let's look at the values that can be used in each of these keywords, their description and usage.
Key Optional Type Description loadbalancing
No Object Defines whether this application is exposed to a load balancer (defined as ingress intent). release
No Object Defines the release/build related metadata of an application. runtime
No Object Allows the user to manage runtime properties like command and sizing. permission
No Array[Object] Allows the user to manage permissions to other resources env
No Object Allows the user to manage environment variables.
Key Optional Type Description rules
No Array[Object] Defines the list of rules for load balancing using the keywords ingress
, path
, and portName
.
Key Optional Type Description ingress
No String Defines the ingress to which the rules will be added. path
No String Defines the path in which this application is listening. e.g. /api/ portName
No String Defines the port where this request is directed.
JSON
{ "loadbalancing": {
"rules": [
{
"ingress": "appingress",
"path": "/",
"portName" : "port8080"
}
]
}
}
Key Optional Type Description strategy
No String Defines the strategy to apply when releasing this application. This can take the following two values from an Enum, namely: RollingUpdate
and Recreate
. build
Yes Object Defines the artifactory
, name
, and image
for releasing this application.
Key Optional Type Description artifactory
Yes String Name of the Artifactory registered in Facets Control Plane. name
Yes String Name of the Artifact registered in Facets Control Plane. image
Yes String Image URL for the docker image. (Note that Facets CP should have access to this repository or it should be public).
JSON
{"release": {
"strategy": "RollingUpdate",
"build": {
"image": "exampleImage"
}
}
}
Key Optional Type Description command
Yes Array[String] Defines the Command to run this container. This is required only if there is no CMD specified in your docker. serviceNames
Yes Array[String] Defines how other applications will discover this application. Note that the file name is a default service name and you should use this only if you need additional names for your service. healthCheck
Yes Object You can use this argument to define health checks to determine health of an application. Note that if only a port is specified it will be a port check only. autoscaling
Yes Object Defines the rules for whether this application will auto scale. size
No Object Defines the size of the application as described in sizing json. ports
Yes Array[Object] Defines the ports this application will listen to when running.
Key Optional Type Description startupTime
Yes Integer Time taken by this application to start and be ready. The health check will start after this duration. timeout
Yes Integer Timeout duration if the end point does not respond. period
Yes Integer Interval in which the check has to be repeated. portName
No String Name of the port on which healthcheck has to be done. Name as defined in ports section. livenessUrl
Yes String Specifies the liveness URL. readinessUrl
Yes String Specifies the readiness URL. livenessExecCommand
Yes Array Defines the command for the liveness URL. readinessExecCommand
Yes Array Defines the command for the readiness URL.
Key Optional Type Description min
No Integer Min replicas to run. max
No Integer Max replicas to run. cpuThreshold
No String CPU threshold when to trigger autoscaling.
Key Optional Type Description namespace
Yes String Specifies if there are multiple name spaces for sizing. value
No String Key mentioned in Sizing.json
Key Optional Type Description name
No String Defines unique name for this port. port
No Integer Defines the Port number.
JSON
{ "runtime": {
"size": {
"value": "small",
"namespace": "GP"
},
"autoscaling": {
"cpuThreshold": "50",
"max": 1,
"min": 1
},
"ports": [{
"name": "port8080",
"port": 8080
}]
}
Key Optional Type Description name
Yes String Defines the Unique name to refer to this permission. resourceType
No String Defines which resourcetype/intent type this permission is used for. e.g. mysql/s3 resourceName
No String Defines which resource/intent this permission is used for. permission
No String Defines the Canned ACLs.
JSON
{"permission": [
{
"name": "app-permissions",
"resourceType": "mysql",
"resourceName": "app-db",
"permission": "READ_WRITE"
}
]}
Key Optional Type Description variableName
Yes StaticVariable DynamicVariable VariableForCredentials - Static Variable defines the variables which have a static value. You can override this per environment.
- Defines the variables which contain references to other resources created by Facets.
- Defines the variables which contain a reference to credentials of other resources created by Facets.
Key Optional Type Description type
No String Defines the static variable for this environment. It can take only the following value from an enum, namely, static
default
No String Defines the default value for this variable.
Key Optional Type Description type
No String Defines the dynamic variable for this environment. It can take only the following value from an enum, namely, dynamic
. resourceType
No String Defines which resourcetype/intent type this permission is used for. e.g. mysql/s3 resourceName
No String Defines which resource/intent this permission is used for. attribute
No String Defines the attribute of the resource. e.g. bucket_name.
Key Optional Type Description type
No String Defines the credential variable. It can take only the following value from an enum, namely, credential
permissionName
No String Defines the reference to the permission block attribute
No String Defines which credential part to wire. e.g. Username/ Password
JSON
{"env": {
"APP_DAO_PASSWORD": {
"type": "credential",
"permissionName": "app-permissions",
"attribute": "password"
},
"APP_DAO_URL": {
"type": "static",
"default": "jdbc:mysql://app-db:3306/app?usePipelineAuth=false&useBatchMultiSend=false"
},
"APP_DAO_USER": {
"type": "credential",
"permissionName": "app-permissions",
"attribute": "userName"
}
}
}