StatusBoard is a Tornado application we use to display a Web page with info about things that are going on around our office.
The app uses SSE (wrapped with BTHEventSource) to communicate with browsers.
The config.py.default
file defines a single channel for Pinger. channel_name
will be used as an SSE event name.
Workers provide data for channels. There are two types of workers:
StatusBoard.worker.PeriodicWorker
- invoked periodically at a given interval,StatusBoard.worker.ScheduledWorker
- one-shot worker invoked after scheduling.
There are six workers in the box:
StatusBoard.workers.FeedWorker
- fetches and parses feeds (RSS, Atom, CDF),StatusBoard.workers.PingerWorker
- pings computers defined in config to determine number of present and absent people,StatusBoard.workers.TwitterWorker
- fetches user's tweets,StatusBoard.workers.RedmineWorker
- connects the app to Redmine instance to provide info about projects status,StatusBoard.workers.YahooWeatherWorker
- fetches weather info from Yahoo! Weather,StatusBoard.workers.XMPPBot
- controls XMPP bot that feeds Breaking News section.
config.py
contains a dictionary that'll be loaded by status_board
and passed to Tornado app. It's the place to provide app's config. For more info about default fields see Tornado.
App-specific config dict fields:
people
- list of dicts containing people definition. Mandatory fields arename
andgravatar_mail
.ip
is used by PingerWorker.jid
is used by XMPPBot,redmine_mail
by RedmineWorker and workers will fall back togravatar_mail
automagically if their fields aren't present.redis
- Redis DB connection details.theme
- theme to use. If it's not set then default theme is used.
The config file contains a dict of channel definitions. The syntax is:
channels = {
'<channel_name>': ( WorkerClass, <interval>, [settings_dict] )
}
interval
is in seconds. Pass None
to use worker's default interval.
settings_dict
contains worker-specific settings.
config.py.default
file contains dummy settings dicts for all the built-in workers. Note that PingerWorker doesn't require any additional settings.
app_config['themes_path']
allows you to define a path to themes library. config.py
sets themes_path
to the directory where the file is located. Feel free to change the path.
Currently the app comes bundled with two themes - default (which will be used if you skip theme
field in app_config
dict) and bootstrapped
(based on Twitter's Bootstrap).
Built-in theme allows you to set custom logos. If you wish to do that place files logo.png
and blanker_logo.png
in app_config['logo_path']
. config.py
sets logo_path
to the directory where the file is located. Feel free to change the path.
Use a 187px x 119px image for logo.png
. blanker_logo.png
will be centered in the viewport automatically.
StatusBoard can work in two modes - master or slave.
Master instance runs workers and updates Redis DB according to their status (on warmup) and events they emit. Slave instance listens to notifications posted by master (using Redis PubSub) and emits events to its listeners.
Use of this architecture and Redis PubSub technology allows you to spawn one master and many slaves thus improving number of simultaneous connections handled by the app.
By default the app starts in master mode. To start a slave instance use -s
switch. Note that you should take care to start slaves after the master.
Weather state icons: http://vclouds.deviantart.com/art/VClouds-Weather-Icons-179152045 (CC BY-NC-SA 3.0)
- Create a virtualenv, activate it, clone the repo and cd to it,
python setup.py install
(requires distribute)cp config.py.default config.py
vim config.py
status_board
- Point the browser to app's URL (see
status_board --help
for info). - Sit down and watch the magic happen.
- Profit?
BSD License