aboutsummaryrefslogtreecommitdiffstats
path: root/script/rails-post-deploy
diff options
context:
space:
mode:
Diffstat (limited to 'script/rails-post-deploy')
-rwxr-xr-xscript/rails-post-deploy93
1 files changed, 9 insertions, 84 deletions
diff --git a/script/rails-post-deploy b/script/rails-post-deploy
index a1c613312..f1c63965e 100755
--- a/script/rails-post-deploy
+++ b/script/rails-post-deploy
@@ -1,94 +1,19 @@
#!/bin/bash
#
# rails-post-deploy
-# For Ruby on Rails, run this in exec_extras in vhosts.pl. It makes symlinks
-# from vendor to the server version of rails, and migrates the db to the most
-# recent version.
+# For Ruby on Rails, this used to be run in exec_extras in vhosts.pl;
+# however, now we use exec_before_down and exec_while_down instead, so
+# this is here for compatability with alternative deploy scripts that
+# still call rails-post-deploy.
#
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
-# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
+# Email: hello@mysociety.org; WWW: http://www.mysociety.org/
set -e
#set -x # debug
-APP_DIR=`pwd`
-
-# make sure that there is an app directory, so are in a rails app tree
-cd app/..
-
-# read config file in for later (STAGING_SITE)
-if [ -e "config/general" ] || [ -e "config/general.yml" ]
-then
- . commonlib/shlib/deployfns
- read_conf config/general
-else
- OPTION_DOMAIN=127.0.0.1:3000
- OPTION_STAGING_SITE=1
-fi
-
-# create initial log files
-if [ -e $APP_DIR/../logs ]
-then
- # mySociety servers have logs dir in level above
- rm -f log
- ln -s $APP_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
-# link the "downloads" directory in the cache to somewhere it can be served
-if [ ! -e "$APP_DIR/public/download" ]
-then
- mkdir -p "$APP_DIR/cache/zips/download"
- ln -s "$APP_DIR/cache/zips/download" "$APP_DIR/public/"
-fi
-
-cd log
-touch development.log fastcgi.crash.log production.log test.log
-cd ..
-
-# Force appropriate environment in production
-if [ "$OPTION_STAGING_SITE" = "0" ]
-then
- cat <<-END
-
- *****************************************************************
- WARNING: About to make config/rails_env.rb which, via special
- code in config/boot.rb, forces the Rails environment to be
- "production". If this is a development system, please edit your
- config/general.yml file and set the STAGING_SITE option to 1,
- and also delete the generated config/rails_env.rb file.
- Alternatively, you can override config/rails_env.rb at any time
- with an environment variable.
- *****************************************************************
-
- END
- echo "ENV['RAILS_ENV'] ||= 'production'" > config/rails_env.rb
-fi
-
-bundle_install_options=""
-if [ "$OPTION_STAGING_SITE" = "0" ]
-then
- bundle_install_options="--without development:test --deployment"
-fi
-if [ "$OPTION_STAGING_SITE" = "1" ]
-then
- bundle_install_options="--path vendor/bundle"
-fi
-if [ "$TRAVIS" = "true" ]
-then
- bundle_install_options="--without development develop --deployment"
-fi
-bundle install $bundle_install_options
-
-bundle exec rake themes:install
-
-# upgrade database
-bundle exec rake db:migrate #--trace
-
+TOP_DIR="$(dirname "$BASH_SOURCE")/.."
+cd "$TOP_DIR"
+"$TOP_DIR/script/rails-deploy-before-down"
+"$TOP_DIR/script/rails-deploy-while-down"