Need a collaboration space? Try Rocket Chat on Synpse

Published on February 1, 23

As consultants in the field of IoT solutions, we often work closely with our customers on bespoke projects. Effective daily collaboration is essential to ensuring successful project delivery, meeting the customer’s requirements and keeping the project on track. However, managing collaboration tools can be challenging, as different companies use different platforms, such as Slack, Microsoft Teams or Google Hangouts, and inviting external parties to your internal space is not always possible.

To facilitate efficient communication and data sharing, a secure shared collaboration space is necessary. It is imperative that the shared space has robust data security measures in place to protect sensitive information from potential breaches and maintain the confidentiality of the information shared.

Upon completion of the project, the collaboration space should be securely disposed of, leaving no trace of the shared data. This is where Synpse comes in as a solution. Our self-hosted device management platform allows for quick deployment and management of a Rocket Chat server on your own infrastructure, ensuring that the collaboration space is secure and that the data shared is protected from potential breaches.

Prerequisites

Step 1: Create a faros connection with dedicated hostname

We utilized faros.sh to make the Rocket Chat server accessible over the internet. Other alternatives include webhookrelay, caddy, and ngrok, but we chose faros due to our affiliation with its creation and to demonstrate its ease of use.

1
2
3
4
5
6
7
8
# login to faros
faros login
# create a connection for our collaboration space
faros connection create rocket-chat
Connection rocker-chat created
ID: '2154cf22-f5f5-4098-817c-216d388e0a24'
Token: '64a92c28-e227-4400-8465-4c7bcbc7b89a'
Hostname: 'https://14svjq1cxslx4so1fl3qux1iagey1wt599yx6hi08pab.apps.faros.sh'

Store these details for later use.

Step 2: Deploy the Rocket Chat server

Deploy Rocker chat server onto your device manged by Synpse. On your terminal, use the synpse CLI by running the following command:

  • Add faros connection ID and token to the environment variables into the faros container.
  • Add faros hostname to the ROOT_URL environment variable in the rocker-chat container.

If you want, you can use secrets for the faros connection ID and token. You can find more information about secrets here.

synpse deploy -f rocker-chat.yaml

where rocket-chat.yaml is the following:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: rocket-chat
scheduling:
  type: AllDevices
spec:
  containers:
    - name: rocker-chat
      image: registry.rocket.chat/rocketchat/rocket.chat:latest
      ports:
        - "3000"
      env:
        - name: ROOT_URL
          value: https://14svjq1cxslx4so1fl3qux1iagey1wt599yx6hi08pab.apps.faros.sh
        - name: MONGO_URL
          value: mongodb://mongodb:27017/rocketchat?replicaSet=rs0
        - name: MONGO_OPLOG_URL
          value: mongodb://mongodb:27017/local?replicaSet=rs0
        - name: PORT
          value: "3000"
        - name: DEPLOY_METHOD
          value: docker
      restartPolicy: {}
    - name: mongodb
      image: docker.io/mongo:4.4
      args:
        - --replSet=rs0
      command: mongod
      volumes:
        - /data/rocker-mongo:/data/db
      env:
        - name: MONGODB_INITIAL_PRIMARY_HOST
          value: mongodb
        - name: MONGODB_INITIAL_PRIMARY_PORT_NUMBER
          value: "27017"
        - name: MONGODB_ENABLE_JOURNAL
          value: "true"
        - name: ALLOW_EMPTY_PASSWORD
          value: yes
      restartPolicy: {}
    - name: faros
      image: ghcr.io/faroshq/faros-ingress/connector:latest
      env:
        - name: FAROS_CONNECTION_ID
          value: 2154cf22-f5f5-4098-817c-216d388e0a24
        - name: FAROS_TOKEN
          value: 64a92c28-e227-4400-8465-4c7bcbc7b89a
        - name: FAROS_DOWNSTREAM_URL
          value: http://rocker-chat:3000
        - name: FAROS_STATE_DIR
          value: /tmp/faros
      restartPolicy: {}

Step 3: Initialize MongoDB replica set

Once the application is deployed, we need to initialize the MongoDB replica set. This is one-time operation that needs to be done only once after the application is deployed.

To do this, we need to run the following command:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# ssh into the device
synpse ssh <device-name>

# get the container ID of the mongodb container
docker ps | grep mongo
a4b4523bf39d   mongo:4.4   .....
# exec into the mongodb container
docker exec -it a4b4523bf39d bash

# initialize the replica set
mongo --eval "rs.initiate()"

Step 4: Access the Rocket Chat server

Once the application is deployed, you can access the Rocket Chat server by visiting the hostname that you got from the faros connection create command.

It&rsquo;s alive!
It&rsquo;s alive!

What is important that data is stored on your device and not on the cloud. This way, you can ensure that the data is protected from potential breaches. Once you are done with the project, you can destroy the application and the data will be deleted from your device:

1
2
3
synpse ssh <device-name>
# delete volume used in yaml file
rm -rf /data/rocker-mongo