aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Vagrantfile87
-rw-r--r--config/Vagrantfile23
-rw-r--r--config/general.yml-example4
-rwxr-xr-xscript/install-as-user1
-rwxr-xr-xscript/rails-deploy-before-down11
6 files changed, 101 insertions, 26 deletions
diff --git a/.gitignore b/.gitignore
index 537a7abf2..a4ec2380e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -30,3 +30,4 @@ webrat.log
/db/development_structure.sql
/db/structure.sql
/public/assets
+.vagrant
diff --git a/Vagrantfile b/Vagrantfile
new file mode 100644
index 000000000..dcdf1f433
--- /dev/null
+++ b/Vagrantfile
@@ -0,0 +1,87 @@
+# Welcome! Thanks for taking an interest in contributing to Alaveteli.
+# This Vagrantfile should get you started with the minimum of fuss.
+#
+# Usage
+# =====
+#
+# Get a copy of Alaveteli from GitHub and create the Vagrant instance
+#
+# # Host
+# $ git clone git@github.com:mysociety/alaveteli.git
+# $ cd alaveteli
+# $ git submodule update --init
+# $ vagrant --no-color up
+#
+# You should now be able to ssh in to the guest and run the test suite
+#
+# # Host
+# $ vagrant ssh
+#
+# # Guest
+# $ cd /home/vagrant/alaveteli
+# $ bundle exec rake spec
+#
+# Run the rails server and visit the application in your host browser
+# at http://10.10.10.30:3000
+#
+# # Guest
+# bundle exec rails s
+#
+# Customizing the Vagrant instance
+# ================================
+#
+# This Vagrantfile allows customisation of some aspects of the virtaual machine
+# See the customization options below for details.
+#
+# The options can be set either by prefixing the vagrant command, or by
+# exporting to the environment.
+#
+# # Prefixing the command
+# $ ALAVETELI_MEMORY=2048 vagrant up
+#
+# # Exporting to the environment
+# $ export ALAVETELI_MEMORY=2048
+# $ vagrant up
+#
+# Both have the same effect, but exporting will retain the variable for the
+# duration of your shell session.
+#
+# Customization Options
+# =====================
+ALAVETELI_FQDN = ENV['ALAVETELI_VAGRANT_FQDN'] || "alaveteli.10.10.10.30.xip.io"
+ALAVETELI_MEMORY = ENV['ALAVETELI_VAGRANT_MEMORY'] || 1536
+ALAVETELI_THEMES_DIR = ENV['ALAVETELI_THEMES_DIR'] || '../alaveteli-themes'
+
+VAGRANTFILE_API_VERSION = "2"
+
+Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
+ config.vm.box = "precise64"
+ config.vm.box_url = "http://files.vagrantup.com/precise64.box"
+ config.vm.network :private_network, :ip => "10.10.10.30"
+
+ config.vm.synced_folder ".", "/home/vagrant/alaveteli", :owner => "vagrant", :group => "vagrant"
+
+ if File.directory?(ALAVETELI_THEMES_DIR)
+ config.vm.synced_folder ALAVETELI_THEMES_DIR,
+ "/home/vagrant/alaveteli-themes",
+ :owner => "vagrant",
+ :group => "vagrant"
+ end
+
+ config.ssh.forward_agent = true
+
+ # The bundle install fails unless you have quite a large amount of
+ # memory; insist on 1.5GiB:
+ config.vm.provider "virtualbox" do |vb|
+ vb.customize ["modifyvm", :id, "--memory", ALAVETELI_MEMORY]
+ end
+
+ # Fetch and run the install script:
+ config.vm.provision :shell, :inline => "wget -O install-site.sh https://raw.github.com/mysociety/commonlib/master/bin/install-site.sh"
+ config.vm.provision :shell, :inline => "chmod a+rx install-site.sh"
+ config.vm.provision :shell, :inline => "./install-site.sh " \
+ "--dev " \
+ "alaveteli " \
+ "vagrant " \
+ "#{ ALAVETELI_FQDN }"
+end
diff --git a/config/Vagrantfile b/config/Vagrantfile
deleted file mode 100644
index 4253215fc..000000000
--- a/config/Vagrantfile
+++ /dev/null
@@ -1,23 +0,0 @@
-# This Vagrantfile should be used with the --no-color option, e.g.
-# vagrant --no-color up
-# Then you should be able to visit the site at:
-# http://alaveteli.10.10.10.30.xip.io
-
-Vagrant::Config.run do |config|
- config.vm.box = "precise64"
- config.vm.box_url = "http://files.vagrantup.com/precise64.box"
- config.vm.network :hostonly, "10.10.10.30"
- # The bundle install fails unless you have quite a large amount of
- # memory; insist on 1.5GiB:
- config.vm.customize ["modifyvm", :id, "--memory", 1536]
- # Fetch and run the install script:
- config.vm.provision :shell, :inline => "wget -O install-site.sh https://raw.github.com/mysociety/commonlib/master/bin/install-site.sh"
- config.vm.provision :shell, :inline => "chmod a+rx install-site.sh"
- # This is only needed before the install-script branch is merged to
- # master:
- config.vm.provision :shell, :inline => "sed -i -e 's/BRANCH=master/BRANCH=install-script/' install-site.sh"
- config.vm.provision :shell, :inline => "./install-site.sh " \
- "alaveteli " \
- "alaveteli " \
- "alaveteli.10.10.10.30.xip.io"
-end
diff --git a/config/general.yml-example b/config/general.yml-example
index 2b68721a5..ec9bdb6b5 100644
--- a/config/general.yml-example
+++ b/config/general.yml-example
@@ -215,6 +215,10 @@ USE_MAILCATCHER_IN_DEVELOPMENT: true
# config.action_controller.perform_caching is set to true
CACHE_FRAGMENTS: true
+# The default bundle path is vendor/bundle; you can set this option to
+# change it.
+BUNDLE_PATH: vendor/bundle
+
# In some deployments of Alaveteli you may wish to install each newly
# deployed version alongside the previous ones, in which case certain
# files and resources should be shared between these installations:
diff --git a/script/install-as-user b/script/install-as-user
index aaad52145..a6c267066 100755
--- a/script/install-as-user
+++ b/script/install-as-user
@@ -114,6 +114,7 @@ then
-e "s,^( *DONATION_URL:).*,\\1 null," \
-e "s,^( *THEME_BRANCH:).*,\\1 'develop'," \
-e "s,^( *USE_MAILCATCHER_IN_DEVELOPMENT:).*,\\1 false," \
+ -e "s,^( *BUNDLE_PATH:).*,\\1 $HOME/bundle/," \
config/general.yml-example > config/general.yml
fi
diff --git a/script/rails-deploy-before-down b/script/rails-deploy-before-down
index ad1049e44..c157a8624 100755
--- a/script/rails-deploy-before-down
+++ b/script/rails-deploy-before-down
@@ -123,19 +123,24 @@ END
echo "ENV['RAILS_ENV'] ||= 'production'" > config/rails_env.rb
fi
-bundle_install_options=""
+BUNDLE_PATH="${OPTION_BUNDLE_PATH:-vendor/bundle}"
+
+bundle_install_options="--path $BUNDLE_PATH"
+
if [ "$OPTION_STAGING_SITE" = "0" ]
then
- bundle_install_options="--without development:test --deployment"
+ bundle_install_options="$bundle_install_options --without development:test --deployment"
fi
if [ "$OPTION_STAGING_SITE" = "1" ]
then
- bundle_install_options="--path vendor/bundle"
+ bundle_install_options="$bundle_install_options"
fi
if [ "$TRAVIS" = "true" ]
then
bundle_install_options="--without development develop --deployment"
fi
+
+echo "Running bundle install with options: $bundle_install_options"
bundle install $bundle_install_options
bundle exec rake submodules:check