Navigation Menu

Skip to content

UKGovernmentBEIS/beis-report-official-development-assistance

Repository files navigation

Build Status Coverage Status

Report Official Development Assistance (RODA)

This service enables the Department for Business, Energy and Industrial Strategy (BEIS) and their partner organisations to collect and report information on the spending of Official Development Assistance (ODA).

Getting started

First, run the setup script. This installs the required system (assuming you're using OSX and Homebrew), frontend and Ruby dependencies, as well as setting up the test and development databases.

script/setup

Once setup has been completed, you can start the server with

script/server

and the tests should pass

script/test

Creating a development database

See "PaaS to Local" at the end of the Database Backup and Restore guide.

Running backing services with Docker compose

If you prefer not to install the backing services (Postgres and Redis) with Homebrew via the scripts above, run them in the background with Docker and then use standard rails commands to interact with the application (you will need Docker installed on your device):

docker-compose -f backing-services-docker-compose.yml up -d

To stop the backing services:

docker-compose -f backing-services-docker-compose.yml down

Architecture decision records

We use ADRs to document architectural decisions that we make. They can be found in doc/architecture/decisions and contributed to with the adr-tools.

Managing environment variables

We use Dotenv to manage our environment variables locally.

The repository will include safe defaults for development in /.env.example and for test in /.env.test. We use 'example' instead of 'development' (from the Dotenv docs) to be consistent with current dxw conventions and to make it more explicit that the real values are not to be committed.

To manage sensitive environment variables:

  1. Add the new key and safe default value to the /.env.example file eg. ROLLBAR_TOKEN=ROLLBAR_TOKEN
  2. Add the new key and real value to your local /.env.development.local file, which should never be checked into Git. This file will look something like ROLLBAR_TOKEN=123456789

Release process

Our release process is documented locally.

Migrations

Schema

We use conventional Rails migrations to make changes to the schema. This includes setting or changing relevant data.

Schema migrations are applied automatically on deployment via the docker-entrypoint.sh.

Data / One-off tasks

When running a live service sometimes you're required to change existing data in some way. We do this in a similar way to database migrations, using Data Migrations

The migrations are stored in the db/data folder.

  • To generate a migration: rails g data_migration add_this_to_that
  • To run the data migration: rails runner db/data/$FILENAME_OF_THE_GENERATED_MIGRATION

When the new code deploys, you'll need to run your migration on the live service by running a live console.

Access

Dev

The app is currently hosted on AWS ECS clusters provided by BEIS: https://dev.report-official-development-assistance.service.gov.uk

The develop branch is deployed to dev after a successful build via GitHub Actions.

Staging

The app is currently hosted on AWS ECS clusters provided by BEIS: https://staging.report-official-development-assistance.service.gov.uk

The develop branch is deployed to staging after a successful build via GitHub Actions.

Training

The app has a training environment: http://training.report-official-development-assistance.service.gov.uk

The main branch is deployed to the training environment after a successful build via GitHub Actions.

Production

The app is currently hosted on AWS ECS clusters provided by BEIS: https://www.report-official-development-assistance.service.gov.uk

The main branch is deployed to production after a successful build via GitHub Actions.

Email notifications

The service sends email notifications see the documentation for more details.

DNS

The DNS for the service is hosted and managed by dxw the source for which is maintained in this private repo:

https://github.com/dxw/beis-roda-dns

Source

This repository was bootstrapped from dxw's rails-template.

Documentation

Detailed documentation for developers and support staff is found in doc/.