/covid19-tracker

Coronavirus response grants tracker based on data published by UK grantmakers in the 360Giving Data Standard

Primary LanguageCSSGNU General Public License v3.0GPL-3.0

360Giving COVID19 Grants Tracker

360Giving Logo

A tracker for UK grants published to the 360Giving Data Standard, using data from the 360Giving Datastore.

The app is built using Dash by Plotly, which is based around the Flask python web framework and react.

Run development version

python -m venv env # create virtual env
source env/bin/activate # enter virtual environment (`env/Scripts/activate` on windows)
pip install -r requirements.txt # install needed requirements
mv .env-sample .env # rename .env file (linux)

You'll then need to edit the .env file, adding the correct values for DB_URL (the database connection for the 306Giving Datastore) and MAPBOX_TOKEN (which shows the map).

Once the settings are correct you need to fetch the latest data.

flask fetch-data

Finally run the development server

python index.py

Setup using dokku

  1. On server:
dokku apps:create covidtracker
  1. On client:
git remote add dokku dokku@<IPADDRESS>:covidtracker
  1. On server:
# create a persistant directory
mkdir -p  /var/lib/dokku/data/storage/covidtracker
chown -R dokku:dokku /var/lib/dokku/data/storage/covidtracker
chown -R 32767:32767 /var/lib/dokku/data/storage/covidtracker
dokku storage:mount covidtracker /var/lib/dokku/data/storage/covidtracker:/app/storage

# set up settings
dokku config:set covidtracker DB_URI=**DATABASE URL**
dokku config:set covidtracker GOOGLE_ANALYTICS=********
dokku config:set covidtracker PROMETHEUS_AUTH_PASSWORD=********
dokku config:set -no-restart covidtracker DATA_DIR=/app/storage/data
dokku config:set -no-restart covidtracker FLASK_APP=covidtracker.app:server

# set up redis
dokku redis:create covidtrackercache
dokku redis:link covidtrackercache covidtracker

# fetch data
dokku run covidtracker flask fetch-data
dokku run covidtracker flask clear-cache
dokku ps:rebuild covidtracker
  1. Set up cron tab for scheduled tasks (on server)
nano /etc/cron.d/covidtracker