Catalog Recipes

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


  1. Generic Schema Explanation

    1. Docker Swarm Voluming

    2. Kubernetes Voluming

  2. Service Catalog Recipe

  3. Daemon Catalog Recipe

  4. Nginx Catalog Recipe

  5. Mongo Catalog Recipe

  6. Elasticsearch Catalog Recipe

  7. NodeJs Catalog Recipe

  8. Environment Variables

    1. Static Variables

    2. Computed Variables

    3. User Input Variables

 

 

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/

 

 

Service Catalog Recipe


The following recipe allows the deployment of SOAJS services and controllers

{ "name": "Service Recipe", "type": "soajs", "subtype": "service", "description": "This is a sample service catalog recipe", "locked": true, "recipe": { "deployOptions": { "image": { "prefix": "soajsorg", "name": "soajs", "tag": "latest", "pullPolicy": "Always" }, "specifyGitConfiguration": true, "readinessProbe": { "httpGet": { "path": "/heartbeat", "port": "maintenance" }, "initialDelaySeconds": 5, "timeoutSeconds": 2, "periodSeconds": 5, "successThreshold": 1, "failureThreshold": 3 }, "restartPolicy": { "condition": "", "maxAttempts": 0 }, "container": { "network": "", "workingDir": "" }, "voluming": {} }, "buildOptions": { "settings": { "accelerateDeployment": true }, "env": { "NODE_ENV": { "type": "static", "value": "production" }, "SOAJS_ENV": { "type": "computed", "value": "$SOAJS_ENV" }, "SOAJS_PROFILE": { "type": "static", "value": "/opt/soajs/FILES/profiles/profile.js" }, "SOAJS_SRV_AUTOREGISTERHOST": { "type": "static", "value": "true" }, "SOAJS_SRV_MEMORY": { "type": "computed", "value": "$SOAJS_SRV_MEMORY" }, "SOAJS_GC_NAME": { "type": "computed", "value": "$SOAJS_GC_NAME" }, "SOAJS_GC_VERSION": { "type": "computed", "value": "$SOAJS_GC_VERSION" }, "SOAJS_GIT_OWNER": { "type": "computed", "value": "$SOAJS_GIT_OWNER" }, "SOAJS_GIT_BRANCH": { "type": "computed", "value": "$SOAJS_GIT_BRANCH" }, "SOAJS_GIT_COMMIT": { "type": "computed", "value": "$SOAJS_GIT_COMMIT" }, "SOAJS_GIT_REPO": { "type": "computed", "value": "$SOAJS_GIT_REPO" }, "SOAJS_GIT_TOKEN": { "type": "computed", "value": "$SOAJS_GIT_TOKEN" }, "SOAJS_DEPLOY_HA": { "type": "computed", "value": "$SOAJS_DEPLOY_HA" }, "SOAJS_HA_NAME": { "type": "computed", "value": "$SOAJS_HA_NAME" }, "SOAJS_MONGO_NB": { "type": "computed", "value": "$SOAJS_MONGO_NB" }, "SOAJS_MONGO_PREFIX": { "type": "computed", "value": "$SOAJS_MONGO_PREFIX" }, "SOAJS_MONGO_RSNAME": { "type": "computed", "value": "$SOAJS_MONGO_RSNAME" }, "SOAJS_MONGO_AUTH_DB": { "type": "computed", "value": "$SOAJS_MONGO_AUTH_DB" }, "SOAJS_MONGO_SSL": { "type": "computed", "value": "$SOAJS_MONGO_SSL" }, "SOAJS_MONGO_IP": { "type": "computed", "value": "$SOAJS_MONGO_IP_N" }, "SOAJS_MONGO_PORT": { "type": "computed", "value": "$SOAJS_MONGO_PORT_N" } }, "cmd": { "deploy": { "command": [ "bash", "-c" ], "args": [ "node index.js -T service" ] } } } } }

 

 

Daemon Catalog Recipe


The following recipe allows the deployment of SOAJS daemon

{ "_id": ObjectId('59143f97b418be4c8e85d052'), "name": "Daemon Recipe", "type": "soajs", "subtype": "daemon", "description": "This is a sample daemon recipe", "locked": true, "recipe": { "deployOptions": { "image": { "prefix": "soajsorg", "name": "soajs", "tag": "latest", "pullPolicy": "Always" }, "specifyGitConfiguration": true, "readinessProbe": { "httpGet": { "path": "/heartbeat", "port": "maintenance" }, "initialDelaySeconds": 5, "timeoutSeconds": 2, "periodSeconds": 5, "successThreshold": 1, "failureThreshold": 3 }, "restartPolicy": { "condition": "", "maxAttempts": 0 }, "container": { "network": "", "workingDir": "" }, "voluming": {} }, "buildOptions": { "settings": { "accelerateDeployment": true }, "env": { "NODE_ENV": { "type": "static", "value": "production" }, "SOAJS_ENV": { "type": "computed", "value": "$SOAJS_ENV" }, "SOAJS_PROFILE": { "type": "static", "value": "/opt/soajs/FILES/profiles/profile.js" }, "SOAJS_SRV_AUTOREGISTERHOST": { "type": "static", "value": "true" }, "SOAJS_SRV_MEMORY": { "type": "computed", "value": "$SOAJS_SRV_MEMORY" }, "SOAJS_DAEMON_GRP_CONF": { "type": "computed", "value": "$SOAJS_DAEMON_GRP_CONF" }, "SOAJS_GIT_OWNER": { "type": "computed", "value": "$SOAJS_GIT_OWNER" }, "SOAJS_GIT_BRANCH": { "type": "computed", "value": "$SOAJS_GIT_BRANCH" }, "SOAJS_GIT_COMMIT": { "type": "computed", "value": "$SOAJS_GIT_COMMIT" }, "SOAJS_GIT_REPO": { "type": "computed", "value": "$SOAJS_GIT_REPO" }, "SOAJS_GIT_TOKEN": { "type": "computed", "value": "$SOAJS_GIT_TOKEN" }, "SOAJS_DEPLOY_HA": { "type": "computed", "value": "$SOAJS_DEPLOY_HA" }, "SOAJS_HA_NAME": { "type": "computed", "value": "$SOAJS_HA_NAME" }, "SOAJS_MONGO_NB": { "type": "computed", "value": "$SOAJS_MONGO_NB" }, "SOAJS_MONGO_PREFIX": { "type": "computed", "value": "$SOAJS_MONGO_PREFIX" }, "SOAJS_MONGO_RSNAME": { "type": "computed", "value": "$SOAJS_MONGO_RSNAME" }, "SOAJS_MONGO_AUTH_DB": { "type": "computed", "value": "$SOAJS_MONGO_AUTH_DB" }, "SOAJS_MONGO_SSL": { "type": "computed", "value": "$SOAJS_MONGO_SSL" }, "SOAJS_MONGO_IP": { "type": "computed", "value": "$SOAJS_MONGO_IP_N" }, "SOAJS_MONGO_PORT": { "type": "computed", "value": "$SOAJS_MONGO_PORT_N" } }, "cmd": { "deploy": { "command": [ "bash", "-c" ], "args": [ "node index.js -T service" ] } } } } }