Skip to content

Building RocketChat as an ansible playbook bundle on OpenShift Container platform (fix for ocp 3.7)

  • by

The current apb-1.0.4-1.el7.noarch in OpenShift 3.7 enterprise from the rhel-7-server-ose-3.7-rpms channel is currently broken. When you try to list apb’s you will get the following error:

apb push Exception occurred! unsupported operand type(s) for +: 'NoneType' and 'str'

Now I will show you how you can fix this. It is important to follow the steps in the order. If not you will get another “missing configuration error if you install the apb directly from the repo I am adding below. Please also check if there is a new package downstream before you follow the fix instructions.

FIX apb

Step 1. Enable the rhel-7-server-ose-3.7-rpms

[root@host82]# subscription-manager repos --enable=rhel-7-server-ose-3.7-rpms

Step 2. Install the apb package. This will also pull in some dependencies which you need!

[root@host82]# yum -y install apb

Step 3. disable the rhel-7-server-ose-3.7-rpms repo

[root@host82]# subscription-manager repos --disable=rhel-7-server-ose-3.7-rpms

Step 4. remove the apb you just installed. This will not remove the dependencies.

[root@host82]# yum -y remove apb

Step 5. Add the following repo to /etc/yum.repos.d/

[root@host82]# wget -O /etc/yum.repos.d/ansible-service-broker.repo

Step 6. Install the update apb

[root@host82]# yum -y install apb

Fix Done

Step 7. Go read this awesome blog post by Dylan Murray  Rocket Chat Ansible Playbook Bundle . We will not use the configs of it. Instead we will go and checkout the following git repository:

[root@host82] rocketchat-apb

Make sure you are logged in as a user with cluster admin rights. In my case I created user during install called admin. This is how you can give admin rights to the user:

[root@host82] oc adm policy add-cluster-role-to-user cluster-admin admin

Step 8. cd into the /dockerhub directory

[root@host82 ]# cd rocketchat-apb/dockerhub

Step 9. Edit the apb.yml file as described in the tutorial I linked to.

Step 10. After you edited the roles deprovision-rocketchat-apb  provision-rocketchat-apb you can now build the apb

[root@host82 rocketchat-apb]# apb build
Finished writing dockerfile.
Building APB using tag: [rocketchat-apb]
Successfully built APB image: rocket-apb

Step 11. next push the image

[root@host82 rocketchat-apb]# apb push
Didn't find OpenShift Ansible Broker route in namespace: ansible-service-broker.                    Trying openshift-ansible-service-broker
version: 1.0
name: rocketchat-apb
description: This APB deploys RocketChat backed by MongoDB
bindable: False
async: optional
  dependencies: ['', '']
  displayName: RocketChat (APB)
  longDescription: An APB that deploys RocketChat to OpenShift backed by MongoDB
  - name: default
    description: This plan deploys a single RocketChat application backed by MongoDB
    free: True
      displayName: Default
      longDescription: This plan provides a RocketChat application backed by MongoDB
      cost: $0.00
      - name: mongodb_user
        default: rocketchat
        type: string
        title: MongoDB Username
        required: True
      - name: mongodb_pass
        default: changeme
        type: string
        title: MongoDB Password
        required: True
      - name: mongodb_name
        default: rocketchat
        type: string
        title: MongoDB Database Name
        required: True
      - name: mongodb_admin_pass
        default: changeme
        type: string
        title: MongoDB Admin Password
        required: True

Found registry IP at:
Building image with the tag:
Successfully pushed image:
Contacting the ansible-service-broker at:
Successfully bootstrapped Ansible Service Broker
Successfully relisted the Service Catalog

Step 11.  list the apb to make sure its there

[root@host82 rocketchat-apb]# apb list
Didn't find OpenShift Ansible Broker route in namespace: ansible-service-broker.                    Trying openshift-ansible-service-broker
Contacting the ansible-service-broker at:
ID                                NAME                             DESCRIPTION                                    
9fd4268e4b33d8d09292755f1945727c  localregistry-rocketchat-apb  This APB deploys RocketChat backed by MongoDB  
2c259ddd8059b9bc65081e07bf20058f  rh-mariadb-apb                   Mariadb apb implementation                     
03b69500305d9859bb9440d9f9023784  rh-mediawiki-apb                 Mediawiki123 apb implementation                
73ead67495322cc462794387fa9884f5  rh-mysql-apb                     Software Collections MySQL APB                 
d5915e05b253df421efe6e41fb6a66ba  rh-postgresql-apb                SCL PostgreSQL apb implementation

Step 12. Login to OpenShift. Please do NOT launch it yet if you do not have dynamic storage provisioning enabled as the mongo-db needs a persistent volume and you need to adjust the broker-config yet to pull from the correct registry. Go to the openshift-ansible-service-broker project.

The installation for the ansible_service_broker in 3.7 OCP pulls the wrong image so your broker will not run. I submitted a fix here:

Make sure the broker is running and has the correct image.

Step 13. Edit the broker config of the apb

Step 14. Add the following to it and save.

Step  15. Re deploy the service broker. You should see a second pod coming up

Step 16. If everything os ok you should see this:

Step 17. If you have dynamic storage provisioning enabled you can now go ahead and build the rocketchat app. If you don’t and you have NFS storage like me, go create the pv

apiVersion: v1
kind: PersistentVolume
  name: pv0001
    storage: 1Gi
    - ReadWriteOnce
    - ReadWriteMany
  persistentVolumeReclaimPolicy: Recycle
    path: /volume1/ocpnfs/pv0001

Step 18. Go and create the pv

[root@host82 rocketchat-apb]# oc create -f pv.yml 
persistentvolume "pv0001" created

Step 19. You are now officially ready to build the rocket chat app. Go to the service catalog and click on it

Step 20. Fill out all information needed. I would recommend to create a new project. Hit create.

Step 21. Go to your project and sit back and enjoy. If everything is build ok you will see the following screen.

Step 22. Click on the link to use the application

Step 23. If you want to remove the apb run apb list and use the uuid with oc delete as shown below.

[root@host82 rocketchat-apb]#  oc delete clusterserviceclass 244aa7f02f2b63398eaa055372d64824

A video of the entire process can be seen here: