GridGain Developers Hub

RedHat OpenShift Deployment

Deploying GridGain Web Console with Docker on RedHat OpenShift.

Overview

Red Hat OpenShift is a Kubernetes-based open source container application platform for enterprise application development and deployment. GridGain Web Console Docker images can be deployed to OpenShift. For general information on using Web Console Docker images, please see Deploying Web Console with Docker.

Create an OpenShift Project

An OpenShift project is a Kubernetes namespace with additional configuration properties and enables a community of users to isolate the GridGain Web Console from other applications and users. Additional information on OpenShift projects can be found here

  1. Create a new OpenShift project

    oc new-project gridgain-web-console
    oc project gridgain-web-console
  2. Once the project is created, you can perform regular project operations such as oc get projects to view the full list of projects and oc status to view the status of the newly created gridgain-web-console project.

Create PersistentVolumeClaim for Web Console Backend

A PersistentVolume object is a storage resource in an OpenShift cluster. Use PersistentVolumeClaim objects to request storage resources for the gridgain-web-console project. See the OpenShift documentation on Persistent Volumes for additional configuration details and concepts.

  1. Specify a volume name (depending on your OpenShift installation) in the web-console-backend-pvc-pds.yaml and create the PersistentVolumeClaim

    oc apply -f web-console-backend-pvc-pds.yaml
  2. A sample web-console-backend-pvc-pds.yaml descriptor can be found below.

    apiVersion: "v1"
    kind: "PersistentVolumeClaim"
    metadata:
      name: "backend-pds"
    spec:
      accessModes:
        - "ReadWriteOnce"
      resources:
        requests:
          storage: "1Gi"
      volumeName: "pv0006"

Create a ConfigMap for Web Console Backend

A ConfigMap is a key-value store that lives as a Kubernetes object. ConfigMaps allow you to modify application behavior without having to recreate the Docker image.

  1. Before creating the web console backend container, you must first create the ConfigMap. Apply the web console backend configmap to the gridgain-web-console project using the following command:

    oc apply -f web-console-backend-configmap.yaml
  2. A sample web-console-backend-configmap.yaml descriptor can be found below.

    #
    # Copyright 2019 GridGain Systems, Inc. and Contributors.
    #
    # Licensed under the GridGain Community Edition License (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #     https://www.gridgain.com/products/software/community-edition/gridgain-community-edition-license
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    #
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: web-console-backend-cm
    data:
      ignite-config.xml: |-
        <?xml version="1.0" encoding="UTF-8"?>
        <beans xmlns="http://www.springframework.org/schema/beans"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation="
               http://www.springframework.org/schema/beans
               http://www.springframework.org/schema/beans/spring-beans.xsd
               http://www.springframework.org/schema/util
               http://www.springframework.org/schema/util/spring-util.xsd">
            <bean id="grid.cfg" class="org.apache.ignite.configuration.IgniteConfiguration">
    
    
                <property name="consistentId" value="web-console-data"/>
                <property name="metricsLogFrequency" value="0"/>
                <property name="queryThreadPoolSize" value="16"/>
                <property name="failureDetectionTimeout" value="10000"/>
                <property name="networkTimeout" value="10000"/>
    
                <!-- Disable all clients. -->
                <property name="connectorConfiguration"><null/></property>
                <property name="clientConnectorConfiguration"><null/></property>
    
    
                <property name="transactionConfiguration">
                    <bean class="org.apache.ignite.configuration.TransactionConfiguration">
                        <property name="txTimeoutOnPartitionMapExchange" value="#{60L * 1000L}"/>
                    </bean>
                </property>
    
                <!-- Logging configuration. -->
                <property name="gridLogger">
                    <bean class="org.apache.ignite.logger.log4j2.Log4J2Logger">
                        <constructor-arg type="java.lang.String" value="log4j2.xml"/>
                    </bean>
                </property>
    
                <property name="failureHandler">
                    <bean class="org.apache.ignite.failure.NoOpFailureHandler"/>
                </property>
                <property name="communicationSpi">
                    <bean class="org.apache.ignite.console.discovery.IsolatedCommunicationSpi"/>
                </property>
    
                <property name="discoverySpi">
                    <bean class="org.apache.ignite.console.discovery.IsolatedDiscoverySpi"/>
                </property>
    
                <property name="dataStorageConfiguration">
                    <bean class="org.apache.ignite.configuration.DataStorageConfiguration">
                        <property name="metricsEnabled" value="true"/>
                        <property name="storagePath" value="/opt/gridgain-web-console-server/work"/>
                        <!--property name="walMode" value="FSYNC"/-->
                        <property name="walPath" value="/opt/gridgain-web-console-server/work"/>
                        <property name="walArchivePath" value="/opt/gridgain-web-console-server/work"/>
                        <property name="walSegmentSize" value="#{512L * 1024 * 1024}"/>
                        <!-- Enable write throttling. -->
                        <property name="writeThrottlingEnabled" value="true"/>
                        <property name="defaultDataRegionConfiguration">
                            <bean class="org.apache.ignite.configuration.DataRegionConfiguration">
                                <property name="initialSize" value="#{1024L * 1024L * 1024L}"/>
                                <property name="maxSize" value="#{1024L * 1024L * 1024L}"/>
                                <property name="checkpointPageBufferSize" value="#{128L * 1024L * 1024L}"/>
                                <property name="metricsEnabled" value="true"/>
                                <property name="persistenceEnabled" value="true"/>
                            </bean>
                        </property>
                    </bean>
                </property>
            </bean>
        </beans>

