aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xconfig/alert-tracks-debian.example4
-rw-r--r--config/crontab-example4
-rwxr-xr-xconfig/purge-varnish-debian.example4
-rw-r--r--config/run-with-rbenv-path.example8
-rw-r--r--lib/tasks/config_files.rake16
5 files changed, 36 insertions, 0 deletions
diff --git a/config/alert-tracks-debian.example b/config/alert-tracks-debian.example
index a098bc332..ac4a55c8f 100755
--- a/config/alert-tracks-debian.example
+++ b/config/alert-tracks-debian.example
@@ -24,6 +24,10 @@ DUSER=!!(*= $user *)!!
# RAILS_ENV=your_rails_env
# export RAILS_ENV
+# Uncomment the following line if running under rbenv - we want this daemon to run
+# in the context of the ruby version defined for the site
+# PATH=/home/!!(*= $user *)!!/.rbenv/shims:/usr/local/bin:/usr/bin:/bin
+
trap "" 1
export PIDFILE LOGFILE
diff --git a/config/crontab-example b/config/crontab-example
index bfcba0568..a83f418fa 100644
--- a/config/crontab-example
+++ b/config/crontab-example
@@ -5,6 +5,10 @@
# Email: hello@mysociety.org. WWW: http://www.mysociety.org/
PATH=/usr/local/bin:/usr/bin:/bin
+# Uncomment the following line if running under rbenv - we want this cron to run
+# in the context of the ruby version defined for the site
+# PATH=/home/!!(*= $user *)!!/.rbenv/shims:/usr/local/bin:/usr/bin:/bin
+
MAILTO=!!(*= $mailto *)!!
# Every 5 minutes
diff --git a/config/purge-varnish-debian.example b/config/purge-varnish-debian.example
index 457a77ed8..779266d2d 100755
--- a/config/purge-varnish-debian.example
+++ b/config/purge-varnish-debian.example
@@ -24,6 +24,10 @@ DUSER=!!(*= $user *)!!
# RAILS_ENV=your_rails_env
# export RAILS_ENV
+# Uncomment the following line if running under rbenv - we want this daemon to run
+# in the context of the ruby version defined for the site
+# PATH=/home/!!(*= $user *)!!/.rbenv/shims:/usr/local/bin:/usr/bin:/bin
+
type varnishadm > /dev/null 2>&1 || exit
trap "" 1
diff --git a/config/run-with-rbenv-path.example b/config/run-with-rbenv-path.example
new file mode 100644
index 000000000..25dec9b60
--- /dev/null
+++ b/config/run-with-rbenv-path.example
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+# We want this script to run in the context of the ruby version defined for the site
+PATH=/home/!!(*= $user *)!!/.rbenv/shims:$PATH
+
+source "$1"
+
+exit $?
diff --git a/lib/tasks/config_files.rake b/lib/tasks/config_files.rake
index f6b25185e..d0dc8f594 100644
--- a/lib/tasks/config_files.rake
+++ b/lib/tasks/config_files.rake
@@ -21,6 +21,22 @@ namespace :config_files do
converted_lines
end
+ desc 'Convert wrapper example in config to a form suitable for running mail handling scripts with rbenv'
+ task :convert_wrapper => :environment do
+ example = 'rake config_files:convert_wrapper DEPLOY_USER=deploy SCRIPT_FILE=config/run-with-rbenv-path.example'
+ check_for_env_vars(['DEPLOY_USER',
+ 'SCRIPT_FILE'], example)
+
+ replacements = {
+ :user => ENV['DEPLOY_USER'],
+ }
+
+ # Generate the template for potential further processing
+ convert_ugly(ENV['SCRIPT_FILE'], replacements).each do |line|
+ puts line
+ end
+ end
+
desc 'Convert Debian example init script in config to a form suitable for installing in /etc/init.d'
task :convert_init_script => :environment do
example = 'rake config_files:convert_init_script DEPLOY_USER=deploy VHOST_DIR=/dir/above/alaveteli VCSPATH=alaveteli SITE=alaveteli SCRIPT_FILE=config/alert-tracks-debian.example'