TechAndCheck / tech-and-check-alerts

Daily tip sheet for fact checkers
MIT License
13 stars 6 forks source link

Build Status

Tech & Check Alerts

A system that sends out a daily tip sheet for fact checkers, developed at the Duke Reporters Lab.

Installation instructions

This is a node project. The version of node is specified in package.json and we recommend the use of nvm for managing your local node versions.

To set up your development environment...

Install dependencies

> yarn install

Set up postgres

This project uses postgres to store its data. You will need to either set up a local copy, or find a hosted solution. Be sure to remember the username and password you set up for this project.

You will need to set up two separate databases: one for testing and one for the actual application. Having a distinct test database is a code-enforced requirement.

Set up redis

This project uses redis as a data store for queues. You will need to set up a local copy, or find a hosted solution.

Configure the project

You will need to configure your environment variables. In production this can be done however your host recommends; in development we recommend using an .env file. A template for the contents of .env is provided in .env.template.

> cp .env.template .env
> vi .env

The database credentials (e.g. DATABASE_URL_DEVELOPMENT and DATABASE_URL_TEST) should match the relevant instances of username and databasename that you set up when installing postgres.

Run Migrations

> yarn migrate

Start the service

> yarn start

Run tests

> yarn test

Or, to start a watcher that runs tests as you change them:

> yarn test:watch

Queues

The primary control flow of this project is handled through jobs and queues. We use bull, which is built on top of redis.

Creating a new queue involves making a new directory in the server/queues folder with the following files:

The best thing to do is look at an existing implemented queue and work from there.

Continuous integration

This project uses Travis CI for continuous integration. This takes the form of:

  1. Automated testing which is run on all pull requests.
  2. Continuous deployment to our staging server for any commit that is merged into the master branch.

For more information about our continuous deployment setup read our CD documentation.

Contributing

If you're interested in contributing to this project: thank you! Contributions are made via pull request. Please be sure to review our contribution guidelines and code of conduct.