December 31, 2016 Leave a comment
Rocket.Chat is an open source alternative to slack, and I have been thinking about using it at home. The ubuntu install was painless and very easy, but it didn’t make sense to keep a box up all the time – at least at home. So the best home deployment platform was an sbc (Pi 3).
Installation on pi was ‘mostly’ easy (followed official link) except for the persistence layer – mongodb. Rocket.chat required a newer version of mongodb, and the github page offered a cloud-based alternative for mongodb hosting. To me the whole solution being on-premise (actually whole solution on-pi) was major convincing point, so I avoided that route. After few searches, I located a post by Andy Felong, where he had already compiled binaries for arm architecture (Pi 2 and 3 – Jessie) of mongodb 3.0.9. Although the steps he had listed to deploy mongodb using his binaries were straightforward, I still scripted it; in case if I had to reinstall things again (link to script on github).
After mongodb was installed, the Rocket.chat server started smoothly. My beta testers (my kids) were ready to jump on it as soon as I created their user accounts. So much that at one point, when a file upload was a bit slow; I saw my son clicking the button multiple times – and suddenly all of them got a yellow header in chat interface due to server unavailability. I went back to terminal and there was a stack-trace waiting. This was the right time to graduate the interactive start into supervisor-based run.
Here is the launch.sh:
#!/bin/bash export PORT=3000 export ROOT_URL=http://127.0.0.1:3000 export MONGO_URL=mongodb://127.0.0.1:27017/rocketchat export ADMIN_USER=admin export ADMIN_PASS=***** export ADMIN_EMAIL=admin@somedomain /home/pi/meteor/dev_bundle/bin/node /home/pi/rocketchat/bundle/main.js
And the supervisor’s run-as-svc.sh:
#!/bin/bash echo "Note: Start this script as sudo" svcconf=/etc/supervisor/conf.d/rocketchat.conf if [ -f "$svcconf" ]; then echo "supervisor config already exists" else echo "creating supervisor config - first time only" cat > /etc/supervisor/conf.d/rocketchat.conf <<EOF [program:rocketchat] command=/home/pi/rocketchat/bundle/launch.sh directory=/home/pi/rocketchat/bundle autostart=true autorestart=true stderr_logfile=/var/log/rocketChat.svc.err.log stdout_logfile=/var/log/rocketChat.svc.out.log EOF fi echo "Starting process" supervisorctl reread supervisorctl update supervisorctl restart rocketchat
Finally, the only disappointment was android cordova-based app. It kept on showing media less pages (no images, or css loaded) in the webview. I think it could be due to some baked expectations of SSL within the app.
Overall, a fun little project with great potential with webhooks. Some thoughts for webhooks: web cluster/pool member status, build status notifications, current server load, or how Chicago downtown looks like at this exact minute.