Browse Source

Add developer mode

Hamilton Turner 11 years ago
parent
commit
6dd081672f
2 changed files with 19 additions and 3 deletions
  1. 5 1
      toolset/deployment/vagrant/Vagrantfile
  2. 14 2
      toolset/deployment/vagrant/bootstrap.sh

+ 5 - 1
toolset/deployment/vagrant/Vagrantfile

@@ -20,5 +20,9 @@ Vagrant.configure("2") do |config|
   config.vm.network "private_network", ip: "172.16.16.16"
 
   # We run the bootstrap as the normal vagrant user, not as root
-  config.vm.provision :shell, :path => "bootstrap.sh", privileged: false
+  # You can pass arguments to the bootstrap.sh by setting the variable
+  # SHELL_ARGS. At the moment, the only arg it understands is 'dev' for 
+  # developer mode. For example:
+  #   $ SHELL_ARGS="dev" vagrant up
+  config.vm.provision :shell, :path => "bootstrap.sh", privileged: false, args: ENV['SHELL_ARGS']
 end

+ 14 - 2
toolset/deployment/vagrant/bootstrap.sh

@@ -9,7 +9,17 @@ if [ ! -e "/home/vagrant/.firstboot" ]; then
   echo "export TFB_DATABASE_USER=vagrant" >> ~/.bash_profile
   echo "export TFB_CLIENT_IDENTITY_FILE=/home/vagrant/.ssh/id_rsa" >> ~/.bash_profile
   echo "export TFB_DATABASE_IDENTITY_FILE=/home/vagrant/.ssh/id_rsa" >> ~/.bash_profile
-  echo "export FWROOT=/home/vagrant/FrameworkBenchmarks" >> ~/.bash_profile 
+  if [ "$1" == "dev" ]; then
+    echo "FrameworkBenchmarks: Running in developer mode"
+    echo "export FWROOT=/FrameworkBenchmarks" >> ~/.bash_profile 
+    ln -s /FrameworkBenchmarks ~/FrameworkBenchmarks
+    if [ -e "/FrameworkBenchmarks/benchmark.cfg" ]; then
+      echo "You have a benchmark.cfg file that will interfere with Vagrant, moving"
+      mv /FrameworkBenchmarks/benchmark.cfg /FrameworkBenchmarks/benchmark.cfg.backup
+    fi
+  else
+    echo "export FWROOT=/home/vagrant/FrameworkBenchmarks" >> ~/.bash_profile 
+  fi
   source ~/.bash_profile
 
   # Enable SSH to localhost
@@ -25,7 +35,9 @@ if [ ! -e "/home/vagrant/.firstboot" ]; then
   sudo apt-get install -y python-pip
 
   # Initial project setup
-  git clone https://github.com/TechEmpower/FrameworkBenchmarks.git $FWROOT
+  if [ "$1" != "dev" ]; then
+    git clone https://github.com/TechEmpower/FrameworkBenchmarks.git $FWROOT
+  fi
   sudo pip install -r $FWROOT/config/python_requirements.txt
 
   # Setup databases, client workload generator