Skip to content

Instantly share code, notes, and snippets.

@ducke
Last active October 26, 2015 10:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ducke/7328b8d150eeb7a72c9f to your computer and use it in GitHub Desktop.
Save ducke/7328b8d150eeb7a72c9f to your computer and use it in GitHub Desktop.
Hubot is awesome
sudo useradd hubot -m -d "/opt/hubot" -c "hubot user"
sudo usermod -a -G hubot hubot
cd /opt/hubot
sudo npm install -g coffee-script yo generator-hubot
BOT_OWNER=manuel.henke
BOT_NAME=gerty
BOT_DESC=awesome bot
BOT_ADAPTER=rocketchat
sudo -H -u hubot bash -c 'yo hubot --owner="$BOT_OWNER" --name="$BOT_NAME" --description="$BOT_DESC" --defaults'
sudo -H -u hubot bash -c 'npm install hubot-rocketchat'
sudo -H -u hubot bash -c 'bin/hubot -n $BOT_NAME -a $BOT_ADAPTER'
ROCKETCHAT_ROOM=GENERAL
ROCKETCHAT_USER=gerty
ROCKETCHAT_PASSWORD=bot
cd /tmp
sudo rm -f pm2-hubot.json
echo '{' > pm2-hubot.json
echo ' "apps": [{' >> pm2-hubot.json
echo ' "name": "gerty",' >> pm2-hubot.json
echo ' "script": "/opt/hubot/bin/hubot",' >> pm2-hubot.json
echo ' "out_file": "/var/log/hubot/app.log",' >> pm2-hubot.json
echo ' "error_file": "/var/log/hubot/err.log",' >> pm2-hubot.json
echo ' "exec_interpreter" : "sh",' >> pm2-hubot.json
echo " \"args\" : \"--name $BOT_NAME --adapter $BOT_ADAPTER\"," >> pm2-hubot.json
echo ' "watch" : ["package.json", "external-scripts.json", "scripts/", "hubot-scripts.json", "bin/hubot"],' >> pm2-hubot.json
echo ' "env": {' >> pm2-hubot.json
echo " \"ROCKETCHAT_ROOM\": \"$ROCKETCHAT_ROOM\"," >> pm2-hubot.json
echo " \"ROCKETCHAT_USER\": \"$ROCKETCHAT_USER\"," >> pm2-hubot.json
echo " \"ROCKETCHAT_PASSWORD\": \"$ROCKETCHAT_PASSWORD\"">> pm2-hubot.json
echo ' }' >> pm2-hubot.json
echo ' }]' >> pm2-hubot.json
echo '}' >> pm2-hubot.json
sudo -H -u hubot bash -c 'cp -f /tmp/pm2-hubot.json /opt/hubot'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment