Skip to content
RADAR - Rare Disease Registry
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs
extra/logos
migrations
radar
scripts
tests
.coveragerc
.editorconfig
.gitignore
.travis.yml
LICENSE.md
MANIFEST.in
README.md
alembic.ini
build.sh
dev-requirements.txt
example_settings.py
fabfile.py
requirements.txt
setup.py
tox.ini

README.md

Logo

Build Status Code Climate Coveralls

RADAR

This repostitory is the home of the RADAR (Rare Disease Registry) backend. The services include: the REST API (used by the web interface), the UKRDC importer (receives data from the UKRDC), and the UKRDC exporter (sends data to the UKRDC).

Getting Started

Optional: use radar-ansible to create a development VM.

Prerequisites:

Create a user and database for RADAR to use:

CREATE USER radar WITH PASSWORD 'password';
CREATE DATABASE radar;
GRANT ALL PRIVILEGES ON DATABASE radar TO radar;
\c radar
CREATE EXTENSION "uuid-ossp";

-- tests' database
CREATE DATABASE radar_test;
GRANT ALL PRIVILEGES ON DATABASE radar_test TO radar;
\c radar_test
CREATE EXTENSION "uuid-ossp";

Clone the repository:

git clone https://github.com/renalreg/radar.git
cd radar

Install the radar package and its dependencies:

virtualenv venv
. venv/bin/activate
pip install -r dev-requirements.txt
pip install -e .

Create a settings file:

cp example_settings.py settings.py

Create some test data:

RADAR_SETTINGS=/path/to/settings.py radar-fixtures all

Start the API:

RADAR_SETTINGS=/path/to/settings.py radar-api

Overview

Basic Configuration

Basic Data Flow Diagram

UKRR Configuration

UKRR Data Flow Diagram

Test

With tox:

tox

Or using py.test directly:

py.test tests

Build

Before releasing a new build increment the version number in radar/__init__.py and git tag the commit. Only change the version number and deploy to production from the master branch.

Local

Install platter:

virtualenv venv
. venv/bin/activate
pip install git+https://github.com/mitsuhiko/platter

Build:

platter build -r requirements.txt .

This will create a .tar.gz file in the dist folder.

Remote

A remote build is useful when you are developing on a different operating system to the one you want to deploy to.

Install dependencies on the remote machine:

yum install https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7-x86_64/pgdg-centos94-9.4-2.noarch.rpm
yum install postgresql94 postgresql94-libs postgresql94-devel

wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py

pip install git+https://github.com/mitsuhiko/platter

Build:

fab -H $HOSTNAME -u $USER build

The built .tar.gz will be downloaded into the dist folder on the local machine.

Deploy

You'll need to create the /srv/radar folder if it doesn't exist:

ssh nww.radar.nhs.uk mkdir -p /srv/radar

Each deployed version is kept in its own folder in /srv/radar, for example /srv/radar/1.0.0 and /srv/radar/2.0.0. The /srv/radar/current symlink points to the latest version of the code.

Deploy the latest build (.tar.gz in dist) and reload/restart the services:

fab -H nww.radar.nhs.uk -u root deploy

Deploy to multiple servers by separating their hostnames with commas. The --gateway option is useful for tunneling through another server.

Downgrading

For example if you have deployed version 2.0.0 but need to downgrade to version 1.0.0.

If /srv/radar/1.0.0 exists you can simply:

ln -sfn /srv/radar/1.0.0 /srv/radar/current
systemctl reload radar-api

If you still have the .tar.gz file locally:

fab -H nww.radar.nhs.uk -u root deploy:archive=dist/radar-1.0.0-linux-x86_64.tar.gz

Otherwise you'll need to rebuild the .tar.gz:

git checkout tags/v1.0.0
platter build -r requirements.txt .
fab -H nww.radar.nhs.uk -u root deploy:archive=dist/radar-1.0.0-linux-x86_64.tar.gz

Documentation

There is more documentation in the docs folder.

License

Copyright (c) 2016 UK Renal Registry.

Licensed under the AGPL license.

You can’t perform that action at this time.