Parliament.uk-routing is a Varnish application designed to replicate the routing of the Application Load Balancer in the development environment. It handles the routing between the three applications that make up the new parliament.uk website made by the Parliamentary Digital Service.
The parliament.uk-routing application routes between the Utilities, Things and Lists applications based on the url route, following the rules of the Varnish regex in the default.vcl
file.
Parliament.uk-routing requires Docker.
You will also need to have cloned the Utilities, Things and Lists applications locally, within the same directory.
In this application, Docker is dependent on the three rails applications all sitting in the same folder as the Parliament.uk-routing application, so make sure to clone the repository in the same directory as Utilities, Things and Lists. Your folder structure should look like this:
/example_folder
/parliament.uk-lists
/parliament.uk-utilities
/parliament.uk-things
/parliament.uk-routing
You will need environment variables set up locally in order to run the application.
Clone the repository locally using:
git clone https://github.com/ukparliament/parliament.uk-routing.git
cd parliament.uk-routing
Running the application locally is done using docker-compose. In order to set up the application, you will need to run:
docker-compose up --build
This command will build the dependent images and databases including those for the three rails applications, Utilities, Things and Lists.
Once docker has stored these images and containers, you can restart the application by running:
docker-compose up
The application will then be available from http://localhost:80, and the Parliament.uk-routing will automatically route to the three rails applications at http://localhost:3000.
If changes are made to the Gemfile of the three rails applications or to the default.vcl
file within the Parliament.uk-routing, you may need to rebuild Docker's images. In order to do this you can remove containers:
docker rm name_of_container
and remove images:
docker rmi -f name_of_image
for those that will need to be rebuilt.
To rebuild them, you can either rebuild them individually, eg:
docker-compose build utilities.parliament.local
or rebuild the entire set of docker images and databases again, with
docker-compose up --build
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-routing is available as open source under the terms of the Open Parliament Licence.