From 55a828e15b1674bfcedcd27814c3ce992f59eee3 Mon Sep 17 00:00:00 2001 From: polyfractal Date: Tue, 11 Oct 2016 11:07:41 -0400 Subject: [PATCH] Tweak Vagrant to use env variables for S3 boxes, update instructions Original commit: elastic/x-pack-elasticsearch@20e657113e9f76ab2900db2cbe5fb7eb5f488c86 --- vagrant/README.md | 12 +++++++++--- vagrant/Vagrantfile | 10 +++++++++- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/vagrant/README.md b/vagrant/README.md index 75658f84109..41b25d16c6d 100644 --- a/vagrant/README.md +++ b/vagrant/README.md @@ -22,9 +22,15 @@ Don't feel like compiling the entire box? No fear, there's a pre-baked box avai on S3. It is ~1.1gb to download: ```bash -# must change into the vagrant directory first so that -# synced folders continue working -$ cd prelert-legacy/vagrant +# Change into some random directory to download the box. +# Doesn't matter where this goes, but *cannot* go into prelert-legacy/vagrant +$ cd ~/some_directory + +# Export the path to your prelert-legacy repo. This is so the box knows where +# to sync the folders +$ export PRELERT_SRC_HOME=/path/to/prelert-legacy + +# Download the box from S3 $ s3cmd get s3://prelert-elastic-dump/prelert_env.box # ... # Downloading... diff --git a/vagrant/Vagrantfile b/vagrant/Vagrantfile index b2caf1ada6e..481b23d3f97 100644 --- a/vagrant/Vagrantfile +++ b/vagrant/Vagrantfile @@ -24,6 +24,14 @@ Vagrant.configure(2) do |config| v.customize ["modifyvm", :id, "--memory", mem] v.customize ["modifyvm", :id, "--cpus", cpus] end + + if File.expand_path(File.dirname(__FILE__)).include? "prelert-legacy/vagrant" + puts "Syncing host's source directory [" + File.expand_path("../") + "] to [/home/vagrant/prelert/src]" + config.vm.synced_folder "../", "/home/vagrant/prelert/src", mount_options: ["dmode=777,fmode=777"] + else + puts "Syncing host's source directory [" + File.expand_path(ENV['PRELERT_SRC_HOME']) + "] to [/home/vagrant/prelert/src] (via $PRELERT_SRC_HOME)" + config.vm.synced_folder ENV['PRELERT_SRC_HOME'], "/home/vagrant/prelert/src", mount_options: ["dmode=777,fmode=777"] + end + config.vm.provision :shell, path: "provision.sh" - config.vm.synced_folder "../", "/home/vagrant/prelert/src", mount_options: ["dmode=777,fmode=777"] end