Installing and Updating Foresight Mobile Platform on Cluster

In this article:

Preparing Environment

Installing and Updating Foresight Mobile Platform

Updating Foresight Mobile Platform 20.10

Disabling File Mounting

Adding hosts-Pseudonyms

Deleting Foresight Mobile Platform from Cluster

To install and update Foresight Mobile Platform on cluster:

  1. Prepare an environment to install Foresight Mobile Platform.

  2. Install and update Foresight Mobile Platform on the cluster.

  3. Disable file mounting.

  4. Add hosts pseudonyms.

After executing the operations Foresight Mobile Platform will be installed and updated on the cluster.

If required, one can delete the mobile platform from the cluster.

Preparing Environment

To prepare an environment:

  1. Execute authorization in OpenShift using the command:

oc login -u <login> -p <password> <host>

In the <host> substitution specify the host that contains API of the installed OpenShift.

  1. Create namespaces for the StackGres operator using the commands:

oc create namespace stackgres
oc create namespace ongres

Also, create a single namespace for mobile platform components and grant access permissions for loading images from operator's namespaces:

oc create namespace fmp
oc policy add-role-to-group \
    system:image-puller system:serviceaccounts:fmp \
    --namespace=ongres
oc policy add-role-to-group \
    system:image-puller system:serviceaccounts:fmp \
    --namespace=stackgres
  1. Load images to the registry:

    1. Get registry certificates using the command:

CLUSTER_REGISTRY_HOST=$(oc get route default-route -n openshift-image-registry --template='{{ .spec.host }}')
CLUSTER_REGISTRY_USERNAME=$(oc whoami | sed 's/://g')
CLUSTER_REGISTRY_TOKEN=$(oc whoami -t)

NOTE. The created variables are available only in the current console.

    1. Execute authorization in the registry by executing the command in the current console:
docker login -u ${CLUSTER_REGISTRY_USERNAME} -p ${CLUSTER_REGISTRY_TOKEN} ${CLUSTER_REGISTRY_HOST}
    1. Prepare images for loading. To do this, load the archive with mobile platform images to the current virtual machine using the command:

docker load -i ./cluster_fmp_23.05.01_151.tgz
    1. Create a variable with image names:

FMP_IMAGES=$(tar -xzf ./cluster_fmp_23.05.01_151.tgz manifest.json --to-command='cat' \
| grep -oP '(?<=("RepoTags":\["))(.*?)(?=("\]))' \
| sed 's/"//g; s/'"'"'//g; s/,/\n/g;')
Push the images to the registry for the cluster:
for orig_image in ${FMP_IMAGES[*]}
do
  tag_image=$(echo ${orig_image} | awk -v REGISTRY=${CLUSTER_REGISTRY_HOST} \
    '{
    n=split($0,arr,"/");
    print REGISTRY "/" arr[n-1] "/" arr[n]
    }'
  )
  echo -e "\nTag ${orig_image} -> ${tag_image}"
  docker tag ${orig_image} ${tag_image}
  echo -e "\nPush ${tag_image}"
  docker push $tag_image
done

If the error occurs: "certificate signed by unknown authority", execute one of the operations:

{
  "insecure-registries" : ["<registry host>"]
}
oc port-forward -n openshift-image-registry svc/image-registry 32000:5000 --address 0.0.0.0
CLUSTER_REGISTRY_HOST=localhost:32000
  1. Install the StackGres operator with the version 1.0.0-alpha3 to enable mobile platform work in the cluster using the command:

helm install -n stackgres stackgres-operator \
  ./stackgres-operator/stackgres-operator-1.0.0-alpha3.tgz \
  -f ./stackgres-operator/values.yaml
  1. Install the Helm package manager with the version 3.5 or later. To check the version of the installed Helm, execute the command:

 helm version

After this the information about Helm version is returned:

 << version.BuildInfo{Version:"v3.5.4", GitCommit:"1b5edb69df3d3a08df77c9902dc17af864ff05d1", GitTreeState:"clean", GoVersion:"go1.15.11"}
  1. Prepare Persistent Volumes to start the mobile platform in the cluster according to the table:

