Landslide is an aggregator of different ElectionLand sources for reporters involved with the project.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Timezone and turnning cache back on. Nov 10, 2016
.editorconfig Start. Oct 5, 2016
.gitignore Adding new relic package. Nov 3, 2016
Procfile Starting some Heroku integration. Oct 20, 2016
index.js Updating relic loading. Nov 3, 2016
package.json Reqriting caching. Nov 7, 2016
scheduler.js Adding new relic package. Nov 3, 2016

Landslide is a small service used for the ElectionLand project that aggregated multiple reporting sources into a single feed for ElectionLand reporters to review.

Overall, Landslide is not useful outside of the Electionland project; it is provided for transparency sake.


Locally and development

  1. Install NodeJS
    • On Mac: brew install node
  2. Install MongoDB
    • On Mac: brew install mongo
  3. Run Mongo: mongod --config /usr/local/etc/mongod.conf
    • On Mac: brew services start mongodb
  4. Create database; use mongo to open mongo shell. use electionland
  5. Get code: git clone ... && cd landslide
  6. Install dependencies: npm install
  7. See Configuration


  • Run application with: node index.js
    • For development, turn on all debugging: DEBUG=* node index.js
  • Run scheduling task with: node scheduler.js


The following steps were taken to deploy on Heroku

  1. Install Heroku command line tools.
  2. Create app: heroku apps:create landslide
  3. MongoLab DB (set type as needed): heroku addons:create mongolab:shared-cluster-2
  4. Set configuration for the application like heroku config:set SLACK_CLIENT_ID=XXXX. See configuration below for all options.
  5. Push code: git push heroku master
  6. Scale web (as needed): heroku ps:scale web=1:performance-m
  7. Scale clock/scheduler (as needed): heroku ps:scale clock=1:standard-1x


These are optional but helpful for election day.

  • To be able to scale horizontally, the session handling and caching needs to be centralized. Use Redis.
    • Heroku add-on: heroku addons:create heroku-redis:premium-2
  • New Relic for monitoring.
    • Heroku add-on: heroku addons:create newrelic:hawke
    • Will need to set NEW_RELIC_NO_CONFIG_FILE to true and NEW_RELIC_APP_NAME to whatever. Without these, the application will not load New Relic. See config instructions for more details.
  • Papertrail for easier log viewing.
    • Heroku add-on: heroku addons:create papertrail:ludvig
  • Load testing with
    • Heroku add-on: heroku addons:create loaderio:basic
    • Set LOADERIO_VERIFY_TOKEN to the host's verify token.


To actually run the application, you will need to configure certain things, specifically with application keys and secrets and the what not. These should be stored in environment variables, or in an .env file.

  • SLACK_USERS_PRIVATE: Comma-separated list of slack emails that can view private (Election Protection) data. For some reason, the basic identity information with Slack Sign-in doesn't provide username, hence the use of emails.
  • HELLO_VOTE_KEY: API key for incoming HelloVote data.
  • FETCH_INTERVAL_SECONDS: Number of seconds to wait in between fetches.
  • FETCH_SINCE_MINUTES: Number of minutes to look back with each fetch (after the first one), i.e. get data in the past hour.
  • MONGODB_URI: Should be something like mongodb://localhost:27017/electionland or what is provided by the MonogoLab Heroku addon.
  • NODE_ENV: Set to test and fake data will be put into the database, and the database name will be appended with -test. Otherwise, use development or production.
  • DEBUG: Debug level via debug. For development, * will debug all. For production, some level might be helpful such as: db,api,server,index,scheduler,data:*