In this article:

Preparing Environment

Installing and Updating Foresight Mobile Platform

Updating Foresight Mobile Platform 20.10

Deleting Foresight Mobile Platform from Cluster

Installing and Updating Foresight Mobile Platform in Cluster

To install and update Foresight Mobile Platform in cluster:

  1. Prepare an environment to install Foresight Mobile Platform.

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

After executing the operations Foresight Mobile Platform will be installed and updated in 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.12.<version number>_151.tgz
    1. Create a variable with image names:

FMP_IMAGES=$(tar -xzf ./cluster_fmp_23.12.<version number>_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
    1. Add images to 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 Helm package manager with the version 3.5 or later. To check the version of the installed Helm, execute the command:

 helm version

After executing the operation the information about Helm version is returned:

version.BuildInfo{Version:"v3.5.4", GitCommit:"1b5edb69df3d3a08df77c9902dc17af864ff05d1", GitTreeState:"clean", GoVersion:"go1.15.11"}
  1. Set the StackGres statement with 1.0.0-alpha3 version to ensure 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. 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 in the cluster is prepared.

Installing and Updating Foresight Mobile Platform

To install and update Foresight Mobile Platform in 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 ServiceAccount account, add the django.deployment.serviceAccountName parameter to the command:

--set django.deployment.serviceAccountName=<ServiceAccount name>

To set up additional parameters on installing Foresight Mobile Platform, see the section:

  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 installed by a different ServiceAccount account, add the django.deployment.serviceAccountName parameter to the command:

--set django.deployment.serviceAccountName=<ServiceAccount name>

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 in the cluster.

Updating Foresight Mobile Platform 20.10

To update Foresight Mobile Platform 20.10 in 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.

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