Name Type/Role Number of vCPU cores vRAM volume Type of vStorage virtual disk
master-1 Master 4 16 -
master-2 Master 4 16 -
master-3 Master 4 16 -
worker-1 Worker 4 16 10 (localdb), 10, 10, 10
worker-2 Worker 4 16 10 (localdb), 10, 10, 10
worker-3 Worker 4 16 100 (cachedb), 50 (maindb), 10, 10, 10, 10, 10
worker-4 Worker 4 16 100 (cachedb), 50 (maindb), 10, 10, 10, 10, 10

The Type of vStorage virtual disk column display the storageClass in brackets. If the class is absent, a standard class is used. Persistent Volumes with a standard class can be requested without explicit specifying of the class. Non-standard classes are used for PostgreSQL-based databases because OpenShift does not determine optimal size for Persistent Volumes.

After executing the operations the environment for installing and updating Foresight Mobile Platform on the cluster is prepared.

Installing and Updating Foresight Mobile Platform

To install and update Foresight Mobile Platform on the cluster:

  1. Set the host, at which the cluster will be available, by executing the command in the virtual machine console:

CLUSTER_HOST=$(oc get route console -n openshift-console --template='{{ .spec.host }}' | cut -d '.' -f2-)

After executing the command a standard host is generated. If required, one can set another host manually.

  1. Install Foresight Mobile Platform using the command:

helm install fmp ./fmp/chart -n fmp \
  -f ./fmp/values.production.yaml \
  --set ingress.host=${CLUSTER_HOST} \
  --timeout 30m0s

Where:

If Foresight Mobile Platform is to be installed by a different service account, add the following parameter to the command:

--set django.deployment.serviceAccountName=your-service-account-name

Where:

  1. Update the installed Foresight Mobile Platform 21.04 or later in the cluster using the command:

helm upgrade fmp ./fmp/chart -n fmp \
  -f ./fmp/values.production.yaml \
  --set ingress.host=${CLUSTER_HOST} \
  --timeout 30m0s \
  --atomic

Where:

If the installed Foresight Mobile Platform is to be updated by a different service account, add the following parameter to the command:

--set django.deployment.serviceAccountName=your-service-account-name

Where:

NOTE. To update Foresight Mobile Platform 20.10 and transfer data see the Updating Foresight Mobile Platform 20.10 section.

After executing the operations, Foresight Mobile Platform will be installed and updated on the cluster.

Updating Foresight Mobile Platform 20.10

To update Foresight Mobile Platform 20.10 on the cluster:

  1. Add the old_cluster_kubeconfig file to access the old cluster based on Kubernetes to the fmp/files folder.

  2. Enable the mode of data transfer from the old cluster using Helm Values:

--set migrateFromOldCluster.enabled=true
--set migrateFromOldCluster.ns=your_old_cluster_namespace

NOTE. Data is transferred only on the initial mobile platform installation. In the future, data is not transferred again even if the parameters are enabled.

  1. If required, send the secretKey value from the old cluster to save active user sessions in the mobile platform:

--set django.deployment.secretKey=your_old_cluster_secret_key
  1. Install Foresight Mobile Platform using Helm.

After executing the operations, a special Job will be created during the mobile platform installation that will transfer data from the old cluster.

IMPORTANT. For the Job to work correctly, one should provide network access from the new cluster to the old one.

Disabling File Mounting

By default, Foresight Mobile Platform uses file mounting by means of additional permissions configured for containers:

securityContext:
  capabilities:
    add:
    - SYS_ADMIN
    - DAC_READ_SEARCH
  privileged: true

To disable file mounting in Foresight Mobile Platform, set value of enabled:

--set django.deployment.mount.enabled=false

Adding hosts-Pseudonyms

If a standard DNS for some reason does not allow the access to required addresses, add hosts-pseudonyms to /etc/hosts using the fmp/values.production.yaml file:

django:
   hostAliases:
   - ip: "127.0.0.1"
      hostnames:
      - "foo.local"
      - "bar.local"
   - ip: "10.1.2.3"
      hostnames:
      - "foo.remote"
      - "bar.remote"

Deleting Foresight Mobile Platform from Cluster

To delete Foresight Mobile Platform from the cluster, execute the command:

helm uninstall fmp -n fmp

After executing the operations, Foresight Mobile Platform will be deleted from the cluster.

See also:

Preparation and Deployment of Fault-Tolerant Cluster Based on OKD/OCP | Adding and Deleting Work Nodes