diff options
Diffstat (limited to 'conf')
-rw-r--r-- | conf/apache-vhost.conf.example | 34 | ||||
-rw-r--r-- | conf/crontab.example | 32 | ||||
-rw-r--r-- | conf/crontab.ugly | 21 | ||||
-rw-r--r-- | conf/general.yml-example | 10 | ||||
-rw-r--r-- | conf/httpd.conf-example | 40 | ||||
-rw-r--r-- | conf/nginx.conf.example | 75 | ||||
-rw-r--r-- | conf/packages.ubuntu-precise | 16 | ||||
-rwxr-xr-x | conf/sysvinit.example | 53 |
8 files changed, 234 insertions, 47 deletions
diff --git a/conf/apache-vhost.conf.example b/conf/apache-vhost.conf.example new file mode 100644 index 000000000..97a34fe66 --- /dev/null +++ b/conf/apache-vhost.conf.example @@ -0,0 +1,34 @@ +# An example Apache virtualhost configuration file. +# +# See our installation help at http://code.fixmystreet.com/ + +<VirtualHost *:80> + ServerName fixmystreet.yourservername + DocumentRoot /home/yourname/fixmystreet/web/ + + # Pull in the specific config + Include /home/yourname/fixmystreet/conf/httpd.conf + + <Directory /home/yourname/fixmystreet/web> + # You also need to enable cgi files to run as CGI scripts. For example: + # on production servers these are run under fastcgi + Options +ExecCGI + AddHandler cgi-script .cgi + AllowOverride None + </Directory> + + <Location /admin> + # + # WARNING - enable auth here on production machine + # + </Location> + + Alias /admin/ /home/yourname/fixmystreet/web-admin/ + + Alias /jslib/ /home/yourname/fixmystreet/commonlib/jslib/ + <Location /jslib> + AddOutputFilter DEFLATE js + Header append Cache-Control "no-transform" + </Location> + +</VirtualHost> diff --git a/conf/crontab.example b/conf/crontab.example new file mode 100644 index 000000000..47c018573 --- /dev/null +++ b/conf/crontab.example @@ -0,0 +1,32 @@ +# Timed tasks for FixMyStreet. + +# This is an example crontab that you may want to use as a basis for +# one on your own server. You should replace $FMS with the path to the +# clone of the FixMyStreet repository that you are using. You should +# also replace $LOCK_DIR with a writeable directory for the lock files. + +# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. +# Email: matthew@mysociety.org. WWW: http://www.mysociety.org/ + +PATH=/usr/local/bin:/usr/bin:/bin + +# send-reports has three rows so that its 8am entry can be run with --verbose to send a morning summary of anything that's gone wrong +5,10,15,20,25,30,35,40,45,50,55 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$FMS/send-reports.lock" "$FMS/bin/cron-wrapper send-reports" || echo "stalled?" +0 0-7,9-23 * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-reports.lock" "$FMS/bin/cron-wrapper send-reports" || echo "stalled?" +0 8 * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-reports.lock" "$FMS/bin/cron-wrapper send-reports --verbose" || echo "stalled?" + +2 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-alerts.lock" "$FMS/bin/cron-wrapper send-alerts" || echo "stalled?" +0,30 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-questionnaires.lock" "$FMS/bin/cron-wrapper send-questionnaires" || echo "stalled?" +5,10,15,20,25,30,35,40,45,50,55 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/send-comments.lock" "$FMS/bin/cron-wrapper send-comments" || echo "stalled?" +5,10,15,20,25,30,35,40,45,50,55 * * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/fetch-comments.lock" "$FMS/bin/cron-wrapper fetch-comments" || echo "stalled?" + +0 0-7,9-23 * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/open311-populate-service-list.lock" "$FMS/bin/cron-wrapper open311-populate-service-list" || echo "stalled?" +0 8 * * * "$FMS/commonlib/bin/run-with-lockfile.sh" -n "$LOCK_DIR/open311-populate-service-list.lock" "$FMS/bin/cron-wrapper open311-populate-service-list --warn" || echo "stalled?" + +# Once an hour, update the all reports stats +13 * * * * "$FMS/bin/cron-wrapper" update-all-reports + +# Once a day on all servers +39 2 * * * "$FMS/bin/problems-filed-graph" +43 2 * * * "$FMS/bin/problem-creation-graph" +00 8 * * * "$FMS/bin/check-for-zombies" $UNIX_USER diff --git a/conf/crontab.ugly b/conf/crontab.ugly index 63f2bbdd9..1a7236a2d 100644 --- a/conf/crontab.ugly +++ b/conf/crontab.ugly @@ -16,23 +16,26 @@ MAILTO=!!(*= $user *)!!@mysociety.org # On only one server !!(* if ($vhost eq 'reportemptyhomes.com') { *)!! -5,10,15,20,25,30,35,40,45,50,55 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-reports.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-reports" || echo "stalled?" -0 0-11,13-23 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-reports.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-reports" || echo "stalled?" -0 12 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-reports.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-reports --verbose" || echo "stalled?" +*/5 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-reports.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-reports --verbose" || echo "stalled?" #2 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-alerts.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-alerts" || echo "stalled?" 0,30 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-questionnaires.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-questionnaires" || echo "stalled?" -!!(* } elsif (($vhost eq 'www.fixmystreet.com') || ($vhost eq 'bromley.test.mysociety.org') || ($vhost eq 'stevenage.test.mysociety.org') || ($vhost eq 'integration-staging.fixmystreet.com')) { *)!! +!!(* } elsif (($vhost eq 'www.fixmystreet.com') || ($vhost eq 'bromley.test.mysociety.org') || ($vhost eq 'barnet.fixmystreet.staging.mysociety.org') || ($vhost eq 'fixmybarangay.test.mysociety.org') || ($vhost eq 'demo.fixmybarangay.com') || ($vhost eq 'stevenage.test.mysociety.org')) { *)!! 5,10,15,20,25,30,35,40,45,50,55 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-reports.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-reports" || echo "stalled?" -0 0-8,10,11,13,14,16,17,19-23 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-reports.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-reports" || echo "stalled?" -0 9,12,15,18 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-reports.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-reports --verbose" || echo "stalled?" +0 0-7,9-11,13-15,17-23 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-reports.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-reports" || echo "stalled?" +0 8,12,16 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-reports.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-reports --verbose" || echo "stalled?" 2 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-alerts.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-alerts" || echo "stalled?" 0,30 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-questionnaires.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-questionnaires" || echo "stalled?" 5,10,15,20,25,30,35,40,45,50,55 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/send-comments.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper send-comments" || echo "stalled?" -5,10,15,20,25,30,35,40,45,50,55 0,2-23 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/fetch-comments.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper fetch-comments" || echo "stalled?" -10,15,20,25,30,35,40,45,50,55 1 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/fetch-comments.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper fetch-comments" || echo "stalled?" + +5,10,15,20,25,30,35,40,45,50,55 0-7,9-23 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/fetch-comments.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper fetch-comments" || echo "stalled?" +10,15,20,25,30,35,40,45,50,55 8 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/fetch-comments.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper fetch-comments" || echo "stalled?" +5 8 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/fetch-comments.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper fetch-comments --verbose" || echo "stalled?" 5 1 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/fetch-comments.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper fetch-comments-24hs" || echo "stalled?" -0,30 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/open311-populate-service-list.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper open311-populate-service-list" || echo "stalled?" + +30 * * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/open311-populate-service-list.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper open311-populate-service-list" || echo "stalled?" +0 0-7,9-23 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/open311-populate-service-list.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper open311-populate-service-list" || echo "stalled?" +0 8 * * * !!(*= $user *)!! run-with-lockfile -n /data/vhost/!!(*= $vhost *)!!/open311-populate-service-list.lock "/data/vhost/!!(*= $vhost *)!!/fixmystreet/bin/cron-wrapper open311-populate-service-list --warn" || echo "stalled?" !!(* } *)!! diff --git a/conf/general.yml-example b/conf/general.yml-example index fd9ecad21..8d5018362 100644 --- a/conf/general.yml-example +++ b/conf/general.yml-example @@ -36,6 +36,10 @@ EXAMPLE_PLACES: [ 'High Street', 'Main Street' ] LANGUAGES: - 'en-gb,English,en_GB' +# If you're running an installation that is being used in a different time zone +# from the server, you can set the time zone here (standard time zone string) +TIME_ZONE: "" + # File locations for uploaded photos and cached geocoding results. UPLOAD_DIR: '../upload/' GEO_CACHE: '../cache/' @@ -127,9 +131,12 @@ GAZE_URL: 'http://gaze.mysociety.org/gaze' # Should problem reports link to the council summary pages? AREA_LINKS_FROM_PROBLEMS: '0' -# Used to override the STAGING SERVER safety mechanism in send-reports +# used to override the STAGING SERVER safety mechanism in send-reports TESTING_COUNCILS: '' +# if you're using Message Manager, include the URL here (see https://github.com/mysociety/message-manager/) +MESSAGE_MANAGER_URL: '' + # ----------------------------------------------------------------------- # fixmystreet.com specific config variables. You won't need any of these. @@ -139,4 +146,3 @@ LONDON_REPORTIT_KEY: '' LONDON_REPORTIT_SECRET: '' AUTH_SHARED_SECRET: '' HEARFROMYOURMP_BASE_URL: '' - diff --git a/conf/httpd.conf-example b/conf/httpd.conf-example index e7900161e..ab17dcec3 100644 --- a/conf/httpd.conf-example +++ b/conf/httpd.conf-example @@ -1,42 +1,10 @@ # Apache configuration for FixMyStreet. # -# Add lines something like this to your /etc/apache2/sites-enabled/fixmystreet - -# replacing '/home/yourname/fixmystreet' with the path to your install +# This file should be included in an Apache <VirtualHost> section. An +# example of such a virtualhost configuration file can be found in the +# file apache-vhost.conf.example in this directory. # -# # FixMyStreet -# <VirtualHost *:80> -# ServerName fixmystreet.yourservername -# DocumentRoot /home/yourname/fixmystreet/web/ -# -# # Pull in the specific config -# Include /home/yourname/fixmystreet/conf/httpd.conf -# -# <Directory /home/yourname/fixmystreet/web> -# # You also need to enable cgi files to run as CGI scripts. For example: -# # on production servers these are run under fastcgi -# Options +ExecCGI -# AddHandler cgi-script .cgi -# AllowOverride None -# </Directory> -# -# <Location /admin> -# # -# # WARNING - enable auth here on production machine -# # -# Options +ExecCGI -# AddHandler cgi-script .cgi -# </Location> -# -# Alias /admin/ /home/yourname/fixmystreet/web-admin/ -# -# Alias /jslib/ "/home/yourname/fixmystreet/commonlib/jslib/" -# -# </VirtualHost> -# -# -# Copyright (c) 2011 UK Citizens Online Democracy. All rights reserved. -# Email: team@mysociety.org -# WWW: http://www.mysociety.org +# See our installation help at http://code.fixmystreet.com/ RewriteEngine on # RewriteLog /var/log/apache2/rewrite.log diff --git a/conf/nginx.conf.example b/conf/nginx.conf.example new file mode 100644 index 000000000..7b26afdbf --- /dev/null +++ b/conf/nginx.conf.example @@ -0,0 +1,75 @@ +# An example configuration for running FixMyStreet under nginx. You +# will also need to set up the FixMyStreet Catalyst FastCGI backend. +# An example sysvinit script to help with this is shown given in the file +# sysvinit-catalyst-fastcgi.example in this directory. +# +# See our installation help at http://code.fixmystreet.com/ + +server { + + access_log /var/www/fixmystreet/logs/access.log; + error_log /var/www/fixmystreet/logs/error.log; + + listen 80; + root /var/www/fixmystreet/fixmystreet/web; + error_page 503 /down.html; + + # Make sure that Javascript and CSS are compressed. (HTML is + # already compressed under the default configuration of the nginx + # package.) + + gzip on; + gzip_disable "msie6"; + gzip_types application/javascript application/x-javascript text/css; + + # Set a long expiry time for CSS and Javascript, and prevent + # the mangling of Javascript by proxies: + + location ~ \.css$ { + expires 10y; + } + + location ~ \.js$ { + add_header Cache-Control no-transform; + expires 10y; + try_files $uri @catalyst; + } + + # These rewrite rules are ported from the Apache configuration in + # conf/httpd.conf + + rewrite ^/rss/council/([0-9]+)$ /rss/reports/$1 permanent; + rewrite ^/report$ /reports permanent; + rewrite '^/{/rss/(.*)}$' /rss/$1 permanent; + rewrite '^/reports/{/rss/(.*)}$' /rss/$1 permanent; + rewrite ^/alerts/?$ /alert permanent; + + location /mapit { + proxy_pass http://mapit.mysociety.org/; + proxy_set_header X-Real-IP $remote_addr; + } + + location /admin { + auth_basic "FixMyStreet admin interface"; + auth_basic_user_file /var/www/fixmystreet/admin-htpasswd; + try_files $uri @catalyst; + } + + location / { + if (-f $document_root/down.html) { + return 503; + } + try_files $uri @catalyst; + } + + location /down.html { + internal; + } + + location @catalyst { + include /etc/nginx/fastcgi_params; + fastcgi_param PATH_INFO $fastcgi_script_name; + fastcgi_param SCRIPT_NAME ''; + fastcgi_pass 127.0.0.1:9000; + } +} diff --git a/conf/packages.ubuntu-precise b/conf/packages.ubuntu-precise new file mode 100644 index 000000000..fc8a7d511 --- /dev/null +++ b/conf/packages.ubuntu-precise @@ -0,0 +1,16 @@ +make +jhead +liberror-perl +liblocale-gettext-perl +libsoap-lite-perl +memcached +perl +perlmagick +libmath-bigint-gmp-perl +gettext +libhaml-ruby +postgresql-9.1 +postgresql-server-dev-9.1 +gnuplot +ttf-bitstream-vera +libexpat1-dev diff --git a/conf/sysvinit.example b/conf/sysvinit.example new file mode 100755 index 000000000..44424281b --- /dev/null +++ b/conf/sysvinit.example @@ -0,0 +1,53 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: application-catalyst-fixmystreet +# Required-Start: $local_fs $network +# Required-Stop: $local_fs $network +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Starts the FastCGI app server for the "FixMyStreet" site +# Description: The FastCGI application server for the "FixMyStreet" site +### END INIT INFO + +# This example sysvinit script is based on the helpful example here: +# http://richard.wallman.org.uk/2010/02/howto-deploy-a-catalyst-application-using-fastcgi-and-nginx/ + +PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin +SITE_HOME=/var/www/fixmystreet +NAME=fixmystreet +DESC="FixMyStreet app server" +USER=fms + +echo $DAEMON +test -f $DAEMON || exit 0 + +set -e + +start_daemon() { + su -l -c "cd $SITE_HOME/fixmystreet && bin/cron-wrapper web/fixmystreet_app_fastcgi.cgi -d -l :9000 -n 2" $USER +} + +stop_daemon() { + pkill -f perl-fcgi -u $USER || true +} + +case "$1" in + start) + start_daemon + ;; + stop) + stop_daemon + ;; + reload|restart|force-reload) + stop_daemon + sleep 5 + start_daemon + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|reload|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 |