In this example we will demo how to deploy SOAJS by leveraging a local Kubernetes cluster. You need the following:
- A macbook, any decent MacBook will do the trick
- Local Docker with enabled Kubernetes from the Preferences. click here to learn more
- SOAJS Installer. click here to learn more
Installation steps
1- you need to create a configuration file as follow:
Code Block | ||||||||
---|---|---|---|---|---|---|---|---|
| ||||||||
{
"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:
Code Block | ||||
---|---|---|---|---|
| ||||
sudo soajs remote-installer install /..PATH_TO../myconfigfile.json |
3- Access SOAJS console
You need to update your local /etc/hosts as follow:
Code Block | ||
---|---|---|
| ||
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
Note | ||
---|---|---|
| ||
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 |