Parliament.uk prototype is a Rails 5 application designed to be the beginnings of a new parliament.uk website and API.
Parliament.uk prototype requires the following:
- Ruby - for the exact version, click here.
- Node
- NPM
Setup the main application repository:
git clone https://github.com/ukparliament/parliament.uk-prototype.git
cd parliament.uk-prototype
bundle install
cp .env.sample .env
There are two options for running the parliament.uk prototype, either with a local version of the member API at the same time, or as a standalone rails application.
Along with this prototype there is a paired member-service-api project. This API's role is to consume data from a triple store and generate .ttl files which our parliament.uk prototype can consume.
NOTE: In order to use foreman to run the API and application together, we are assuming you have the member-service-api project cloned and set-up in the same location as the parliament.uk-prototype project. For example, your folders should look something like the following:
/ (projects root) /parliament.uk-prototype/ (prototype) /member-service-api/ (api)
With this setup, foreman runs the API directly from within the member-service-api directory.
bundle exec foreman start
The application and API should now be viewable in your local browser at http://localhost:3000 (application) and http://localhost:3030 (API). With this setup, you can make changes to the local API repository and test them right away.
Foreman allows us to run multiple applications concurrently, making local development of the Parliament.uk prototype much faster. Using foreman you can make changes to both the member-service-api and prototype in tandem without the need for deployment delays.
NOTE: In order to run the application without a local copy of the member-service-api, you'll need to update your
.env
file to include remoteAPI_ENDPOINT
andAPI_ENDPOINT_HOST
values. The included sample assumes you are running the API locally with foreman.
bundle exec rails s
The application should now be viewable in your local browser at: http://localhost:3000.
We use RSpec as our testing framework and tests can be run using:
bundle exec rspec
To run the application using Docker Compose, make sure that you have checked out the member-service-api project into the same location as the parliament.uk-prototype project as described above in Running with Foreman and a Local Version of the API.
Next create a folder in your home directory called ~/.ukpds
and within this,
create two files:
~/.ukpds/parliament.uk-prototype.env
GTM_KEY=<GTM key>
ASSET_LOCATION_URL=<asset location URL>
~/.ukpds/member-service-api.env
UKPDS_DATA_URI_PREFIX=<UKPDS data URI prefix>
UKPDS_DATA_ENDPOINT=<UKPDS data endpoint URL>
Then in this folder, run docker-compose up
or, if you prefer to run it in the
background, docker-compose up -d
.
You should then be able to access the web application on http://localhost:3000/ and the members' service on http://localhost:3030/ as above.
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
Parliament.uk Prototype is licensed under the Open Parliament Licence.