Skip to content
This repository has been archived by the owner on Mar 15, 2021. It is now read-only.

openregister/registers-frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

Registers Frontend

Frontend for GOV.UK Registers

Prerequisites

  1. Install Ruby 2.5.7
  2. Install Rails 5.2.2
  3. Install PostgreSQL 9.6+
  4. Install Node 10+

Installing and running locally

Download the GOV.UK frontend design system

$ npm install

Install the gem dependencies and setup the postgresql database

$ bundle install
$ rails db:setup
$ rake registers_frontend:populate_db:fetch_now
$ rails server

You can access the CMS via http://localhost:3000/admin

Running with Docker

Instead of the above, you can use Docker as follows:

$ docker-compose build
$ docker-compose run --rm web rails db:setup
$ docker-compose run --rm web rake registers_frontend:populate_db:fetch_now
$ docker-compose up -d

And access it normally via http://localhost:3000

To stop it, run docker-compose stop.

NOTE: If you have changed your working directory (e.g. checkout a branch, edit a file) you have to rerun docker-compose build before running docker-compose up -d to ensure all changes are picked up.

Zendesk

If you need to use the Zendesk service you need to add 3 environment variables

  1. ZENDESK_TOKEN
  2. ZENDESK_URL
  3. ZENDESK_USERNAME

Populating the database with register data on PaaS

prod

When running in production the registers-frontend-scheduler app periodically calls rake registers_frontend:populate_db:fetch_later which adds a job to a queue maintained by the registers-frontend-queue app. When the job runs it refreshes the data for all registers listed in the database.

sandbox

It's also possible to manually populate the database without running the registers-frontend-scheduler and registers-frontend-queue apps using cf run-task. This may fail for large registers if the task runs out of memory. We might do this for a registers-frontend-research app for example.

cf run-task registers-frontend-research "bundle exec rake registers_frontend:populate_db:fetch_now" -m 1G --name fetch

Then you can see the result of the task using:

cf tasks registers-frontend-research
cf logs registers-frontend-research | grep fetch

License

MIT.