Categories
centos ChatOps

Installing Hubot on CentOS

Provision a Centos 7 server


yum update

You will see your node and npm versions are old:


[root@st2 ~]# npm -v
3.10.10
[root@st2 ~]# node -v
v6.16.0

Use nodesource


curl -sL https://rpm.nodesource.com/setup_10.x | bash -
sudo yum install gcc-c++ make
sudo yum install -y nodejs

The node and npm versions are now updated:


[root@st2 ~]# node -v
v10.15.3
[root@st2 ~]# npm -v
6.4.1

Install Hubot

Use the hubot instructions


npm install -g yo generator-hubot
mkdir myhubot
cd myhubot

Importantly you need to create a local non-root user, otherwise you get this error:


Error: EACCES: permission denied, open '/root/.config/insight-nodejs/insight-yo.json'

Become that user then run:


yo hubot

Set up Hubot to use the telegram adapter

hubot-yeoman-telegram

Now hubot needs redis, so lets install that.


sudo yum install epel-release
sudo yum update
sudo yum install redis
sudo systemctl enable redis
sudo systemctl start redis

Now lets try run it:

bin/hubot

Which didn’t really work, so I tried with telgram:

bin/hubot -a telegram

Now errors pop up:


[Wed May 22 2019 07:23:05 GMT+0000 (Coordinated Universal Time)] ERROR Error: Conflict: terminated by other getUpdates request; make sure that only one bot instance is running

That error seems to be because of the polling rate which should be lowered, 3500 was the magic number for me

TELEGRAM_TOKEN=XXX:YYY TELEGRAM_INTERVAL=3500 bin/hubot -a telegram

 

Your response will be slower.

It is best to keep your bot name short, I changed mine:

telegram-hubot-fix