This is the code base for the UK Government's e-petitions service (
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
app Don't show 'signatures by x' on rejected petitions Aug 10, 2018
bin Remove obsolete CSV data script Jun 21, 2017
config Add option to subscribe a signature in the admin Jun 8, 2018
data Use a curated list for example postcodes May 15, 2017
features Add a HTML template for feedback messages Jul 20, 2018
lib Strip hyphens and en/em dashes from the postcode before validating Jul 23, 2018
public Enable Google Webmasters analytics access Oct 30, 2015
.env Pull site defaults from environment variables Jun 17, 2015
.env.development Add the option to geo-block IP addresses Sep 10, 2016
.env.test Add the option to geo-block IP addresses Sep 10, 2016
.gitignore Ignore paperclip test files Jul 17, 2017
.rspec Update testing configuration Apr 28, 2015
Gemfile Use the redcarpet gem to format petition emails Nov 25, 2017
Gemfile.lock Fix bundler version at 1.16.2 Jul 19, 2018
LICENCE.txt Correct copyright notice Feb 16, 2015
Rakefile Update testing configuration Apr 28, 2015 Tweak application to boot on Rails 4.2 Apr 28, 2015


This is the code base for the UK Government's petitions service ( We have open sourced the code for you to use under the terms of licence contained in this repository.

We hope you enjoy it!

A few things to know:

  • You will need ruby 2.2.2
  • You will need PostgreSQL and Memcached

Set up your development environment

  • Clone the repo to your local machine
  • Install postgres. Easiest with homebrew using brew install postgres
    • If you like you can add postgres to your LaunchAgent. Follow instructions at end of console output
  • Set up your dev and test databases
    • $ psql postgres
    • # CREATE DATABASE epets_development;
    • # CREATE DATABASE epets_test;
    • # CREATE USER epets;
    • # GRANT all privileges ON database epets_development TO epets;
    • # GRANT all privileges ON database epets_test TO epets;
    • # ALTER USER epets WITH PASSWORD 'replace_me';
    • # \q to quit
  • You will need to set up the config/database.yml. Copy what is in config/database.example.yml and add the password you used earlier for the epets postgres user
  • $ rake db:structure:load - load the sql structure into your new databases

Run the app

  • rails s

Other info

  • If you want jobs (like emails) to be run, use $ rake jobs:work
  • For setting up a sysadmin user
    • rake epets:add_sysadmin_user - to set up an admin user with email '' and password 'Letmein1!'
    • go to /admin and log in. You will be asked to change your password. Remember, the password must contain a mix of upper and lower case letters, numbers and special characters.