diff options
Diffstat (limited to 'config')
-rwxr-xr-x[-rw-r--r--] | config/alert-tracks-debian.ugly | 13 | ||||
-rw-r--r-- | config/crontab-example | 4 | ||||
-rw-r--r-- | config/deploy.rb | 4 | ||||
-rw-r--r-- | config/general.yml-example | 4 | ||||
-rw-r--r-- | config/packages | 54 | ||||
-rw-r--r-- | config/packages.debian-squeeze | 57 | ||||
-rw-r--r-- | config/packages.debian-wheezy | 36 | ||||
-rw-r--r-- | config/packages.ubuntu-precise | 48 | ||||
-rwxr-xr-x[-rw-r--r--] | config/purge-varnish-debian.ugly | 12 | ||||
-rw-r--r-- | config/routes.rb | 1 | ||||
-rwxr-xr-x | config/sysvinit-thin.ugly | 68 | ||||
-rwxr-xr-x | config/sysvinit.example | 53 |
12 files changed, 212 insertions, 142 deletions
diff --git a/config/alert-tracks-debian.ugly b/config/alert-tracks-debian.ugly index 29a350a0e..f1ca68b03 100644..100755 --- a/config/alert-tracks-debian.ugly +++ b/config/alert-tracks-debian.ugly @@ -13,10 +13,12 @@ # !!(*= $daemon_name *)!! Start the Alaveteli email alert daemon NAME=!!(*= $daemon_name *)!! -DAEMON=!!(*= $vhost_dir *)!!/alaveteli/script/runner +DAEMON=!!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/runner DAEMON_ARGS="--daemon TrackMailer.alert_tracks_loop" -PIDFILE=!!(*= $vhost_dir *)!!/alert-tracks.pid -LOGFILE=!!(*= $vhost_dir *)!!/logs/alert-tracks.log +PIDDIR=!!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/tmp/pids +PIDFILE=$PIDDIR/!!(*= $daemon_name *)!!.pid +LOGDIR=!!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/log +LOGFILE=$LOGDIR/!!(*= $daemon_name *)!!.log DUSER=!!(*= $user *)!! # Set RAILS_ENV - not needed if using config/rails_env.rb # RAILS_ENV=your_rails_env @@ -27,10 +29,14 @@ trap "" 1 export PIDFILE LOGFILE quietly_start_daemon() { + mkdir -p {$LOGDIR,$PIDDIR} + chown $DUSER:$DUSER {$LOGDIR,$PIDDIR} /sbin/start-stop-daemon --quiet --start --pidfile "$PIDFILE" --chuid "$DUSER" --startas "$DAEMON" -- $DAEMON_ARGS } start_daemon() { + mkdir -p {$LOGDIR,$PIDDIR} + chown $DUSER:$DUSER {$LOGDIR,$PIDDIR} /sbin/start-stop-daemon --start --pidfile "$PIDFILE" --chuid "$DUSER" --startas "$DAEMON" -- $DAEMON_ARGS } @@ -81,4 +87,3 @@ else echo " failed" exit 1 fi - diff --git a/config/crontab-example b/config/crontab-example index 212a4a689..79ba70beb 100644 --- a/config/crontab-example +++ b/config/crontab-example @@ -8,7 +8,7 @@ PATH=/usr/local/bin:/usr/bin:/bin MAILTO=!!(*= $mailto *)!! # Every 5 minutes -*/5 * * * * !!(*= $user *)!! !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/commonlib/bin/run-with-lockfile.sh -n !!(*= $vhost_dir *)!!/change-xapian-database.lock "!!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/update-xapian-index verbose=true" >> !!(*= $vhost_dir *)!!/logs/update-xapian-index.log || echo "stalled?" +*/5 * * * * !!(*= $user *)!! !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/commonlib/bin/run-with-lockfile.sh -n !!(*= $vhost_dir *)!!/change-xapian-database.lock "!!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/update-xapian-index verbose=true" >> !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/log/update-xapian-index.log || echo "stalled?" # Every 10 minutes 5,15,25,35,45,55 * * * * !!(*= $user *)!! /etc/init.d/foi-alert-tracks check 5,15,25,35,45,55 * * * * !!(*= $user *)!! /etc/init.d/foi-purge-varnish check @@ -38,7 +38,7 @@ MAILTO=!!(*= $mailto *)!! 48 2 * * * !!(*= $user *)!! !!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/user-use-graph # Once a year :) -0 0 1 11 * !!(*= $user *)!! /bin/echo "A year has passed, please update the bank holidays for the Freedom of Information site, thank you." +0 0 1 11 * !!(*= $user *)!! /bin/echo "A year has passed, please update the public holidays for the Freedom of Information site, thank you." diff --git a/config/deploy.rb b/config/deploy.rb index c73d16f53..afc586ecf 100644 --- a/config/deploy.rb +++ b/config/deploy.rb @@ -56,6 +56,8 @@ namespace :deploy do "#{release_path}/public/foi-user-use.png" => "#{shared_path}/foi-user-use.png", "#{release_path}/files" => "#{shared_path}/files", "#{release_path}/cache" => "#{shared_path}/cache", + "#{release_path}/log" => "#{shared_path}/log", + "#{release_path}/tmp/pids" => "#{shared_path}/tmp/pids", "#{release_path}/lib/acts_as_xapian/xapiandbs" => "#{shared_path}/xapiandbs", } @@ -66,6 +68,8 @@ namespace :deploy do after 'deploy:setup' do run "mkdir -p #{shared_path}/files" run "mkdir -p #{shared_path}/cache" + run "mkdir -p #{shared_path}/log" + run "mkdir -p #{shared_path}/tmp/pids" run "mkdir -p #{shared_path}/xapiandbs" end end diff --git a/config/general.yml-example b/config/general.yml-example index 803c1c6ae..0f32f6192 100644 --- a/config/general.yml-example +++ b/config/general.yml-example @@ -245,6 +245,8 @@ SHARED_DIRECTORIES: - files/ - cache/ - lib/acts_as_xapian/xapiandbs/ + - log/ + - tmp/pids - vendor/bundle - public/assets @@ -255,4 +257,4 @@ SHARED_DIRECTORIES: ALLOW_BATCH_REQUESTS: false # Should we use the responsive stylesheets? -RESPONSIVE_STYLING: false +RESPONSIVE_STYLING: true diff --git a/config/packages b/config/packages index fda09cbc1..200a8c34f 100644 --- a/config/packages +++ b/config/packages @@ -1,42 +1,42 @@ # please note that this package list currently forms part of the # mysociety deployment infrastructure -- please discuss on the # alavateli mailing list if you want to change it -ruby1.8 -ruby -rdoc | rdoc1.8 -irb | irb1.8 -wv -poppler-utils -pdftk (>> 1.41+dfsg-1) | pdftk (<< 1.41+dfsg-1) # that version has a non-functionining uncompress option -ghostscript +build-essential +bundler catdoc -links elinks -unrtf -xlhtml -xapian-tools -gnuplot-nox -php5-cli -sharutils -unzip -mutt -tnef (>= 1.4.5) gettext -python-yaml -wkhtmltopdf-static +ghostscript +gnuplot-nox +irb | irb1.8 +libicu-dev libmagic-dev libmagickwand-dev libpq-dev +libsqlite3-dev libxml2-dev libxslt-dev -uuid-dev +links +memcached +mutt +pdftk (>> 1.41+dfsg-1) | pdftk (<< 1.41+dfsg-1) # that version has a non-functionining uncompress option +php5-cli +poppler-utils +python-yaml +rake (>= 0.9.2.2) +rdoc | rdoc1.8 +ruby +ruby1.8 ruby1.8-dev rubygems (>= 1.8.15) -rake (>= 0.9.2.2) -build-essential -bundler +sharutils sqlite3 -libsqlite3-dev -libicu-dev -memcached +tnef (>= 1.4.5) ttf-bitstream-vera +unrtf +unzip +uuid-dev +wkhtmltopdf-static +wv +xapian-tools +xlhtml diff --git a/config/packages.debian-squeeze b/config/packages.debian-squeeze index d82d66324..52bdbc376 100644 --- a/config/packages.debian-squeeze +++ b/config/packages.debian-squeeze @@ -1,40 +1,41 @@ -ruby1.8 -ruby -libruby1.8 -rdoc1.8 -irb1.8 -wv -poppler-utils -pdftk -ghostscript +build-essential +bundler catdoc -links elinks -unrtf -xlhtml -xapian-tools -gnuplot-nox -php5-cli -sharutils -unzip -mutt -tnef gettext -python-yaml -wkhtmltopdf-static +ghostscript +gnuplot-nox +irb1.8 +libicu-dev libmagic-dev libmagickwand-dev libpq-dev +libruby1.8 +libsqlite3-dev libxml2-dev libxslt-dev -uuid-dev +links +mutt +pdftk +php5-cli +poppler-utils +postgresql +postgresql-client +python-yaml +rake +rdoc1.8 +ruby +ruby1.8 ruby1.8-dev rubygems/squeeze-backports -rake -build-essential +sharutils sqlite3 -libsqlite3-dev -libicu-dev -postgresql -postgresql-client +tnef ttf-bitstream-vera +unrtf +unzip +uuid-dev +wkhtmltopdf-static +wv +xapian-tools +xlhtml diff --git a/config/packages.debian-wheezy b/config/packages.debian-wheezy new file mode 100644 index 000000000..381e25daa --- /dev/null +++ b/config/packages.debian-wheezy @@ -0,0 +1,36 @@ +build-essential +bundler +catdoc +elinks +gettext +ghostscript +gnuplot-nox +libicu-dev +libmagic-dev +libmagickwand-dev +libpq-dev +libsqlite3-dev +libxml2-dev +libxslt-dev +links +mutt +pdftk +php5-cli +poppler-utils +postgresql +postgresql-client +python-yaml +rake +ruby-dev +ruby1.9.3 +rubygems +sharutils +sqlite3 +tnef +unrtf +unzip +uuid-dev +wkhtmltopdf-static +wv +xapian-tools +xlhtml diff --git a/config/packages.ubuntu-precise b/config/packages.ubuntu-precise index 68911359a..87b9591bf 100644 --- a/config/packages.ubuntu-precise +++ b/config/packages.ubuntu-precise @@ -1,36 +1,36 @@ -ruby1.9.1 -wv -poppler-utils -pdftk -ghostscript +build-essential catdoc -links elinks -unrtf -xlhtml -xapian-tools -gnuplot-nox -sharutils -unzip -mutt -tnef gettext -python-yaml -wkhtmltopdf-static +ghostscript +gnuplot-nox +libicu-dev libmagic-dev libmagickwand-dev libpq-dev +libsqlite3-dev libxml2-dev libxslt1-dev -uuid-dev -ruby1.9.1-dev -rubygems +links +mutt +pdftk +poppler-utils +postgresql +postgresql-client +python-yaml rake -build-essential ruby-bundler +ruby1.9.1 +ruby1.9.1-dev +rubygems +sharutils sqlite3 -libsqlite3-dev -libicu-dev -postgresql -postgresql-client +tnef ttf-bitstream-vera +unrtf +unzip +uuid-dev +wkhtmltopdf-static +wv +xapian-tools +xlhtml diff --git a/config/purge-varnish-debian.ugly b/config/purge-varnish-debian.ugly index 3f11344f2..dc3f74ff6 100644..100755 --- a/config/purge-varnish-debian.ugly +++ b/config/purge-varnish-debian.ugly @@ -13,10 +13,12 @@ # !!(*= $daemon_name *)!! Start the Alaveteli email purge-varnish daemon NAME=!!(*= $daemon_name *)!! -DAEMON=!!(*= $vhost_dir *)!!/alaveteli/script/runner +DAEMON=!!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/script/runner DAEMON_ARGS="--daemon PurgeRequest.purge_all_loop" -PIDFILE=!!(*= $vhost_dir *)!!/purge-varnish.pid -LOGFILE=!!(*= $vhost_dir *)!!/logs/purge-varnish.log +PIDDIR=!!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/tmp/pids +PIDFILE=$PIDDIR/!!(*= $daemon_name *)!!.pid +LOGDIR=!!(*= $vhost_dir *)!!/!!(*= $vcspath *)!!/log +LOGFILE=$LOGDIR/!!(*= $daemon_name *)!!.log DUSER=!!(*= $user *)!! # Set RAILS_ENV - not needed if using config/rails_env.rb # RAILS_ENV=your_rails_env @@ -29,10 +31,14 @@ trap "" 1 export PIDFILE LOGFILE quietly_start_daemon() { + mkdir -p {$LOGDIR,$PIDDIR} + chown $DUSER:$DUSER {$LOGDIR,$PIDDIR} /sbin/start-stop-daemon --quiet --start --pidfile "$PIDFILE" --chuid "$DUSER" --startas "$DAEMON" -- $DAEMON_ARGS } start_daemon() { + mkdir -p {$LOGDIR,$PIDDIR} + chown $DUSER:$DUSER {$LOGDIR,$PIDDIR} /sbin/start-stop-daemon --start --pidfile "$PIDFILE" --chuid "$DUSER" --startas "$DAEMON" -- $DAEMON_ARGS } diff --git a/config/routes.rb b/config/routes.rb index 7cc85c974..9f426fabf 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -261,6 +261,7 @@ Alaveteli::Application.routes.draw do match '/api/v2/request/:id.json' => 'api#show_request', :as => :api_show_request, :via => :get match '/api/v2/request/:id.json' => 'api#add_correspondence', :as => :api_add_correspondence, :via => :post + match '/api/v2/request/:id/update.json' => 'api#update_state', :as => :api_update_state, :via => :post match '/api/v2/body/:id/request_events.:feed_type' => 'api#body_request_events', :as => :api_body_request_events, :feed_type => '^(json|atom)$' #### diff --git a/config/sysvinit-thin.ugly b/config/sysvinit-thin.ugly new file mode 100755 index 000000000..cc604d994 --- /dev/null +++ b/config/sysvinit-thin.ugly @@ -0,0 +1,68 @@ +#! /bin/sh +### BEGIN INIT INFO +# Provides: application-thin-!!(*= $site *)!! +# 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 Thin app server for the "!!(*= $site *)!!" site +# Description: The Thin app server for the "!!(*= $site *)!!" 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 +NAME=!!(*= $site *)!! +SITE_HOME=!!(*= $vhost_dir *)!!/!!(*= $vcspath *)!! +DESC="Alaveteli app server" +USER=!!(*= $user *)!! + +set -e + +# Check that the Daemon can be run +su -l -c "cd $SITE_HOME && bundle exec thin --version &> /dev/null || exit 0" $USER + +start_daemon() { + echo -n "Starting $DESC: " + cd "$SITE_HOME" && bundle exec thin \ + --environment=production \ + --user="$USER" \ + --group="$USER" \ + --address=127.0.0.1 \ + --daemonize \ + --quiet \ + start || true + echo "$NAME." +} + +stop_daemon() { + echo -n "Stopping $DESC: " + cd "$SITE_HOME" && bundle exec thin --quiet stop || true + echo "$NAME." +} + +restart_daemon() { + echo -n "Restarting $DESC: " + cd "$SITE_HOME" && bundle exec thin --onebyone --quiet restart || true + echo "$NAME." +} + +case "$1" in + start) + start_daemon + ;; + stop) + stop_daemon + ;; + reload|restart|force-reload) + restart_daemon + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|reload|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/config/sysvinit.example b/config/sysvinit.example deleted file mode 100755 index 443e7c3fb..000000000 --- a/config/sysvinit.example +++ /dev/null @@ -1,53 +0,0 @@ -#! /bin/sh -### BEGIN INIT INFO -# Provides: application-thin-alaveteli -# 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 Thin web server for the "Alaveteli" site -# Description: The Thin web server for the "Alaveteli" 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/alaveteli -NAME=alaveteli -DESC="Alaveteli app server" -USER=fms - -echo $DAEMON -test -f $DAEMON || exit 0 - -set -e - -start_daemon() { - su -l -c "cd $SITE_HOME/alaveteli && bundle exec thin -d -p 3300 -e development start" $USER -} - -stop_daemon() { - pkill -f thin -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 |