How to set up a Rocket.chat server

In order to help other projects with migration, we thought it might be useful to share a summary of some challenges we’ve faced and how we solved them.

Server and Installation

After studying the various possibilities and talking to Rocket.chat’s team, we’ve decided for a Digital Ocean Ubuntu machine, and install docker and docker-compose. You can follow Rocket.chat installation using this setup here

Observations: Newer versions of Ubuntu don’t use upstart anymore, but systemd. So when it comes to the part to set up upstart jobs, configure the same settings but for systemd.

Data Load

It is possible to easily export all data from Slack to Rocket.

https://your-project.slack.com/admin/settings -> Export Data

at Rocket: Admin -> Import -> Slack

But when you finish this import, we’ve faced 2 errors:

Didn’t import #announcements messages: We believe this is a bug caused by renaming #general to #announcements in order to have a channel where only admins were allowed to post.

Make sure you give “create channel” permission to all channel owners, before data loading, otherwise you’ll receive an error when trying to import them.

Didn’t import emails. This occurs because Slack doesn’t export emails on this file. To fix this, here is what you should do:

— Export usernames and emails from https://[your slack].slack.com/admin?csv=1

— Run a script for importing them into your Rocket instance. We’ve build 2 different scripts

Nodejs (Jorge — Aragon)

const fs = require('fs')

const async = require('async') const RocketChatClient = require('rocketchat').RocketChatClient let erroredUsers = [] const client = new RocketChatClient("https", 'rocket.aragon.chat', 443, 'username', 'password', (err, {userId}) => {

fs.readFile('./slack-users.csv', 'utf8', (err, fileData) => {

if (err) return console.log('err loading user file', err) const users = fileData

.split('

')

.slice(1)

.map(row => row.split(','))

.map(([username, email]) => ({ username, email })) async.eachSeries(users.slice(60), updateEmail, (err) => {

if (err) {

return console.log('Updating emails errored', err)

} else {

console.log('Successfully set emails for users')

console.log('errored users:')

erroredUsers.forEach(u => console.log(u))

}

})

})

}) const excludeList = ['jorge', 'tatu', 'olivier', 'luis'] // users that dont need to be updated const updateEmail = ({ username, email }, cb) => {

if (excludeList.indexOf(username) > -1) {

console.log('not updating excluded user', username)

return cb(null, {})

} console.log('updating email for', username)

client.users.info({ username: username }, (err, body) => {

if (err) {

erroredUsers.push(username)

console.log('error', username, err)

return cb(null, {})

} client.users.update(body.user._id, { email }, (err) => {

if (err) {

erroredUsers.push(username)

console.log('error', username, err)

} cb(null, {})

})

})

}

Python script (Ludmila — Auctus)

from pprint import pprint import random from rocketchat_API.rocketchat import RocketChat import json import csv errorList = [] excludeList = [‘ludmila.lopes’, ‘dduartef’] rocket = RocketChat(‘admin-user’, ‘admin-pwrd’, server_url=’your-rocketchat-server’) with open(‘slack-users.csv’, ‘r’) as csvfile: spamreader = csv.DictReader(csvfile) for row in spamreader: if row[‘username’] not in excludeList: l = rocket.users_info(username=row[‘username’]).json() if l[‘success’]: r = rocket.users_update(user_id=l[‘user’][‘_id’], email=row[‘email’], name=l[‘user’][‘name’], password=str(random.randint(1, 10000)), username=row[‘username’]).json() else: errorList.append(row[‘username’]) pprint(‘ — — — — — — — — — — — — — — — ERROR USERS — — — — — — — — — — — — — — — — -’) pprint(errorList)

Settings

To invite users to channels: /invite, /invite-all-from and /invite-all-to

Feedback and Suggestions

All the teams involved in the migration are joining efforts to help Rocket.chat improving its tools. We are constantly in contact with them, giving feedback and suggestions to make Rocket an ideal messaging platform for blockchain projects.

If you have any other comments about setting up a Rocket.chat server please leave a comment. We would love to hear your suggestions!

Get to Know Auctus

Site | Whitepaper |High-level Presentation | Try our Demo

To keep up with our progress, follow us on

Rocket.Chat | Twitter | Facebook | Github | Reddit | Linkedin