Skip to content
This repository has been archived by the owner on Jul 10, 2018. It is now read-only.
/ totebot2 Public archive

Everything is better in the new building, even the totebot.

Notifications You must be signed in to change notification settings

nprapps/totebot2

Repository files navigation

Totebot

This project is no longer maintained. We have updated javascript dependencies due to github security warning but have not tested the actual impact of that measure on the app functionality.

Derived from the ubiquitous NPR tote bag, Totebot2 follows our conversations on HipChat and provides us with some ambient awareness. Also, humor.

Additional thanks to the Los Angeles Times Data Desk and their copyboy project.

Some light reading

Initial setup

  • Create a new HipChat account for your bot to use. Stay signed in to the account - we'll need to access its account settings later.

  • Add the proper environment variables to your .bash_profile (Stored in our team environment variables file — ask David, Tyler or Chris). These unprefixed versions of the hubot environment variables will be used for local development.

export [email protected]
export HUBOT_HIPCHAT_PASSWORD=password
export [email protected]
export HUBOT_LOG_LEVEL=debug
  • Add prefixed versions of the environment variables to .bash_profile (Also stored in our team environment variables file). The prefixed versions are used by the fab [target] render_confs command to deploy secrets to the server and are necessary in order to run multiple hubots without sharing API keys.
export [email protected]
export TOTEBOT2_HUBOT_HIPCHAT_PASSWORD=password
export [email protected]
export TOTEBOT2_HUBOT_LOG_LEVEL=debug
  • In your main projects folder (e.g., ~/src/), clone this repo and set up a virtual environment
cd ~/src/
git clone [email protected]:nprapps/totebot2.git
cd totebot2
mkvirtualenv totebot2
  • Install required libraries
pip install -r requirements.txt
npm install
brew install icu4c
brew link icu4c
brew install redis
ln -sfv /usr/local/opt/redis/*.plist ~/Library/LaunchAgents
launchctl load ~/Library/LaunchAgents/homebrew.mxcl.redis.plist
  • Install hubot from npm, if you don't already have it:
npm install --global hubot
  • Switch to the new hubot directory (it might be /usr/local/lib/node_modules/hubot) and install dependencies:
cd <above path>
npm install

Local development

  • Start the totebot virtualenv
cd ~/src/totebot2
workon totebot2
  • Start Hubot
hubot

Hubot will run through the scripts in your scripts folder and let you know about any errors or warnings. Then it will appear to stall. Press the enter key to bring up the Hubot > prompt.

If you're testing a command to be directed specifically at Totebot (for example, @totebot next train), you will want to address @hubot at the prompt (@hubot next train).

Deployment

  • Make sure you've exported prefixed versions of our environment variables (see "Initial Setup")

  • Commit your new scripts to the repo.

  • Add any necessary environment variables to app_config.py and totebot2.conf

  • Deploy environment variables to the server (if changed)

fab utils deploy_confs
  • Deploy scripts.
fab utils master deploy

We don't have a staging environment yet.

  • To test your script in HipChat, start a conversation with Totebot (like you would another person) and type in your commands.

Maintenance

  • Sometimes, Totebot goes away. :( To restart:
fab utils restart_init

About

Everything is better in the new building, even the totebot.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published