Example: Local Deployment

In this example we will demo how to deploy SOAJS by leveraging a local Kubernetes cluster. You need the following:


Installation steps

1- you need to create a configuration file as follow:

SOAJS remote installer configuration example
{
  "mongo": {
    "external": false
  },
  "kubernetes": {
    "ip": "kubernetes.docker.internal",
    "port": 6443,
    "token": "dhwbd87y2ed87gcxwe87dx278gdx78egd87d872gcygwxdh287RLNCkhjnbI9u5P4jIiKyn6WWHPRIsJ2GTxT_f66UKv2yxYgcOAn0_6Kd4nXjvAHBJ2LDZAmRbCYSFmfv5QyX7Tok1BSeszI72nwduxg278dgx78egdcx87wgd78ewgd78gwd78gxew78dg78ewd8ew"
  },
  "nginx": {
    "domain": "soajs.org",
    "apiPrefix": "dashboard-api",
    "sitePrefix": "dashboard",
    "deployType": "NodePort",
    "sslType": "secret",
	"sslSecret": {
		"private_key": "PATH_TO_private_key_FILE",
		"fullchain_crt": "PATH_TO_fullchain_crt_FILE"
	},
    "httpPort": 30080,
    "httpsPort": 30443
  },
  "owner": {
    "email": "team@soajs.org",
    "username": "owner",
    "password": "password"
  }
}
  • mongo: This is where you specify the mongo cluster you want to use. external=false means SOAJS will install an instance of mongo to persist its data there.
  • kubernetes: This where you specify the kubernetes information.
  • nginx: This is where you specify the following:
    • domain: is the main domain 
    • apiPrefix: the api prefix which will end up as [apiPrefix.domain]
    • sitePrefix: the site prefix which will end up as [sitePrefix.domain]
    • deployType: can be one of the following:
      • NodePort
      • LoadBalancer
    • sslType: This where where you specify how you want to add the https certificate. You have 2 options: secret or pvc. Check below for more information
    • sslSecret: If sslType is 'secret'  then you must provide the path for both needed files private_key and fullchain_crt. Check below for more information
    • httpPort: Usually this is 80. in the above example we used 30080 because locally port 80 is not free
    • httpsPort: Usually this is 443. in the above example we used 30443 because locally port 443 is not free
  • owner: the owner user and credential information 

2- Run the following command:

remote installer install command
sudo soajs remote-installer install /..PATH_TO../myconfigfile.json

3- Access SOAJS console

You need to update your local /etc/hosts as follow:

etc hosts
127.0.0.1 dashboard-api.soajs.org
127.0.0.1 dashboard.soajs.org

Once you update the /etc/hosts, open your browser and go to http://sitePrefix.domain:httpPort/, based on  the above configuration it will be: http://dashboard.soajs.org:30080/ 


HTTPS as Secret

click here for more information


HTTPS as PVC

click here for more information



Serviceaccount problem

If you face an error related to service account, for example:


ERROR SOAJS Installer: namespaces is forbidden: User "system:serviceaccount:default:default" cannot list resource "namespaces" in API group "" at the cluster scope


you need to create the service account as explained here