Individual bots can be set up manually by the process described below:
- Clone our OnBot repository from github (git clone https://github.com/CognizantOneDevOps/OnBot.git)
- Copy the desired bot scripts from the scripts folder of the cloned repo
- Run this command: npm install -g yo generator-hubot
- Create a parent folder myhubot
- Run the following commands:
cd myhubot
yo hubot
- Copy the scripts from the cloned repository (first step) into myhubot/scripts folder
yo generator creates the package.json file under myhubot directory
- Download the workflow.json attached with the respective bots below and place into the myhubot directory
- Run: npm install
- Now set the required environment variables (As mentioned below in Environment Variables for specific bots section)
Finally, start the bot as a background process (logs will be redirected to hubot.log file): nohup ./bin/hubot -a slack > hubot.log &
Before starting the bot, Run npm install hubot-<adapter> to install specific node module for the adapter (chat application) you want to use.
At any time the bot running in background can be stopped by this command: ps aux | grep -ie <botname> | awk '{print $2}' | xargs kill -9
The <botname> can be fetched from the following line of the bin/hubot file:
exec node_modules/.bin/hubot --name "botname" "$@"
EXPRESS_PORT (Port number where the hubot will run)
MONITOR_INTERVAL (Time Interval for monitoring bot)
MONITOR_RETENSION (mapped to 1 (stores a jsonobj in elasticsearch which has all hubot metrics of a current second))
MONGO_DB_URL (mongodb database name for approval process of bot actions)
MONGO_COLL (mongodb collection name for approval process of bot actions)
MONGO_COUNTER (mongodb collection name for storing the number of next ticket to be generated)
MONGO_TICKETIDGEN (stores the Id of the collection referred by MONGO_COUNTER)
APPROVAL_APP_URL (middleware application endpoint which will handle approval flow in mattermost)
MONGO_DB_NAME (The database name which has MONGO_COLL and MONGO_COUNTER in it)
0 Comments