Using database for showing stats on home page.

The stats are stored both in couchdb and in the database. Switching to
database to avoid failures when couch dies.
Store IP stats in database as well.