Note: parliament-prototype has been depreciated. This served as an initial incarnation of the new Parliament Beta website (https://beta.parliament.uk/).
This application has been split into three separate applications, plus a number of gems to bring it closer to our digital principles (https://pds.blog.parliament.uk/2017/08/16/a-technology-strategy-for-parliament/):
Also see the below for additional helper repos
- Getting Started
Parliament.uk Prototype requires the following:
Clone the repository:
git clone https://github.com/ukparliament/parliament.uk-prototype.git cd parliament.uk-prototype
Parliament.uk Prototype is made up of three main components:
There are a number of additional side pieces but for now, these are our main focus.
Parliamentary Data API
In production, there is an API application that serves dynamic data to our Rails application. For local development, we use the parliament.uk-static-api application/docker image.
Using the static application allows us to quickly prototype data responses without a reliance on the internal parliament API.
'Bandiera is a simple, stand-alone feature flagging service' which we use to enable and disable certain features within the parliament application.
We use Bandiera to enable and disable time-boxed states such as dissolution within the application. When enabled, banners display on certain pages of the site.
Parliament Rails Application
This is the Parliament.uk Prototype application itself, the routes, controllers and views that make up our application.
Running the application
Running the application locally is done using docker-compose, but there is a one-off set up command needed the first time:
This command will set up the dependent docker images and databases that the application uses to run.
Once this step has been completed, you can simply run:
Now the three main applications should be available as follows:
- Prototype Rails Application - http://localhost:3000
- Static API - http://localhost:3030
- Bandiera - http://localhost:5000
Running the tests
We use RSpec as our testing framework, and run our tests inside of Docker. Use the below command to run the full suite.
Running them within the running application image
The downside to running
make test is speed, virtually every time, we will be rebuilding the Docker image just to run our tests.
To get around this, whilst developing we can first connect to the running application and run tests within it. The following commands assume you have the application running via
docker-compose exec app /bin/sh bundle exec rake parallel:spec
This will first open an sh terminal within the running application server, then execute the tests right away without the need to re-build the image.
If you wish to submit a bug fix or feature, you can create a pull request and it will be merged pending a code review.
- Fork the repository
- Create your feature branch (
git checkout -b my-new-feature)
- Commit your changes (
git commit -am 'Add some feature')
- Push to the branch (
git push origin my-new-feature)
- Create a new Pull Request