Skip to content

SarahAllett/parliament.uk-prototype

 
 

Repository files navigation

Parliament.uk prototype

Parliament.uk prototype is a Rails 5 application designed to be the beginnings of a new parliament.uk website and API.

Build Gemnasium License

Contents

Requirements

Parliament.uk prototype requires the following:

Getting Started

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

Running the application

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.

Member Service API?

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.

Running with Foreman and a Local Version of the API

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?

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.

Running the application standalone, without an API

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 remote API_ENDPOINT and API_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.

Running the tests

We use RSpec as our testing framework and tests can be run using:

bundle exec rspec

Running the application using Docker Compose

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.

Contributing

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.

  1. Fork the repository
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License

Parliament.uk Prototype is licensed under the Open Parliament Licence.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 70.3%
  • HTML 26.1%
  • Makefile 2.6%
  • Other 1.0%