From 42870985da06418461c847563fa860c11b4094a1 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Tue, 10 Jun 2014 10:04:29 +0100 Subject: Rename XXX comments with TODO: Picks these up in `rake notes` and adds semantic meaning --- script/request-creation-graph | 2 +- script/user-use-graph | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'script') 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/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` -- cgit v1.2.3 From 3e9aca9c0795a205b4afe069ddd403889b95ffd2 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Thu, 19 Jun 2014 14:52:20 +0100 Subject: Use the run-with-lockfile shell script instead of the C program Then re-installers don't have to compile anything. --- script/site-specific-install.sh | 1 - 1 file changed, 1 deletion(-) (limited to 'script') diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh index 7d47a5990..fce230822 100755 --- a/script/site-specific-install.sh +++ b/script/site-specific-install.sh @@ -148,7 +148,6 @@ echo -n "Creating /etc/cron.d/alaveteli... " sed -r \ -e "/foi-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 -- cgit v1.2.3 From db2a8e0b20cd8ba3c36cba4ad1a06c70d7046dc3 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Mon, 23 Jun 2014 12:20:32 +0100 Subject: Remove mySociety log handling from install scripts The deployment system should deal with putting logs in the desired place. As this script gets run on a variety of systems it can cause problems for non-mySociety reinstallers. --- script/rails-deploy-before-down | 25 ------------------------- 1 file changed, 25 deletions(-) (limited to 'script') 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 () { -- cgit v1.2.3 From 36e1f108504eba2e4d56f4c9f03459809d6da8c3 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 10 Jul 2014 10:35:07 +0100 Subject: Add log/ to switch-to-shared script script/rails-deploy-before-down will complain if log is listed in the SHARED_DIRECTORIES configuration variable and already exists in APP_ROOT. It will recommend this script be used to migrate to a timestamped deployment structure, so adding log/ makes the transition of the log directory easier. --- script/mysociety-switch-to-shared | 1 + 1 file changed, 1 insertion(+) (limited to 'script') 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 \ -- cgit v1.2.3 From 91bc1c4963aa8f31d4d708dd87f1a5a4ccb401f1 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Thu, 7 Aug 2014 10:41:52 +0100 Subject: Generate sysvinit with rake task Now uses ugly so convert it with the rake task --- script/site-specific-install.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'script') diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh index fce230822..4c8c99aa2 100755 --- a/script/site-specific-install.sh +++ b/script/site-specific-install.sh @@ -134,10 +134,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" @@ -151,6 +147,13 @@ sed -r \ -i /etc/cron.d/alaveteli echo $DONE_MSG +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/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 -- cgit v1.2.3 From 68e509cbef97f5717c6d4e3aad5d93c589f6cdf1 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Fri, 8 Aug 2014 17:22:30 +0100 Subject: Debian specific fixes - Add wheezy repo to get bundler package which is unavailable in squeeze repo - Get bundler from wheezy repo and de-prioritise all other wheezy packages --- script/site-specific-install.sh | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'script') diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh index 4c8c99aa2..4b707d0dc 100755 --- a/script/site-specific-install.sh +++ b/script/site-specific-install.sh @@ -30,6 +30,28 @@ misuse() { [ -z "$DEVELOPMENT_INSTALL" ] && misuse DEVELOPMENT_INSTALL [ -z "$BIN_DIRECTORY" ] && misuse BIN_DIRECTORY +# 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 <> /etc/apt/preferences < Date: Fri, 8 Aug 2014 18:27:20 +0100 Subject: Add script to test vagrant vm provisioning - e.g. script/test-vagrant-provisioning squeeze64 --- script/test-vagrant-provisioning | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 script/test-vagrant-provisioning (limited to 'script') 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 -- cgit v1.2.3 From d0df86d597ec95e7b6b7e32af0932563c4c1406f Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Wed, 13 Aug 2014 10:00:45 +0100 Subject: Precise specific fixes - Get bundler and pdftk from raring repo and de-prioritise all other raring packages --- script/site-specific-install.sh | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) (limited to 'script') diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh index 4b707d0dc..92809cf85 100755 --- a/script/site-specific-install.sh +++ b/script/site-specific-install.sh @@ -30,6 +30,8 @@ misuse() { [ -z "$DEVELOPMENT_INSTALL" ] && misuse DEVELOPMENT_INSTALL [ -z "$BIN_DIRECTORY" ] && misuse BIN_DIRECTORY +update_mysociety_apt_sources + # Debian Squeeze Fixes if [ x"$DISTRIBUTION" = x"debian" ] && [ x"$DISTVERSION" = x"squeeze" ] then @@ -50,9 +52,39 @@ Package: * Pin: release n=wheezy Pin-Priority: 50 EOF + +apt-get -qq update fi -update_mysociety_apt_sources +# Ubuntu Precise Fixes +if [ x"$DISTRIBUTION" = x"ubuntu" ] && [ x"$DISTVERSION" = x"precise" ] +then + cat > /etc/apt/sources.list.d/ubuntu-trusty.list <> /etc/apt/preferences < Date: Fri, 15 Aug 2014 15:53:40 +0100 Subject: Use our own Launchpad Ubuntu repo to get pdftk --- script/site-specific-install.sh | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'script') diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh index 92809cf85..c113b6efb 100755 --- a/script/site-specific-install.sh +++ b/script/site-specific-install.sh @@ -64,23 +64,28 @@ deb http://archive.ubuntu.com/ubuntu/ trusty universe deb-src http://archive.ubuntu.com/ubuntu/ trusty universe EOF - # Get bundler and pdftk from raring and de-prioritise all other - # raring packages + cat > /etc/apt/sources.list.d/mysociety-launchpad.list <> /etc/apt/preferences < Date: Mon, 18 Aug 2014 13:27:32 +0100 Subject: Add -y option to install python-software-properties --- script/site-specific-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'script') diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh index c113b6efb..5c3fb2339 100755 --- a/script/site-specific-install.sh +++ b/script/site-specific-install.sh @@ -83,7 +83,7 @@ Pin-Priority: 50 EOF # Get the key for the mysociety ubuntu alaveteli repo -apt-get install python-software-properties +apt-get install -y python-software-properties add-apt-repository -y ppa:mysociety/alaveteli apt-get -qq update -- cgit v1.2.3 From 78166a169df728d4ee4d547a6d870c3463cecf6e Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Tue, 19 Aug 2014 15:18:54 +0100 Subject: Have install script use same init script names as manual install docs. --- script/site-specific-install.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'script') diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh index 5c3fb2339..234154319 100755 --- a/script/site-specific-install.sh +++ b/script/site-specific-install.sh @@ -201,7 +201,7 @@ 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," \ -i /etc/cron.d/alaveteli echo $DONE_MSG @@ -213,9 +213,9 @@ if [ ! "$DEVELOPMENT_INSTALL" = true ]; then echo $DONE_MSG fi -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 +echo -n "Creating /etc/init.d/alaveteli-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/alaveteli-alert-tracks +chmod a+rx /etc/init.d/alaveteli-alert-tracks echo $DONE_MSG if [ $DEFAULT_SERVER = true ] && [ x != x$EC2_HOSTNAME ] -- cgit v1.2.3 From 8db0f5000d46409a10d9c295c64c6a71e6bd3ea2 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Thu, 21 Aug 2014 15:57:26 +0100 Subject: fixup! Have install script use same init script names as manual install docs. --- script/site-specific-install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'script') diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh index 234154319..0a05b53ec 100755 --- a/script/site-specific-install.sh +++ b/script/site-specific-install.sh @@ -214,7 +214,7 @@ if [ ! "$DEVELOPMENT_INSTALL" = true ]; then fi echo -n "Creating /etc/init.d/alaveteli-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/alaveteli-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/alaveteli-alert-tracks echo $DONE_MSG -- cgit v1.2.3 From 7f86642c824acb15222c24f5386c27256a18bc21 Mon Sep 17 00:00:00 2001 From: Louise Crow Date: Thu, 21 Aug 2014 16:03:37 +0100 Subject: fixup! Have install script use same init script names as manual install docs. --- script/site-specific-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'script') diff --git a/script/site-specific-install.sh b/script/site-specific-install.sh index 0a05b53ec..59b714fb7 100755 --- a/script/site-specific-install.sh +++ b/script/site-specific-install.sh @@ -213,9 +213,9 @@ if [ ! "$DEVELOPMENT_INSTALL" = true ]; then echo $DONE_MSG fi -echo -n "Creating /etc/init.d/alaveteli-alert-tracks... " +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/alaveteli-alert-tracks +chmod a+rx /etc/init.d/$SITE-alert-tracks echo $DONE_MSG if [ $DEFAULT_SERVER = true ] && [ x != x$EC2_HOSTNAME ] -- cgit v1.2.3