aboutsummaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rwxr-xr-xscript/mysociety-switch-to-shared1
-rwxr-xr-xscript/rails-deploy-before-down25
-rwxr-xr-xscript/request-creation-graph2
-rwxr-xr-xscript/site-specific-install.sh79
-rwxr-xr-xscript/test-vagrant-provisioning19
-rwxr-xr-xscript/user-use-graph2
6 files changed, 92 insertions, 36 deletions
diff --git a/script/mysociety-switch-to-shared b/script/mysociety-switch-to-shared
index f82e77706..801532e57 100755
--- a/script/mysociety-switch-to-shared
+++ b/script/mysociety-switch-to-shared
@@ -23,6 +23,7 @@ mkdir -p "$SHARED_DIR"
for F in \
cache \
+ log \
public/foi-live-creation.png \
public/foi-user-use.png \
config/aliases \
diff --git a/script/rails-deploy-before-down b/script/rails-deploy-before-down
index 42284b00d..c44bfe552 100755
--- a/script/rails-deploy-before-down
+++ b/script/rails-deploy-before-down
@@ -32,31 +32,6 @@ else
OPTION_STAGING_SITE=1
fi
-# create initial log files
-if [ -e $TOP_DIR/../logs ]
-then
- # mySociety servers have logs dir in level above
- if ! [ -h log ] && [ -d log ]
- then
- # If log is a directory rather than a symlink, move that
- # directory out of the way:
- mv log log.original
- fi
- ln -sfn $TOP_DIR/../logs log
-else
- # otherwise just make the directory
- if [ -h log ]
- then
- # remove any old-style symlink first
- rm -f log
- fi
- mkdir -p log
-fi
-
-cd log
-touch development.log fastcgi.crash.log production.log test.log
-cd ..
-
# Returns 0 if an element is present in a bash array, and 1 otherwise
# Taken from: http://stackoverflow.com/a/8574392/223092
contains () {
diff --git a/script/request-creation-graph b/script/request-creation-graph
index ef1d2cf73..7d347a7d2 100755
--- a/script/request-creation-graph
+++ b/script/request-creation-graph
@@ -17,7 +17,7 @@ cd `dirname $0`
cd ../
source commonlib/shlib/deployfns
-# XXX this is nasty :)
+# TODO: this is nasty :)
OPTION_FOI_DB_HOST=`grep "host:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
OPTION_FOI_DB_PORT=`grep "port:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
OPTION_FOI_DB_NAME=`grep "database:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh
index 7d47a5990..59b714fb7 100755
--- a/script/site-specific-install.sh
+++ b/script/site-specific-install.sh
@@ -32,6 +32,65 @@ misuse() {
update_mysociety_apt_sources
+# Debian Squeeze Fixes
+if [ x"$DISTRIBUTION" = x"debian" ] && [ x"$DISTVERSION" = x"squeeze" ]
+then
+ # Add wheezy repo to get bundler
+ cat > /etc/apt/sources.list.d/debian-wheezy.list <<EOF
+deb http://the.earth.li/debian/ wheezy main contrib non-free
+EOF
+
+ # Get bundler from wheezy repo and de-prioritise all other
+ # wheezy packages
+ cat >> /etc/apt/preferences <<EOF
+
+Package: bundler
+Pin: release n=wheezy
+Pin-Priority: 990
+
+Package: *
+Pin: release n=wheezy
+Pin-Priority: 50
+EOF
+
+apt-get -qq update
+fi
+
+# Ubuntu Precise Fixes
+if [ x"$DISTRIBUTION" = x"ubuntu" ] && [ x"$DISTVERSION" = x"precise" ]
+then
+ cat > /etc/apt/sources.list.d/ubuntu-trusty.list <<EOF
+deb http://archive.ubuntu.com/ubuntu/ trusty universe
+deb-src http://archive.ubuntu.com/ubuntu/ trusty universe
+EOF
+
+ cat > /etc/apt/sources.list.d/mysociety-launchpad.list <<EOF
+deb http://ppa.launchpad.net/mysociety/alaveteli/ubuntu precise main
+deb-src http://ppa.launchpad.net/mysociety/alaveteli/ubuntu precise main
+EOF
+
+ # Get bundler from trusty and de-prioritise all other
+ # trusty packages
+ cat >> /etc/apt/preferences <<EOF
+
+Package: ruby-bundler
+Pin: release n=trusty
+Pin-Priority: 990
+
+Package: *
+Pin: release n=trusty
+Pin-Priority: 50
+EOF
+
+# Get the key for the mysociety ubuntu alaveteli repo
+apt-get install -y python-software-properties
+add-apt-repository -y ppa:mysociety/alaveteli
+
+apt-get -qq update
+fi
+
+apt-get -y update
+
if [ ! "$DEVELOPMENT_INSTALL" = true ]; then
install_nginx
add_website_to_nginx
@@ -134,10 +193,6 @@ su -l -c "$BIN_DIRECTORY/install-as-user '$UNIX_USER' '$HOST' '$DIRECTORY'" "$UN
# no longer need the PostgreSQL user to be a superuser:
echo "ALTER USER \"$UNIX_USER\" WITH NOSUPERUSER;" | su -l -c 'psql' postgres
-if [ ! "$DEVELOPMENT_INSTALL" = true ]; then
- install_sysvinit_script
-fi
-
# Set up root's crontab:
cd "$REPOSITORY"
@@ -146,15 +201,21 @@ echo -n "Creating /etc/cron.d/alaveteli... "
(su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_crontab DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' VCSPATH='$SITE' SITE='$SITE' CRONTAB=config/crontab-example" "$UNIX_USER") > /etc/cron.d/alaveteli
# There are some other parts to rewrite, so just do them with sed:
sed -r \
- -e "/foi-purge-varnish/d" \
+ -e "/$SITE-purge-varnish/d" \
-e "s,^(MAILTO=).*,\1root@$HOST," \
- -e "s,run-with-lockfile,$REPOSITORY/commonlib/bin/run-with-lockfile.sh,g" \
-i /etc/cron.d/alaveteli
echo $DONE_MSG
-echo -n "Creating /etc/init.d/foi-alert-tracks... "
-(su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_init_script DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' SCRIPT_FILE=config/alert-tracks-debian.ugly" "$UNIX_USER") > /etc/init.d/foi-alert-tracks
-chmod a+rx /etc/init.d/foi-alert-tracks
+if [ ! "$DEVELOPMENT_INSTALL" = true ]; then
+ echo -n "Creating /etc/init.d/$SITE... "
+ (su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_init_script DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' VCSPATH='$SITE' SITE='$SITE' SCRIPT_FILE=config/sysvinit-thin.ugly" "$UNIX_USER") > /etc/init.d/"$SITE"
+ chmod a+rx /etc/init.d/"$SITE"
+ echo $DONE_MSG
+fi
+
+echo -n "Creating /etc/init.d/$SITE-alert-tracks... "
+(su -l -c "cd '$REPOSITORY' && bundle exec rake config_files:convert_init_script DEPLOY_USER='$UNIX_USER' VHOST_DIR='$DIRECTORY' SCRIPT_FILE=config/alert-tracks-debian.ugly" "$UNIX_USER") > /etc/init.d/$SITE-alert-tracks
+chmod a+rx /etc/init.d/$SITE-alert-tracks
echo $DONE_MSG
if [ $DEFAULT_SERVER = true ] && [ x != x$EC2_HOSTNAME ]
diff --git a/script/test-vagrant-provisioning b/script/test-vagrant-provisioning
new file mode 100755
index 000000000..62862f3df
--- /dev/null
+++ b/script/test-vagrant-provisioning
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+OS=$1
+
+vagrant destroy
+
+ALAVETELI_VAGRANT_OS="$OS" vagrant up &&
+ vagrant ssh -c "cd /home/vagrant/alaveteli && bundle exec rails s --daemon" &&
+ sleep 10 &&
+ curl -I http://10.10.10.30:3000
+
+if [[ $? -ne 0 ]]
+then
+ echo "Failed with exit code $?"
+ exit 1
+else
+ echo "Success!"
+ exit 0
+fi
diff --git a/script/user-use-graph b/script/user-use-graph
index f508c9cb6..00eeb36f8 100755
--- a/script/user-use-graph
+++ b/script/user-use-graph
@@ -16,7 +16,7 @@ cd `dirname $0`
cd ../
source commonlib/shlib/deployfns
-# XXX this is nasty :)
+# TODO: this is nasty :)
OPTION_FOI_DB_HOST=`grep "host:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
OPTION_FOI_DB_PORT=`grep "port:" config/database.yml | head --lines=1 | cut -d ":" -f 2`
OPTION_FOI_DB_NAME=`grep "database:" config/database.yml | head --lines=1 | cut -d ":" -f 2`