Catalog Recipes
Overview
Catalog Recipes are JSON configuration entries in catalogs collection in core provision database; each catalog represents a recipe to deploy an nginx - service - daemon - mongo - elasticsearch - nodejs service or any custom type.
Once a catalog recipe is created, you can then use it in the Clouds & Deployments section to deploy your services.
Sections
Generic Schema Explanation
Generic Schema Explained
{
"name": "Service Recipe", //catalog recipe name
"type": "soajs", //catalog recipe type
"subtype": "service", //catalog recipe subtype supporting only service or daemon and applicable for soajs only
"description": "This is a sample service catalog recipe", //catalog recipe description
"locked": true, //if catalog recipe is locked, it cannot be modified but you can create copies out of it
"recipe": { //catalog recipe configuration
"deployOptions": { //recipe deployment options
"image": { //recipe image
"prefix": "soajsorg", //image prefix
"name": "soajs", //image name
"tag": "latest", //image tag
"pullPolicy": "Always" //image pull policy (only valid for kubernetes),
"override": false //if set to true, then when using this catalog recipe in the deploy pillar, you can change the values of prefix, name and tag before you submit
},
"specifyGitConfiguration": true, //if set to true, then when deploying a soajs service or daemon, the deployer will ask you to provide the git information of the repo to pull the code from
"readinessProbe": { //readiness probe configuration, any valid kubernetes config is allowed
"httpGet": { //http readinesss probe configuration example
"path": "/heartbeat", //Endpoint to hit when probing
"port": "maintenance" //Target port for probe, can be a string (for labeled ports) or number
},
"initialDelaySeconds": 5, //Number of seconds after the container has started before liveness probes are initiated
"timeoutSeconds": 2, //Number of seconds after which the probe times out. Defaults to 1 second. Minimum value is 1
"periodSeconds": 5, //How often (in seconds) to perform the probe. Default to 10 seconds. Minimum value is 1
"successThreshold": 1, //Minimum consecutive successes for the probe to be considered successful after having failed.
"failureThreshold": 3 //Minimum consecutive failures for the probe to be considered failed after having succeeded
},
"restartPolicy": { //swarm specific restart policy for containers
"condition": "", //Restart condition: none, on-failure, any
"maxAttempts": 0 //maximum number of restart attempts
},
"container": { //Container related deploy options
"network": "", //Docker network that the container should plug to (only applicable for swarm)
"workingDir": "" //Container working directory
},
"ports": [ //Port mapping
{
"name": "http", //Port name
"target": 80, //Target port at container level
"isPublished": true, //Flag that specifies a published port
"published": 81 //Optional exposed port (for kubernetes, 30000 is automatically added to the port number)
}
]
"voluming": {} //Voluming configuration, content depends on platform (swarm or kubernetes), refer to the samples below for more details
},
"buildOptions": {
"settings": {
"accelerateDeployment": true //if set to true, then the deployer will copy soajs from the soajsorg/soajs image instead of installing it using npm
},
//catalog recipe environment variables that are passed on to the service container(s) to be deployed
//environment variables are explained in detail in the last section of this page
"env": {
"NODE_ENV": {
"type": "static",
"value": "production"
},
"SOAJS_ENV": {
"type": "computed",
"value": "$SOAJS_ENV"
},
"MY_ENV": {
"type": "userInput",
"label": "My Environment Variable",
"default": "something",
"fieldMsg": "Enter the value of this field to use in your deployment"
}
},
"cmd": { //catalog recipe command to execute
"deploy": {
"command": [ //command to execute
"bash",
"-c"
],
"args": [ //command arguments
"node index.js -T service"
]
}
}
}
}
}Docker Swarm Voluming
"voluming": { //Voluming configuration
"volumes": [ //Volumes array, objects have a free schema, any valid swarm volume can be set
{
"Type": "volume", //Type of volume: can be volume or bind
"Source": "/data/custom/db/", //Volume source: can be a path or a volume name
"Target": "/data/db/" //Volume target where it will be mounted inside a container
}
]
}Reference : https://docs.docker.com/engine/tutorials/dockervolumes/
Kubernetes Voluming
"voluming": { //Voluming configuration
"volumes": [ //Volumes array, objects have a free schema, any valid kubernetes volume can be set
"name" : "custom-mongo-volume", //Volume name
"hostPath" : { //Example of host volume configuration
"path" : "/data/custom/db/" //Path of volume on the host filesystem
}
],
"volumeMounts": [ //Volume mounts configuration example
{
"mountPath" : "/data/db/", //Path where the volume will be plugged at the pod level
"name" : "custom-mongo-volume" //Name of the volume to be plugged
}
]
}Reference : https://kubernetes.io/docs/concepts/storage/volumes/