Registry

Objective


The registry contains information about the environment that the service/daemon is running in.

Once you finish your code, you need to deploy this service and then push your changes to other environments.

SOAJS provides the ability to configure and modify the registry using the SOAJS Console Interface.

Once configured, all you need to do is send the name of the registry using an environment variable and start your SOAJS service as any normal NodeJS script ( Manual Deployment ).

If you deployed SOAJS as Local or Remote Cloud using the SOAJS Installer, then simply use the UI Wizard of deploy new service under Deploy Pillar.




Registry Explained


Registry Code Sample & Explanation
var dashboard_registry = {
    "_id": '55128442e603d7e01ab1688c',
    "code": "DASHBOARD",
	"description": "this is the Dashboard environment", //description about the environment
    "domain": "soajs.org", //the domain that the nginx use to redirect to this environment
    "sitePrefix": "dashboard.", //the prefix used by the UI virtual host in nginx for this domain
    "apiPrefix": "dashboard-api.", //the prefix used by the API virtual host in nginx for this domain
    "locked": true,	//if record is locked and cannot be modified unless the logged in user is Owner
    "port": 80,	//Nginx port
    "profile": "/opt/soajs/FILES/profiles/profile.js", //the location of the profile to use ( applicable in Cloud deployment only )
    "deployer": {
       "type": "container",	//specify the platform deployment strategy (manual|container)
       "selected": "container.docker.local", //specify the driver of container based deployment
       "container": {
		  //if container deployment is via docker, one of the below will be used
          "docker": {
             "local": {
                "socketPath": "/var/run/docker.sock" //the default docker socket path
             },
             "remote": {
                "nodes": ["manager1"] //Deprecated, list of nodes that make up the cluster
             }
          },
		  //if container deployment is via kubernetes, one of the below will be used
          "kubernetes":{
             "local":{
                 "nginxDeployType": "NodePort", //type of nginx kubernetes service (NodePort|LoadBalancer)
                 "namespace": { //namespace configuration
				     "default": "soajs", //the default namespace for this environment
					 "perService": false //flag that sets global namespace shared between all services or one namespace per service
				  },
                 "auth": { //kubernetes api authentication configuration
                    "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6ImRlZmF1bHQtdG9rZW4tZHB0em4iLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGVmYXVsdCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjcxNjE5N2U3LTBlMjMtMTFlNy05NWQ3LTA4MDAyNzI0MDU2MSIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDpkZWZhdWx0OmRlZmF1bHQifQ.NfpN54XAkdIsw7PgcHmLeJJKp_tpk9rE0LtBeKSA1KGpW_xLUchNBK59QltL6bR1WscfHXrlXwJlcDV8p9IXkUFmEN5fFLS9OW7t3PvWqa2HXoG5Xcckc4IqDmvqjfSyS_DikCNzYiJ_xusPgBHEcCJMWNPpUINgdUXAP7GPEA73RdptzTyUD1NJaMUAIMTAyJ9BK2jbwm0riVMfmc2s1T5QE4YV5Yp-gQ-MrECdw21Iah3jka1z_y57yRaN0BgaZ_GZABMBN1iKF_uRqk8pA_TQHA-38lvPV7qhnbcWkmrsGMxN0z20Qkt_L9r1vUZ_N2roKUCx3wiTVPe8RjQn0A" //auth token used to communicate with kubernetes api
                 }
             },
             "remote":{
                 "nginxDeployType": "NodePort", //type of nginx kubernetes service (NodePort|LoadBalancer)
                 "namespace": { //namespace configuration
				     "default": "soajs", //the default namespace for this environment
					 "perService": false //flag that sets global namespace shared between all services or one namespace per service
				  },
                 "auth": { //kubernetes api authentication configuration
                    "token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJrdWJlcm5ldGVzL3NlcnZpY2VhY2NvdW50Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9uYW1lc3BhY2UiOiJkZWZhdWx0Iiwia3ViZXJuZXRlcy5pby9zZXJ2aWNlYWNjb3VudC9zZWNyZXQubmFtZSI6ImRlZmF1bHQtdG9rZW4tZHB0em4iLCJrdWJlcm5ldGVzLmlvL3NlcnZpY2VhY2NvdW50L3NlcnZpY2UtYWNjb3VudC5uYW1lIjoiZGVmYXVsdCIsImt1YmVybmV0ZXMuaW8vc2VydmljZWFjY291bnQvc2VydmljZS1hY2NvdW50LnVpZCI6IjcxNjE5N2U3LTBlMjMtMTFlNy05NWQ3LTA4MDAyNzI0MDU2MSIsInN1YiI6InN5c3RlbTpzZXJ2aWNlYWNjb3VudDpkZWZhdWx0OmRlZmF1bHQifQ.NfpN54XAkdIsw7PgcHmLeJJKp_tpk9rE0LtBeKSA1KGpW_xLUchNBK59QltL6bR1WscfHXrlXwJlcDV8p9IXkUFmEN5fFLS9OW7t3PvWqa2HXoG5Xcckc4IqDmvqjfSyS_DikCNzYiJ_xusPgBHEcCJMWNPpUINgdUXAP7GPEA73RdptzTyUD1NJaMUAIMTAyJ9BK2jbwm0riVMfmc2s1T5QE4YV5Yp-gQ-MrECdw21Iah3jka1z_y57yRaN0BgaZ_GZABMBN1iKF_uRqk8pA_TQHA-38lvPV7qhnbcWkmrsGMxN0z20Qkt_L9r1vUZ_N2roKUCx3wiTVPe8RjQn0A" //auth token used to communicate with kubernetes api
                 }
             }
          }
       }
    },
    "dbs": {
		//registry cluster configuration
        "clusters": {
            "dash_cluster": {
				"servers": [
					{
						"host": "127.0.0.1",
						"port": 27017
					}
				],
				"credentials": null,
				"URLParam": {
					"connectTimeoutMS": 0,
					"socketTimeoutMS": 0,
					"maxPoolSize": 5,
					"wtimeoutMS": 0,
					"slaveOk": true
				},
				"extraParam": {
					"db": {
						"native_parser": true,
						"bufferMaxEntries": 0
					},
					"server": {}
				},
				"streaming": {}
			}
        },
		//registry session configuration
        "config": {
            "prefix": "myPrefix_",
            "session": {
                "cluster": "dash_cluster",
                "name": "core_session",
                'store': {},
                "collection": "sessions",
                'stringify': false,
                'expireAfter': 1000 * 60 * 60 * 24 * 14 // 2 weeks
            }
        },
		//list of databases in this registry
        "databases": {
            "urac": {
                "cluster": "dash_cluster",
                "tenantSpecific": true
            }
        }
    },
	//advanced service configuration
    "services": {
		//controller configuration
        "controller": {
            "maxPoolSize": 100, //Specify the controller's maximum pool size, 0 is unlimited.
            "authorization": true, //Specify if the controller should persist the session of the user for browsers that doesn't support cookies.
            "requestTimeout": 30, //Specify the controller maximum timeout limit in seconds, between 20 and 60 seconds 
            "requestTimeoutRenewal": 0 //Specify the controller timeout renewal count, 0 for unlimited
        },
        "config": {
            "awareness": {
                "cacheTTL": 1000 * 60 * 60, //Specify the amount of time in milliseconds between refreshing the cache containing service awareness information 
                "healthCheckInterval": 1000 * 5, //Specify the amount of time in milliseconds between health check operations, minimum 5000.
                "autoRelaodRegistry": 1000 * 60 * 60, //Specify the amount of time in milliseconds between each auto reload registry operation.
                "maxLogCount": 5, //Specify the maximum number to display awareness warning logs for each service before stopping, minimum 5.
                "autoRegisterService": true //Specify if services should auto register or not.
            },
            "key": {
                "algorithm": 'aes256', //which algorithm should bcrypt use 
                "password": 'My Beaver has a secret weapon' //secret phrase to encrypt tenant key security accordingly
            },
			//Specify the logger configuration to use. More info on Bunyan
            "logger": {
                "src": true,
                "level": "debug",
                "formatter": {
                    "outputMode": 'long'
                }
            },
            "cors": {
                "enabled": true, //Specify if CORS should be enabled
                "origin": '*', //Specify the origin that CORS should support 
                "credentials": 'true', //Specify if CORS should should support credentials in requests
                "methods": 'GET,HEAD,PUT,PATCH,POST,DELETE', //Enter the methods that CORS should support 
                "headers": 'key,soajsauth,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization', //Enter header values that CORS should support 
                "maxage": 1728000 //Specify the maximum age value in milliseconds for how long CORS should cache the response
            },
            "oauth": {
               "grants": ['password', 'refresh_token'], //Enter the supported grant types of oAuth and specify if oAuth should run in debug mode.
               "debug": false, //Configure if you want oAuth operation to be debugged and logged on the terminal
               "accessTokenLifetime": 7200, //Access Token Lifetime in seconds. Default is 1 hour.
               "refreshTokenLifetime": 1209600 //Refresh Token Lifetime in seconds. Default is 14 days.
            },
            "ports": {
               "controller": 4000, //Provide the controller default port 
               "maintenanceInc": 1000, //Provide the maintenance port range value from the default port; maintenance port = 4000 + 1000, minimum 1000. 
               "randomInc": 100 //When new services with no port are registered, random port number is assigned. Provide limit: minimum 100.
            },
            "cookie": {
               "secret": "I have a secret cookie phrase" //Enter the cookie secret phrase, used to encrypt cookie values, minimum 5 characters.
            },
            "session": {
                "name": "soajsID", //Specify a name for the session, minimum 5 characters. 
                "secret": "My session secret phrase is complicated", //Specify a secret phrase used to encrypt session values, minimum 5 characters. 
                "cookie": {
                    "path": '/', //Specify path where cookies should be created. 
                    "httpOnly": true, //Choose if cookies should be used in HTTP mode only.
                    "secure": false, //Choose if cookies should be encrypted.
                    "maxAge": null //Specify the lifetime of a cookie in milliseconds, 0 is unlimited. 
                },
                "resave": false, //Choose if the session should be saved back to the session store, even if it was never modified during the request.
                "saveUninitialized": false, //Choose Whether to force a session that is 'uninitialized' to be saved to the store. More info on Express Session 
                "rolling": false, //Choose if the cookie should be set on every response or not. If true, the cookie expiration date will be reset every time.
                "unset": "keep" //Choose if the session should be deleted when the response ends or it should be kept, default is kept
            }
        }
    }
};