Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 54 Next »

Configuration

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_botname.json attached with the respective bots below, then rename it as workflow.json 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" "$@"


Environment Variables for specific bots
 buildon
Variable NamePurpose
HUBOT_GIT_SOFTWARESpecify which Software to be used for buildon (GitLab or GitHub)
HUBOT_GITLAB_IPThe GitLab server IP
GITLAB_SERVICE_TOKENAuthentication token from gitlab
HUBOT_BUILDON_SERVICEThe buildon_host_address
POSTGRES_LINK

Postgres connection string

(eg → jdbc:postgresql://<username>:<password>@<postgres_server_IP>:<port>/postgres)

BUILDON_TABLE_NAMETable name from which buildon reports are taken by bot

Additional Information

In addition to the default dependencies, the package.json of the bot should have the following dependencies:

"hubot": "^2.19.0"
"i": "^0.3.5"
"monitor": "^0.6.10"
"nedb": "^1.8.0"
"npm": "^5.1.0"
"request": "^2.81.0"
"pg": "6.4.2"

 github
Variable namePurpose
HUBOT_GITHUB_APIGithub API link (https://api.github.com)
HUBOT_GITHUB_USERGithub username
HUBOT_GITHUB_TOKENGithub oAuth token with appropriate permissions (Refer here to learn more about github oAuth tokens)
HUBOT_GITHUB_REPODefault github repository name (optional)

Additional Information

workflow.json → Required for approval flow configuration

In addition to the default dependencies, the package.json of the bot should have the following dependencies:

"elasticsearch":"^14.2.2"
"moment":"*"
"mongodb":"^2.2.31"
"fs.notify":"*"
"xml2js":"*"
"monitor":"*"
"request":"2.81.0"

 Gitlab
Variable namePurpose
HUBOT_GITLAB_APIGitlab API URL (eg - http://<gitlab_host_ip>/api/v4)
HUBOT_GITLAB_USERGitlab user
HUBOT_GITLAB_TOKENGitlab Personal access token with appropriate permissions (Click here to learn more about Gitlab personal access tokens)

Additional Information

workflow.json → Required for approval flow configuration

 package.json of the bot should have the following dependencies:

"elasticsearch":"^14.2.2"
"moment":"*"
"mongodb":"^2.2.31"
"fs.notify":"*"
"xml2js":"*"
"monitor":"*"
"request":"2.81.0"

 insights-grafana
Variable NamePurpose
HUBOT_GRAFANA_HOSTGrafana host url
HUBOT_GRAFANA_API_KEYGrafana API key

NEO4J_USERNAME

Neo4j database username
NEO4J_PASSWORDNeo4j database password
INSIGHT_URLInsights host url
CHANNEL_IDchannel ID for slack/Hipchat and channel name for mattermost where grafana panel images will be uploaded
AUTH_TOKENAuthentication token with upload permission


Additional Information

installcurl.sh → Required to install curl dynamically if not installed already

In addition to the default dependencies, the package.json of the bot should have the following dependencies:

"date-now": "^1.0.1"
"fs.notify": "0.0.4"
"hubot": "^2.19.0"
"hubot-grafana": "^1.6.0"
"hubot-slack": "^4.4.0"
"monitor": "^0.6.10"
"neo4j": "^2.0.0-RC2"
"neo4j-driver": "^1.5.0"
"request": "^2.81.0"
"unix-time": "^1.0.1"

 jenkins
Variable namePurpose
HUBOT_JENKINS_URLJenkins host URL
HUBOT_JENKINS_USERJenkins username
HUBOT_JENKINS_PASSWORDJenkins password
HUBOT_JENKINS_API_TOKENJenkins API token
HUBOT_JENKINS_VERSIONJenkins version (give upto 2 decimal only. eg - if version is 2.12.1, give 2.12)

Additional Information

workflow.json → Required for approval flow configuration

In addition to the default dependencies, the package.json of the bot should have the following dependencies:

"hubot-jenkins": "^1.0.2"
"hubot-slack": "^4.3.3"
"hubot-yardmaster": "^1.0.30"
"jenkins": "^0.20.0"
"elasticsearch":"^14.2.2"
"moment":"*"
"mongodb":"^2.2.31"
"fs.notify":"*"
"xml2js":"*"
"monitor":"*"
"request":"2.81.0"

 nexus
Variable namePurpose
NEXUS_USER_IDNexus username
NEXUS_PASSWORDNexus password
NEXUS_URLNexus host URL

Additional Information

workflow.json → Required for approval flow configuration

 package.json of the bot should have the following dependencies:

"cli-table": "^0.3.1"
"elasticsearch": "^14.1.0"
"fs.notify": "0.0.4"
"hubot": "^2.19.0"
"moment": "^2.20.1"
"mongodb": "^2.2.33"
"monitor": "^0.6.10"
"nedb": "^1.8.0"
"request": "^2.83.0"

 Jira


Variable namePurpose
HUBOT_JIRA_URLJira host URL
HUBOT_JIRA_USERJira username
HUBOT_JIRA_PASSWORDJira password

Additional Information

workflow.json → Required for approval flow configuration

In addition to the default dependencies, the package.json of the bot should have the following dependencies:

"elasticsearch":"^14.2.2"
"moment":"*"
"mongodb":"^2.2.31"
"fs.notify":"*"
"xml2js":"*"
"monitor":"*"
"request":"2.81.0"

 rundeck
Variable namePurpose
RUNDECK_URLRundeck host URL
RUNDECK_TOKENRundeck API token
RUNDECK_USERNAMERundeck user name
RUNDECK_PASSWORDRundeck password

Additional Information

workflow.json → Required for approval flow configuration

In addition to the default dependencies, the package.json of the bot should have the following dependencies:

"elasticsearch":"^14.2.2"
"moment":"*"
"mongodb":"^2.2.31"
"fs.notify":"*"
"xml2js":"*"
"monitor":"*"
"request":"2.81.0"

 scalr
Variable namePurpose
SCALR_API_URLScalr host URL
SCALR_ACCESS_IDAccess ID of scalr
SCALR_ACCESS_KEYAccess key of scalr
SCALR_ENV_IDEnvironment ID on which the bot should work
NODE_TLS_REJECT_UNAUTHORIZEDTo skip ssl validation
SCALR_PROJECT_IDProject ID on which the bot should work
SCALR_CLOUD_PLATFORMScalr cloud platform (eg → ec2)
SCALR_CLOUD_LOCATIONCloud location of scalr (eg → us-west-2)
SCALR_NETWORK_IDNetwork ID on which bot should work (vpc)
SCALR_SUBNET_IDThe subnet ID which is included in the above vpc
SCALR_SECURITY_GROUP_IDSecurity group ID which operates on the above subnet

Additional Information

workflow.json → Required for approval flow configuration

In addition to the default dependencies, the package.json of the bot should have the following dependencies:

"elasticsearch":"^14.2.2"
"moment":"*"
"mongodb":"^2.2.31"
"fs.notify":"*"
"xml2js":"*"
"monitor":"*"
"request":"2.81.0"

 sonar
Variable namePurpose
SONAR_URLSonar host URL
SONAR_USER_IDSonar user name
SONAR_PASSWORDSonar password

Additional Information

workflow.json → Required for approval flow configuration

 package.json of the bot should have the following dependencies:

"elasticsearch":"^14.2.2",
"moment":"*",
"mongodb":"^2.2.31",
"fs.notify":"*",
"xml2js":"*",
"monitor": "^0.6.10",
"request":"2.81.0"

 udeploy


Variable namePurpose
UDEPLOY_URLUdeploy host URL
UDEPLOY_USER_IDUdeploy username
UDEPLOY_PASSWORDUdeploy password

Additional Information

workflow.json → Required for approval flow configuration

In addition to the default dependencies, the package.json of the bot should have the following dependencies:

"elasticsearch":"^14.2.2"
"moment":"*"
"mongodb":"^2.2.31"
"fs.notify":"*"
"xml2js":"*"
"monitor":"*"
"request":"2.81.0"

 urelease


Variable namePurpose
URELEASE_URLUrelease host URL
URELEASE_USER_IDUrelease username
URELEASE_PASSWORDUrelease password

Additional Information

workflow.json → Required for approval flow configuration

In addition to the default dependencies, the package.json of the bot should have the following dependencies:

"elasticsearch":"^14.2.2"
"moment":"*"
"mongodb":"^2.2.31"
"fs.notify":"*"
"xml2js":"*"
"monitor":"*"
"request":"2.81.0"

 xldeploy
Variable namePurpose
XLDEPLOY_URLXLDeploy host URL
XLDEPLOY_USER_IDXLDeploy username
XLDEPLOY_PASSWORDXLDeploy password

Additional Information

workflow.json → Required for approval flow configuration

In addition to the default dependencies, the package.json of the bot should have the following dependencies:

"elasticsearch":"^14.2.2"
"moment":"*"
"mongodb":"^2.2.31"
"fs.notify":"*"
"xml2js":"*"
"monitor":"*"
"request":"2.81.0"

 xlrelease
Variable namePurpose
XLRELEASE_URLXLRelease host URL
XLRELEASE_USERNAMEXLRelease username
XLRELEASE_PASSWORDXLRelease password

Additional Information

workflow.json → Required for approval flow configuration

In addition to the default dependencies, the package.json of the bot should have the following dependencies:

"elasticsearch":"^14.2.2"
"moment":"*"
"mongodb":"^2.2.31"
"fs.notify":"*"
"xml2js":"*"
"monitor":"*"
"request":"2.81.0"

 artifactory
Variable namePurpose
ARTIFACTORY_HOSTArtifactory host URL
ARTIFACTORY_USERArtifactory username
ARTIFACTORY_PASSWORDArtifactory password

Additional Information

workflow.json → Required for approval flow configuration

In addition to the default dependencies, the package.json of the bot should have the following dependencies:

"elasticsearch":"^14.2.2"
"moment":"*"
"mongodb":"^2.2.31"
"fs.notify":"*"
"xml2js":"*"
"monitor":"*"
"request":"2.81.0"

 rally
Variable namePurpose
APIRally API URL
USERNAMERally username
PASSWORDRally password
API_TOKENRally API acess token

Additional Information

workflow.json → Required for approval flow configuration

The package.json of the bot should have the following dependencies:

"elasticsearch":"^14.2.2"
"moment":"*"
"mongodb":"^2.2.31"
"fs.notify":"*"
"xml2js":"*"
"monitor":"*"
"request":"2.81.0"

 teamcity
Variable namePurpose

HUBOT_TEAMCITY_URL

Teamcity host URL

HUBOT_TEAMCITY_USERNAME

Teamcity username

HUBOT_TEAMCITY_PWD

Teamcity password

Additional Information

workflow.json → Required for approval flow configuration

In addition to the default dependencies, the package.json of the bot should have the following dependencies:

"elasticsearch": "^14.2.2"
"fs.notify": "*"
"moment": "*"
"mongodb": "^3.1.0"
"monitor": "*"
"request": "2.81.0"
"xml2js": "*"

Environment variables common for all bots

EXPRESS_PORT (Port number where the hubot will run)
MY_POD_IP (Host address where bot is running)
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)
ELASTIC_SEARCH_IP (elasticsearch ip address)
ELASTIC_SEARCH_PORT (elasticsearch port)
HUBOT_SLACK_TOKEN (API token for connecting with slack)
MATTERMOST_ENDPOINT (context of the endpoint where bot is running with mattermost adapter)
MATTERMOST_INCOME_URL (Mattermost Incoming webhook)
MATTERMOST_TOKEN (Mattermost outgoing token - to be configured with outgoing webhook)

MongoDB Collections Required For Approval Flow

To implement the approval flow with the bot, whichever collection name you put in MONGO_COUNTER variable(mentioned above) should be present inside the db set by MONGO_DB_NAME.

For example- suppose you have MONGO_COUNTER=counters and MONGO_DB_NAME=hubot set in your environment. Then you should have a database called "hubot" inside your mongodb. This "hubot" should contain a collection named "counters" having this structure: { _id: "ticketIdGenerator",seq: 100}
To create a collection like this, go to your mongo shell and execute below steps:

  • use hubot
  • db.createCollection("counters")
  • db.counters.insert({_id: "ticketIdGenerator",seq: 100})

The MONGO_TICKETIDGEN should contain the Id of the collection referred by MONGO_COUNTER. Therefore, for the above example, MONGO_TICKETIDGEN=ticketIdGenerator.

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.