aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
Diffstat (limited to 'config')
-rw-r--r--config/crontab.ugly4
-rw-r--r--config/environment.rb8
-rw-r--r--config/environments/test.rb3
-rw-r--r--config/general.yml118
-rw-r--r--config/general.yml-example13
-rw-r--r--config/httpd.conf3
-rw-r--r--config/packages1
-rw-r--r--config/routes.rb5
-rw-r--r--config/test.yml11
-rw-r--r--config/varnish-alaveteli.vcl6
10 files changed, 42 insertions, 130 deletions
diff --git a/config/crontab.ugly b/config/crontab.ugly
index 5f2fbdb3b..a22d5afd7 100644
--- a/config/crontab.ugly
+++ b/config/crontab.ugly
@@ -10,7 +10,7 @@ PATH=/usr/local/bin:/usr/bin:/bin
MAILTO=cron-!!(*= $site *)!!@mysociety.org
# Every 5 minutes
-*/5 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/update-xapian-index.lock /data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/update-xapian-index || echo "stalled?"
+*/5 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/change-xapian-database.lock "/data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/update-xapian-index verbose=true" >> /data/vhost/!!(*= $vhost *)!!/logs/update-xapian-index.log || echo "stalled?"
# Every 10 minutes
5,15,25,35,45,55 * * * * !!(*= $user *)!! /etc/init.d/foi-alert-tracks check
@@ -28,7 +28,7 @@ MAILTO=cron-!!(*= $site *)!!@mysociety.org
2 4 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/check-recent-requests-sent.lock /data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/check-recent-requests-sent || echo "stalled?"
45 3 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/stop-new-responses-on-old-requests.lock /data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/stop-new-responses-on-old-requests || echo "stalled?"
# Only root can restart apache
-31 1 * * * root run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/compact-xapian-database.lock "/data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/compact-xapian-database production" || echo "stalled?"
+31 1 * * * root run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/change-xapian-database.lock "/data/vhost/!!(*= $vhost *)!!/!!(*= $vcspath *)!!/script/compact-xapian-database production" || echo "stalled?"
# Once a day on all servers
diff --git a/config/environment.rb b/config/environment.rb
index d15ee9a0e..f2164f1c8 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -131,6 +131,9 @@ I18n.locale = default_locale
I18n.available_locales = available_locales.map {|locale_name| locale_name.to_sym}
I18n.default_locale = default_locale
+# Customise will_paginate URL generation
+WillPaginate::ViewHelpers.pagination_options[:renderer] = 'WillPaginateExtension::LinkRenderer'
+
# Load monkey patches and other things from lib/
require 'ruby19.rb'
require 'tmail_extensions.rb'
@@ -139,10 +142,13 @@ require 'timezone_fixes.rb'
require 'use_spans_for_errors.rb'
require 'make_html_4_compliant.rb'
require 'activerecord_errors_extensions.rb'
-require 'willpaginate_hack.rb'
+require 'willpaginate_extension.rb'
require 'sendmail_return_path.rb'
require 'tnef.rb'
require 'i18n_fixes.rb'
require 'rack_quote_monkeypatch.rb'
require 'world_foi_websites.rb'
require 'alaveteli_external_command.rb'
+
+ExceptionNotification::Notifier.sender_address = MySociety::Config::get('EXCEPTION_NOTIFICATIONS_FROM')
+ExceptionNotification::Notifier.exception_recipients = MySociety::Config::get('EXCEPTION_NOTIFICATIONS_TO')
diff --git a/config/environments/test.rb b/config/environments/test.rb
index 8058487ad..be28c3df6 100644
--- a/config/environments/test.rb
+++ b/config/environments/test.rb
@@ -1,5 +1,7 @@
# Settings specified here will take precedence over those in config/environment.rb
+require 'lib/patches/fixtures_constraint_disabling'
+
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
@@ -18,6 +20,7 @@ config.action_controller.perform_caching = false
# ActionMailer::Base.deliveries array.
config.action_mailer.delivery_method = :test
config.gem 'rspec-rails', :version => '>= 1.3.3', :lib => false unless File.directory?(File.join(Rails.root, 'vendor/plugins/rspec-rails'))
+config.gem 'fakeweb', :version => '>=1.3.0'
# Disable request forgery protection in test environment
config.action_controller.allow_forgery_protection = false
diff --git a/config/general.yml b/config/general.yml
deleted file mode 100644
index 7c70f8e71..000000000
--- a/config/general.yml
+++ /dev/null
@@ -1,118 +0,0 @@
-# general.yml-example:
-# Example values for the "general" config file.
-#
-# Configuration parameters, in YAML syntax.
-#
-# Copy this file to one called "general.yml" in the same directory. Or
-# have multiple config files and use a symlink to change between them.
-
-# Site name appears in various places throughout the site
-SITE_NAME: 'Alaveteli'
-
-# Domain used in URLs generated by scripts (e.g. for going in some emails)
-DOMAIN: 'localhost:3000'
-
-# ISO country code of country currrently deployed in
-# (http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
-ISO_COUNTRY_CODE: DE
-
-# These feeds are displayed accordingly on the Alaveteli "blog" page:
-BLOG_FEED: 'http://www.mysociety.org/category/projects/whatdotheyknow/feed/'
-TWITTER_USERNAME: 'alaveteli_foi'
-
-# Locales we wish to support in this app, space-delimited
-AVAILABLE_LOCALES: 'en'
-DEFAULT_LOCALE: 'en'
-
-# if 'true', respect the user's choice of language in the browser
-USE_DEFAULT_BROWSER_LANGUAGE: true
-
-# How many days should have passed before an answer to a request is officially late?
-REPLY_LATE_AFTER_DAYS: 20
-REPLY_VERY_LATE_AFTER_DAYS: 40
-# We give some types of authority like schools a bit longer than everyone else
-SPECIAL_REPLY_VERY_LATE_AFTER_DAYS: 60
-
-# example searches for the home page, semicolon delimited.
-FRONTPAGE_SEARCH_EXAMPLES: 'Geraldine Quango; Department for Humpadinking'
-
-# example public bodies for the home page, semicolon delimited - short_names
-FRONTPAGE_PUBLICBODY_EXAMPLES: 'tgq'
-
-# URL of theme to install (when running rails-post-deploy script)
-THEME_URL: 'git://github.com/sebbacon/alavetelitheme.git'
-
-
-## Incoming email
-# Your email domain, e.g. 'foifa.com'
-INCOMING_EMAIL_DOMAIN: 'localhost'
-
-# An optional prefix to help you distinguish FOI requests, e.g. 'foi+'
-INCOMING_EMAIL_PREFIX: ''
-
-# used for hash in request email address
-INCOMING_EMAIL_SECRET: 'xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx'
-
-# used as envelope from at the incoming email domain for cases where we don't care about failure
-BLACKHOLE_PREFIX: 'do-not-reply-to-this-address'
-
-## Administration
-
-# Leave these two blank to skip admin authorisation
-ADMIN_USERNAME: 'asd'
-ADMIN_PASSWORD: 'qwe'
-
-# Email "from" details
-CONTACT_EMAIL: 'postmaster@localhost'
-CONTACT_NAME: 'Alaveteli Webmaster'
-
-# Where the raw incoming email data gets stored; make sure you back
-# this up!
-RAW_EMAILS_LOCATION: 'files/raw_emails'
-
-# The base URL for admin pages. You probably don't want to change this.
-ADMIN_BASE_URL: '/admin/'
-
-# Where /stylesheets sits under for admin pages. See asset_host in
-# config/environment.rb. Can be full domain or relative path (not an
-# absolute path beginning with /). Again, unlikely to want to change
-# this.
-ADMIN_PUBLIC_URL: ''
-
-# Secret key for signing cookie_store sessions
-COOKIE_STORE_SESSION_SECRET: 'your secret key here, make it long and random'
-
-# If present, puts the site in read only mode, and uses the text as reason
-# (whole paragraph). Please use a read-only database user as well, as it only
-# checks in a few obvious places.
-READ_ONLY: ''
-
-# Doesn't do anything right now.
-STAGING_SITE: 1
-
-# Recaptcha, for detecting humans. Get keys here: http://recaptcha.net/whyrecaptcha.html
-RECAPTCHA_PUBLIC_KEY: '6LcsnMcSAAAAAAL4FqMix7IOsEIwdMh42MuOFztv'
-RECAPTCHA_PRIVATE_KEY: '6LcsnMcSAAAAAFjbWcf2dI874as0fmYSAiC9Jgvx'
-
-# For debugging memory problems. If true, the app logs
-# the memory use increase of the Ruby process due to the
-# request (Linux only). Since Ruby never returns memory to the OS, if the
-# existing process previously served a larger request, this won't
-# show any consumption for the later request.
-DEBUG_RECORD_MEMORY: false
-
-# If you have Alaveteli set up behind an HTTP caching proxy
-# (accelerator) like Varnish or Squid, you can cause the application
-# to purge selected URLs by setting these two variables (see
-# `../doc/CACHING.md` for details)
-ACCELERATOR_HOST: 'localhost'
-ACCELERATOR_PORT: '6081'
-
-# mySociety's gazeteer service. Shouldn't change.
-GAZE_URL: http://gaze.mysociety.org
-
-# Path to a program that converts a page at a URL to HTML. It should
-# take two arguments: the URL, and a path to an output file. A static
-# binary of wkhtmltopdf is recommended:
-# http://code.google.com/p/wkhtmltopdf/downloads/list
-HTML_TO_PDF_COMMAND: /usr/local/bin/wkhtmltopdf-amd64 \ No newline at end of file
diff --git a/config/general.yml-example b/config/general.yml-example
index 8c59b1b0e..98f04d0bf 100644
--- a/config/general.yml-example
+++ b/config/general.yml-example
@@ -35,7 +35,7 @@ SPECIAL_REPLY_VERY_LATE_AFTER_DAYS: 60
FRONTPAGE_PUBLICBODY_EXAMPLES: 'tgq'
# URL of theme to install (when running rails-post-deploy script)
-THEME_URL: 'git://github.com/mysociety/whatdotheyknow-theme.git'
+THEME_URL: 'git://github.com/sebbacon/alavetelitheme.git'
# Whether a user needs to sign in to start the New Request process
FORCE_REGISTRATION_ON_NEW_REQUEST: false
@@ -129,4 +129,13 @@ FORWARD_NONBOUNCE_RESPONSES_TO: user-support@localhost
# http://code.google.com/p/wkhtmltopdf/downloads/list
# If the command is not present, a text-only version will be rendered
# instead.
-HTML_TO_PDF_COMMAND: /usr/local/bin/wkhtmltopdf-amd64 \ No newline at end of file
+HTML_TO_PDF_COMMAND: /usr/local/bin/wkhtmltopdf-amd64
+
+# Exception notifications
+EXCEPTION_NOTIFICATIONS_FROM: do-not-reply-to-this-address@example.com
+EXCEPTION_NOTIFICATIONS_TO:
+ - robin@example.org
+ - seb@example.org
+
+# This rate limiting can be turned off per-user via the admin interface
+MAX_REQUESTS_PER_USER_PER_DAY: 6
diff --git a/config/httpd.conf b/config/httpd.conf
index 47e7f9c72..3bbe50fb3 100644
--- a/config/httpd.conf
+++ b/config/httpd.conf
@@ -34,10 +34,11 @@ RewriteRule /files/(.+) http://files.whatdotheyknow.com/$1
<IfModule mod_passenger.c>
# Set this to something like 100 if you have memory leak issues
- PassengerMaxRequests 0
+ PassengerMaxRequests 20
PassengerResolveSymlinksInDocumentRoot on
# Recommend setting this to 3 or less on servers with 512MB RAM
PassengerMaxPoolSize 6
+ RailsEnv production
</IfModule>
# Gzip font resources
diff --git a/config/packages b/config/packages
index a42785824..76a5c29d6 100644
--- a/config/packages
+++ b/config/packages
@@ -41,3 +41,4 @@ rubygems
libfcgi-dev
gettext
python-yaml
+wkhtmltopdf-static
diff --git a/config/routes.rb b/config/routes.rb
index 511b5fc1e..c4339209a 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -26,7 +26,7 @@ ActionController::Routing::Routes.draw do |map|
# Couldn't find a way to do this in routes which also picked up multiple other slashes
# and dots and other characters that can appear in search query. So we sort it all
# out in the controller.
- general.search_general '/search/*combined/requests', :action => 'search', :view => 'requests'
+ general.search_general '/search/*combined/all', :action => 'search', :view => 'all'
general.search_general '/search/*combined', :action => 'search'
general.advanced_search '/advancedsearch', :action => 'search_redirect', :advanced => true
@@ -78,6 +78,8 @@ ActionController::Routing::Routes.draw do |map|
user.confirm '/c/:email_token', :action => 'confirm'
user.show_user '/user/:url_name.:format', :action => 'show'
+ user.show_user_profile '/user/:url_name/profile.:format', :action => 'show', :view => 'profile'
+ user.show_user_requests '/user/:url_name/requests.:format', :action => 'show', :view => 'requests'
user.contact_user '/user/contact/:id', :action => 'contact'
user.signchangepassword '/profile/change_password', :action => 'signchangepassword'
@@ -167,6 +169,7 @@ ActionController::Routing::Routes.draw do |map|
body.admin_body_create '/admin/body/create/:id', :action => 'create'
body.admin_body_destroy '/admin/body/destroy/:id', :action => 'destroy'
body.admin_body_import_csv '/admin/body/import_csv', :action => 'import_csv'
+ body.admin_body_mass_tag_add '/admin/body/mass_tag_add', :action => 'mass_tag_add'
end
map.with_options :controller => 'admin_general' do |admin|
diff --git a/config/test.yml b/config/test.yml
index c13b9c9db..6a423b47a 100644
--- a/config/test.yml
+++ b/config/test.yml
@@ -10,7 +10,7 @@
SITE_NAME: 'Alaveteli'
# Domain used in URLs generated by scripts (e.g. for going in some emails)
-DOMAIN: 'localhost:3000'
+DOMAIN: 'test.localdomain'
# ISO country code of country currrently deployed in
# (http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
@@ -115,4 +115,11 @@ GAZE_URL: http://gaze.mysociety.org
# take two arguments: the URL, and a path to an output file. A static
# binary of wkhtmltopdf is recommended:
# http://code.google.com/p/wkhtmltopdf/downloads/list
-HTML_TO_PDF_COMMAND: /usr/local/bin/wkhtmltopdf-amd64 \ No newline at end of file
+HTML_TO_PDF_COMMAND: /usr/local/bin/wkhtmltopdf-amd64
+
+# Exception notifications
+EXCEPTION_NOTIFICATIONS_FROM: do-not-reply-to-this-address@example.com
+EXCEPTION_NOTIFICATIONS_TO:
+
+MAX_REQUESTS_PER_USER_PER_DAY: 2
+
diff --git a/config/varnish-alaveteli.vcl b/config/varnish-alaveteli.vcl
index 3312c381b..7eedf83fc 100644
--- a/config/varnish-alaveteli.vcl
+++ b/config/varnish-alaveteli.vcl
@@ -27,9 +27,9 @@ sub vcl_recv {
remove req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;
- # Remove has_js and Google Analytics cookies.
- set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(__[a-z]+|has_js)=[^;]*", "");
-
+ # Remove Google Analytics, has_js, and last-seen cookies
+ set req.http.Cookie = regsuball(req.http.Cookie, "(^|;\s*)(__[a-z]+|has_js|has_seen_country_message|seen_foi2)=[^;]*", "");
+
# Normalize the Accept-Encoding header
if (req.http.Accept-Encoding) {
if (req.url ~ "\.(jpg|jpeg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf|flv|pdf|ico)$") {