Skip to main content
Version: 0.5

RocketChat installation

This tutorial shows the basic concepts of Capact on the RocketChat installation example.

Goal#

This instruction will guide you through the installation of RocketChat on a Kubernetes cluster using Capact.

RocketChat depends on the MongoDB database.

The diagram below shows the scenario:

capact-diagram

Prerequisites#

NOTE: For AWS EKS Capact installation, all operation need to be run from the bastion host.

The following tools are required:

Install all RocketChat components in a Kubernetes cluster#

  1. Setup Capact CLI

  2. Make sure to separate workloads

    For a better performance and durability, it is recommended to run MongoDB and RocketChat on separate nodes. MongoDB is by default configured to prefer being run on nodes with label node.capact.io/type=storage. We will also configure RocketChat affinity to not schedule pods on such nodes.

    Select any worker node and replace the <NODE NAME> with the node name and run:

    kubectl label node <NODE NAME> node.capact.io/type=storage
  3. Export Capact cluster domain name as environment variable:

    export CAPACT_DOMAIN_NAME={domain_name} # e.g. demo.cluster.capact.dev
  4. Create a file with installation parameters:

    cat > /tmp/rocketchat-params.yaml << ENDOFFILEinput-parameters:  host: chat.${CAPACT_DOMAIN_NAME}ENDOFFILE
  5. Create an Action:

    capact action create cap.interface.productivity.rocketchat.install \--name rocketchat \--parameters-from-file /tmp/rocketchat-params.yaml
  6. Get the status of the Action from the previous step:

    capact action get rocketchat

    Wait until the Action is in READY_TO_RUN state. It means that the Action was processed by the Engine, and the Interface was resolved to a specific Implementation. As a user, you can verify that the rendered Action is what you expected. If the rendering is taking more time, you will see the BEING_RENDERED phase.

  7. Run the Action.

    In the previous step, the Action was in the READY_TO_RUN phase. It is not executed automatically, as the Engine waits for the user's approval. To execute it, execute:

    capact action run rocketchat
  8. Watch the Action:

    capact action watch rocketchat

    Wait until the Action is finished.

  9. Once the Action is succeeded, view output TypeInstances:

    capact action status rocketchat
  10. Open the RocketChat UI using the host value from the previous step.

    rocketchat

๐ŸŽ‰ Hooray! You now have your own RocketChat instance installed. Be productive!

Validate RocketChat high availability setup#

NOTE: The following steps are optional. In this tutorial we used AWS EKS Capact installation and all instructions will be based on this setup.

Now, let's validate the high-availability setup for the RocketChat.

Non-disruptive tests#

Here we are simulating maintenance actions which should not disrupt RocketChat. Non-disruptive actions for example are:

  • Rolling update of RocketChat.
  • Scheduled Node maintenance where pods are evicted from the node.
  • Rescheduling pod to another node.
  1. List RocketChat pods

    kubectl get pod -l app.kubernetes.io/name=rocketchat
  2. Select two random pods from the list above and delete them.

    Use kubectl delete command. For example:

     kubectl delete pod rocketchat-1617956008-rocketchat-5b45b74f77-pncck

    NOTE: Make sure that at least one pod is in Ready state.

  3. Verify if RocketChat is still running without any disruption.

Disruptive tests#

Here we are simulating scenario when Kubernetes lost a connection to one of the worker nodes.

  1. Make sure that MongoDB and RocketChat pods are running on different nodes.

    To list pods and assigned nodes run:

    kubectl get pod -o wide
  2. Make sure that the pod with public-ingress-nginx prefix is not running on the same nodes as RocketChat.

    kubectl -n capact-system get pod -o wide
  3. Get a list of nodes where RocketChat pods are running:

    kubectl get pod -o go-template --template='{{ range .items}}{{.metadata.name}} - {{ .spec.nodeName }}{{"\n"}}{{end}}'

    Choose one of them and note the node name.

  4. Terminate the selected worker node from the EKS console.

    To terminate note go to the cluster main page. In the Overview section click on the selected node. In the Info section click a link under Instance name. New tab will be opened. From the menu in the top right select Terminate instance option

    AWS Dashborad - nodes AWS Dashboard - worker AWS Dashboard - instance

  5. Open the RocketChat site again using provided host during RocketChat installation. It should be still accessible.

    NOTE: Depending on which node will be deleted and to which RocketChat Pod you are connected, it may take up to 30 seconds for Kubernetes to change configuration. During that time RocketChat may not be available.

Clean-up#

โš ๏ธ CAUTION: This removes all resources that you created.

When you are done, remove the Action and Helm charts:

capact action delete rocketchathelm delete $(helm list -f="rocketchat-*|mongodb-*" -q

Additional resources#

See the Content Development guide, to understand how to develop OCF content for Capact.

If you want to learn more about the project, check the capact repository.