Skip to content

Installing MongoDB 5 for Component Pack 8

Install MongoDB 5 for Component Pack 8.

Before you begin

Ensure you have the following:

  • A Component Pack machine that is ready to deploy infrastructure chart.
  • The machine should have Helm to install MongoDB using a Helm chart.
  • Access to the HCL MongoDB repository.
  • An internet-facing environment with Docker installed (to build an image from the Dockerfile). It does not need to be the Component Pack machine, but it should be internet-facing since building this MongoDB image requires access to external resources.

Procedure

  1. Download or git clone the HCL Mongo repository and extract (if needed) it on the machine where Docker is installed.

  2. Go to the extracted folder (from step 1) and check if the Dockerfile exists there. Use this Dockerfile to build a new MongoDB 5 image:

    docker build --no-cache --tag {{ docker_registry_url 
    }}/middleware-mongodb5:{{ image_tag }} -f Dockerfile .
    

    Where:

    • docker_registry_url is the registry URL for Harbor, that is hclcr.io/cnx.
    • image_tag is the user-defined tag for the image, for example current timestamp .

    Ensure you see following output after image is built:

    Successfully built <system generated docker image id>
    Successfully tagged hclcr.io/cnx/middleware-mongodb5:{{ image_tag }}
    
  3. Save this image to a tar file:

    docker save -o mongodb5.tar {{ docker_registry_url
    }}/middleware-mongodb5:{{ image_tag }}
    

    Where:

    • docker_registry_url is the registry URL for Harbor, that is hclcr.io/cnx.
    • image_tag is the user-defined tag for the image defined in step 2.
  4. Copy mongodb5.tar on all the Kubernetes worker nodes used for Component Pack installation.

  5. Import MongoDB 5 image into containerd on all the Kubernetes worker nodes:

    sudo ctr -n=k8s.io image import mongodb5.tar
    
  6. Verify if the image is imported successfully into containerd:

    sudo ctr -n=k8s.io image list | grep middleware-mongodb5:{{ image_tag }} 
    
  7. With MongoDB 5, you need persistent volumes for all replicas of Mongo5 pod and you need to verify that they have been created. Refer to Set up NFS.

  8. Install Helm charts. When it comes to Helm charts, this documentation references to YAML files stored in the HCL Helm repository as parameters.

  9. Before installing Mongo5, set up PV/PVC. Install the connections-volumes Helm chart to set up the persistence layer:

    1. On your Component Pack node, download connections-volumes.yml.j2. Then, rename the downloaded file to connections-volumes.yml and open it.

      Replace variables in curly braces with the appropriate values.

    2. Find out the connections-volumes chart version available on the harbor:

      helm search repo v-connections-helm --devel | grep connections-persistent-st | awk {'print $2'}
      o/p 0.1.1-20220505-090030
      
    3. Install connections-volumes chart:

      helm upgrade connections-volumes v-connections-helm/connections-persistent-storage-nfs -i --version 0.1.1-20220505-090030 -f connections-volumes.yml --wait
      
    4. Verify it by running kubectl get pvc -n connections | grep mongo5

      All PVCs are in BOUND state.

      Note: If upgrade connections-volumes fails, try to delete all PV, PVC first and then run upgrade command.

  10. Install MongoDB 5 using Helm charts.

    1. On your Component Pack node, download infrastructure.yml.j2. Then, rename the file to infrastructure.yml and open it.

      Replace variables in curly braces with the appropriate values.

    2. Install or upgrade the infrastructure chart using the following steps. You'll use infrastructure charts as it contains MongoDB 5 charts. To install these charts:

      1. Find infrastructure chart version:

        helm search repo v-connections-helm --devel | grep
        infrastructure | awk {'print $2'}
        o/p: 0.1.0-20220617-050009
        
      2. Install infrastructure charts:

        Note: You need only one --set option with a comma-separated list of properties.

        helm upgrade infrastructure v-connections-helm/infrastructure -i --version 0.1.0-20220617-050009 --namespace connections -f infrastructure.yml --set mongo5.image.tag={{ image_tag }}
        

        Where:

        • 0.1.0-20220617-050009 is the version number identified from step 10b.
        • docker_registry_url is the registry URL for Harbor, that is hclcr.io/cnx.
        • image_tag is the user-defined tag for the image defined in step 2.

        For example:

        helm upgrade infrastructure v-connections-helm/infrastructure -i --version 0.1.0-20221006-050011 --namespace connections -f infrastructure.yml --set mongo5.image.tag=20221010-9977
        

Parent topic: Steps to install or upgrade to Component Pack 8