Create the Web Console Backend Container

After the PersistentVolume and ConfigMap have been applied to the project, create the web console backend container. Remember to specify the correct image tag for your version of GridGain Web Console.

  1. Run the following command to create the container

    oc apply -f web-console-backend-deployment.yaml
  2. A sample web-console-backend-deployment.yaml descriptor can be found below.

    #Copyright 2019 GridGain Systems, Inc. and Contributors.
    #
    # Licensed under the GridGain Community Edition License (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #     https://www.gridgain.com/products/software/community-edition/gridgain-community-edition-license
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    #
    # An example of a Kubernetes configuration for Web Console pod deployment.
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      labels:
        app: web-console-backend
      name: web-console-backend
      namespace: gridgain-web-console
    spec:
      progressDeadlineSeconds: 600
      replicas: 1
      revisionHistoryLimit: 10
      selector:
        matchLabels:
          app: web-console-backend
      template:
        metadata:
          labels:
            app: web-console-backend
        spec:
          containers:
          - image: gridgain/gridgain-web-console-backend:2021.04.00
            imagePullPolicy: IfNotPresent
            name: web-console
            resources: {}
            terminationMessagePath: /dev/termination-log
            terminationMessagePolicy: File
            volumeMounts:
            - mountPath: /opt/gridgain/default-config.xml
              name: web-console-default-config
              subPath: default-config.xml
            - mountPath: /opt/gridgain-web-console-server/work
              name: web-console-persistence
          dnsPolicy: ClusterFirst
          restartPolicy: Always
          schedulerName: default-scheduler
          securityContext: {}
          terminationGracePeriodSeconds: 30
          volumes:
          - configMap:
              defaultMode: 420
              name: web-console-backend-cm
            name: web-console-default-config
          - name: web-console-persistence
            persistentVolumeClaim:
              claimName: backend-pds

Create Web Console Backend Service

Create a Kubernetes service to route network traffic to the Web Console backend service.

  1. Run the following command to create the service which will act as a LoadBalancer for the web console backend service.

    oc apply -f web-console-backend-service.yaml
  2. A sample web-console-backend-service.yaml descriptor can be found below.

    apiVersion: v1
    kind: Service
    metadata:
      name: backend
      namespace: gridgain-web-console
    spec:
      ports:
      - name: backend
        port: 8008
        protocol: TCP
        targetPort: 8008
      selector:
        app: web-console-backend
      sessionAffinity: ClientIP
      sessionAffinityConfig:
        clientIP:
          timeoutSeconds: 10800
      type: ClusterIP
    status: {}

Create a ConfigMap for Web Console Frontend

