Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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

  • Create a kubernetes cluster using the GCP console
  • Create a mongo cluster using mongoDB cloud.
    • Make sure you whitelist the IP(s) of the kubernetes cluster and your IP of the machine you will run the installer from
  • SOAJS Installer. click here to learn more


Installation steps

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

Code Block
languagejs
titleSOAJS remote installer configuration example
linenumberstrue
collapsetrue
{
  "mongo": {
    "external": true,
    "profile": {
      "serverscredentials": [
        {

         "hostusername": "cluster0-shard-00-00-wedrt.gcp.mongodb.netUUUU",
          "portpassword": 27017"XXXX"
        },
       
{           "hostservers": "cluster0-shard-00-01-wedrt.gcp.mongodb.net",[
          "port": 27017
        },
        {
          "host": "cluster0-shard-00-02-wedrt.gcp.XXXX.mongodb.net",
   
      "port": 27017         }
      ],
      "credentialsprotocol": {
        "username": "demo",
 "mongodb+srv://",
      "password": "ed7edededd"
      },
      "URLParam": {
        "readPreferenceretryWrites": "secondaryPreferred",
        "replicaSet": "Cluster0-shard-0"true,
        "w": "majority",
        "ha": true,
        "ssl": true,
        "authSource": "admin",
        "bufferMaxEntries": 0,
        "useUnifiedTopology": true
      }
    }
  },
  "kubernetes": {
    "ip": "35.232.82.201",
    "port": 443,
    "token": "dhwbd87y2ed87gcxwe87dx278gdx78egd87d872gcygwxdh287RLNCkhjnbI9u5P4jIiKyn6WWHPRIsJ2GTxT_f66UKv2yxYgcOAn0_6Kd4nXjvAHBJ2LDZAmRbCYSFmfv5QyX7Tok1BSeszI72nwduxg278dgx78egdcx87wgd78ewgd78gwd78gxew78dg78ewd8ew"
  },
  "nginx": {
    "domain": "soajs.org",
    "apiPrefix": "dashboard-api",
    "sitePrefix": "dashboard",
    "deployType": "LoadBalancer",
    "sslType": "pvc",
    "httpPort": 80,
    "httpsPort": 443
  },
  "owner": {
    "email": "team@soajs.org",
    "username": "owner",
    "password": "password"
  }
}

2- Run the following command:

Code Block
languagebash
titleremote installer install command
sudo soajs remote-installer install /..PATH_TO../myconfigfile.json

3- Access SOAJS console.

You need to change the DNS of your domain and then open your browser and go to http://sitePrefix.domain:httpPort/, in the above configuration example it will be: http://dashboard.soajs.org:30080/ 



Kubernetes on GCP


This is an example of how to pull the required information to use your Kubernetes Cluster on Google Cloud:


Auth Token


  1. Click o the connect button in the Kubernetes Cluster


  2. Click on Run in Cloud Shell  on the menu that pops-up.  


  3. Run this Command in the browser Shell

    Code Block
    titlekubectl
    kubectl describe secrets


Endpoint IP


  1. Click o the name of the kubernets cluster. In the image below, the name is the kubernetes-cluster.


  2. The Endpoint IP is value of the Endpoint int he table below:

Port


The port of the Google Cloud Kubernetes Cluster is 443.

RBAC Authorization


You should bind your Default Service Account (system:serviceaccount:default:default),which is the default account  on namespace default bound to Pod with a role cluster-admin. SOAJS needs super permissions to manage your cluster.


Code Block
titlerbac.yaml
collapsetrue
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
  name: test-rbac
# test-rbacis an example
subjects:
  - kind: ServiceAccount
    # Reference to upper's `metadata.name`
    name: default
    # Reference to upper's `metadata.namespace`
    namespace: default
roleRef:
  kind: ClusterRole
  name: cluster-admin
  apiGroup: rbac.authorization.k8s.io

  1. Click o the connect button in the Kubernetes Cluster


  2. Click on Run in Cloud Shell  on the menu that pops-up.  


  3.  Run this Command in the browser Shell

    Code Block
    titlekubectl
    kubectl apply -f PATHTOFILE/rbac.yaml