Similar to the steps for setting up the web console backend, create a ConfigMap for the web console frontend service.

  1. Run the following command to create the ConfigMap for the web console frontend

    oc apply -f web-console-frontend-configmap.yaml
  2. A sample web-console-frontend-configmap.yaml can be found below:

    #
    # Copyright 2019 GridGain Systems, Inc. and Contributors.
    #
    # Licensed under the GridGain Community Edition License (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #     https://www.gridgain.com/products/software/community-edition/gridgain-community-edition-license
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    #
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: web-console-frontend-cm
    data:
       web-console.conf: |-
        #
        # Copyright 2019 GridGain Systems, Inc. and Contributors.
        #
        # Licensed under the GridGain Community Edition License (the "License");
        # you may not use this file except in compliance with the License.
        # You may obtain a copy of the License at
        #
        #     https://www.gridgain.com/products/software/community-edition/gridgain-community-edition-license
        #
        # Unless required by applicable law or agreed to in writing, software
        # distributed under the License is distributed on an "AS IS" BASIS,
        # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
        # See the License for the specific language governing permissions and
        # limitations under the License.
        #
    
        upstream backend-endpoint {
          server backend:8008;
        }
    
        server {
          listen 8008;
          server_name _;
    
          set $ignite_console_dir /data/www;
    
          root $ignite_console_dir;
    
          error_page 500 502 503 504 /50x.html;
    
          location / {
            try_files $uri /index.html = 404;
          }
    
          location /api/v1 {
            proxy_pass http://backend-endpoint;
            proxy_set_header X-Forwarded-Proto $scheme;
            proxy_set_header X-Forwarded-Host $http_host;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_pass_header X-XSRF-TOKEN;
          }
    
          location /agents {
            proxy_pass http://backend-endpoint;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            # Use this setting if you plan to run Web Agent in a container
            proxy_set_header Origin http://backend-endpoint;
            # Use this setting if you plan to run Web Agent as a standalone application
            # proxy_set_header Origin $scheme://$http_host;
          }
    
          location /browsers {
            proxy_pass http://backend-endpoint;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
            proxy_set_header Origin $scheme://$http_host;
            proxy_pass_header X-XSRF-TOKEN;
          }
    
          location = /50x.html {
            root $ignite_console_dir/error_page;
          }
        }

Create the Web Console Frontend Container

After the ConfigMap has been applied to the project, create the web console frontend container. Remember to specify the correct image tag for your version of GridGain Web Console.

  1. Run the following command to create the container

    oc apply -f web-console-frontend-deployment.yaml
  2. A sample web-console-frontend-deployment.yaml can be found below:

    #
    # Copyright 2019 GridGain Systems, Inc. and Contributors.
    #
    # Licensed under the GridGain Community Edition License (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #     https://www.gridgain.com/products/software/community-edition/gridgain-community-edition-license
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    #
    # An example of a Kubernetes configuration for Web Console deployment.
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      name: web-console-frontend
      namespace: gridgain-web-console
    spec:
      replicas: 1
      template:
        metadata:
          labels:
            app: web-console-frontend
        spec:
          containers:
            # Custom Web Console pod name.
          - name: web-console
            image: gridgain/gridgain-web-console-frontend:2021.04.00
            volumeMounts:
            - mountPath: /etc/nginx/web-console.conf
              name: web-console-config
              subPath: web-console.conf
            ports:
            # Ports to open.
            # Might be optional depending on your Kubernetes environment.
            - containerPort: 8008
          volumes:
             - configMap:
                 defaultMode: 420
                 name: web-console-frontend-cm
               name: web-console-config

Create Web Console Frontend Service

Create a Kubernetes service to route network traffic to the Web Console frontend service.

  1. Run the following command to create the service which will act as a LoadBalancer for the web console frontend service.

    oc apply -f web-console-frontend-service.yaml
  2. A sample web-console-frontend-service.yaml can be found below:

    #
    # Copyright 2019 GridGain Systems, Inc. and Contributors.
    #
    # Licensed under the GridGain Community Edition License (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #     https://www.gridgain.com/products/software/community-edition/gridgain-community-edition-license
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    #
    apiVersion: v1
    kind: Service
    metadata:
      # The name must be equal to TcpDiscoveryKubernetesIpFinder.serviceName
      name: web-console-frontend
      # The name must be equal to TcpDiscoveryKubernetesIpFinder.namespaceName
      namespace: gridgain-web-console
    spec:
      type: LoadBalancer
      ports:
        - name: http
          port: 80
          targetPort: 8008
      # Optional - remove 'sessionAffinity' property if the Ignite cluster
      # and applications deployed within Kubernetes
      sessionAffinity: ClientIP
      selector:
        # Must be equal to the label set for Web Console Backend pods.
        app: web-console-frontend

Expose the Web Console Frontend Service and Get Routes to the Application

  1. Expose the deployed Web Console frontend LoadBalancer service using the following command:

    oc expose service web-console-frontend
  2. Get the routes to the Web Console application

    oc get routes
  3. Finally, access the Web Console frontend UI using one of the returned external routes. If running locally, the URL could look like the following:

    http://web-console-frontend-gridgain-web-console.127.0.0.1.nip.io

Configure and Launch Web Agent

Web Agent is an application that connects a GridGain or Ignite cluster to the Web Console. For more information about Web Agent, please see the Getting Started Guide. When working with Web Agent in OpenShift, you can either run Web Agent as a standalone application or in a container. You should not mix container-based Web Agents with standalone Web Agents with a single Web Console. If you choose to run Web Agent as a standalone application, you will also need to modify the web-console-frontend-configmap.yml with the correct /agents configuration as described above. The following instructions will describe setting up Web Agent as a container in OpenShift.

When launching Web Agent in a container, you will need to provide three configurations in order to successfully connect.

  • NODE_URI: The internal service name of the GridGain/Ignite node or cluster

  • SERVER_URI: The internal service name of the Web Console Frontend container. In the above examples, the service name would be web-console-frontend.

  • TOKEN: Security Token generated from the User Profile page of Web Console. In order to generate a Security Token, Web Console must be running.

  1. Create a persistent volume chain for Web Agent

    oc apply -f web-agent-pvc-pds.yaml
  2. A sample web-agent-pvc-pds.yaml can be found below:

    apiVersion: "v1"
    kind: "PersistentVolumeClaim"
    metadata:
      name: "web-agent-pds"
    spec:
      accessModes:
        - "ReadWriteOnce"
      resources:
        requests:
          storage: "1Gi"
      volumeName: "pv0007"
  3. Launch Web Agent as a container in OpenShift

    oc apply -f web-agent-deployment.yaml
  4. A sample web-agent-deployment.yaml can be found below:

    #
    # Copyright 2019 GridGain Systems, Inc. and Contributors.
    #
    # Licensed under the GridGain Community Edition License (the "License");
    # you may not use this file except in compliance with the License.
    # You may obtain a copy of the License at
    #
    #     https://www.gridgain.com/products/software/community-edition/gridgain-community-edition-license
    #
    # Unless required by applicable law or agreed to in writing, software
    # distributed under the License is distributed on an "AS IS" BASIS,
    # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    # See the License for the specific language governing permissions and
    # limitations under the License.
    #
    # An example of a Kubernetes configuration for Ignite pods deployment.
    apiVersion: extensions/v1beta1
    kind: Deployment
    metadata:
      # Custom Ignite cluster's name.
      name: web-agent
    spec:
      # A number of Ignite pods to be started by Kubernetes initially.
      replicas: 1
      template:
        metadata:
          labels:
            app: web-agent
        spec:
          containers:
            # Custom Ignite pod name.
          - name: web-console
            image: gridgain/gridgain-web-agent:2021.04.00
            env:
            - name: NODE_URI
              value: http://ignite.gridgain-cluster.svc.cluster.local:8080
            - name: SERVER_URI
              value: http://web-console-frontend:8008
            - name: TOKENS
              value: fde2d335-7d26-4efa-8d3d-5e7470f90a12
            volumeMounts:
            - mountPath: /opt/ignite/web-console-agent/logs
              name: web-agent-persistence
          volumes:
          - name: web-agent-persistence
            persistentVolumeClaim:
              claimName: web-agent-pds