From 598a7a75076fcbe30a3ac27498f6d9ece2672631 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 23 Apr 2015 17:15:28 -0400 Subject: [PATCH 01/13] renaming some variables --- Vagrantfile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 6be8057..69ede62 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,8 +1,8 @@ # Determine paths vagrant_root = File.dirname(__FILE__) # Vagrantfile location -vagrant_mount = vagrant_root.gsub(/[a-zA-Z]:/, '') # Trim Windows drive letters -vagrant_folder = File.basename(vagrant_root) # Folder name only. Used as the SMB share name +vagrant_mount_point = vagrant_root.gsub(/[a-zA-Z]:/, '') # Trim Windows drive letters +vagrant_folder_name = File.basename(vagrant_root) # Folder name only. Used as the SMB share name # Use vagrant.yml for local VM configuration overrides. require 'yaml' @@ -62,14 +62,14 @@ Vagrant.configure("2") do |config| synced_folders = vconfig['synced_folders'] # nfs: better performance on Mac if synced_folders['type'] == "nfs" && !is_windows - config.vm.synced_folder vagrant_root, vagrant_mount, + config.vm.synced_folder vagrant_root, vagrant_mount_point, type: "nfs", mount_options: ["nolock", "vers=3", "tcp"] config.nfs.map_uid = Process.uid config.nfs.map_gid = Process.gid # smb: better performance on Windows. Requires Vagrant to be run with admin privileges. elsif synced_folders['type'] == "smb" && is_windows - config.vm.synced_folder vagrant_root, vagrant_mount, + config.vm.synced_folder vagrant_root, vagrant_mount_point, type: "smb", smb_username: synced_folders['smb_username'], smb_password: synced_folders['smb_password'] @@ -83,7 +83,7 @@ Vagrant.configure("2") do |config| mkdir -p vagrant $2 mount -t cifs -o uid=`id -u docker`,gid=`id -g docker`,sec=ntlm,username=$3,pass=$4 //192.168.10.1/$1 $2 SCRIPT - s.args = "#{vagrant_folder} #{vagrant_mount} #{vconfig['synced_folders']['smb_username']} #{vconfig['synced_folders']['smb_password']}" + s.args = "#{vagrant_folder_name} #{vagrant_mount_point} #{vconfig['synced_folders']['smb_username']} #{vconfig['synced_folders']['smb_password']}" end # rsync: the best performance, cross-platform platform, one-way only. Run `vagrant rsync-auto` to start auto sync. elsif synced_folders['type'] == "rsync" @@ -92,7 +92,7 @@ Vagrant.configure("2") do |config| puts "WARNING: 'folders' list cannot be empty when using 'rsync' sync type. Please check your vagrant.yml file." else for synced_folder in synced_folders['folders'] do - config.vm.synced_folder "#{vagrant_root}/#{synced_folder}", "#{vagrant_mount}/#{synced_folder}", + config.vm.synced_folder "#{vagrant_root}/#{synced_folder}", "#{vagrant_mount_point}/#{synced_folder}", type: "rsync", rsync__exclude: ".git/", rsync__args: ["--verbose", "--archive", "--delete", "-z", "--chmod=ugo=rwX"] @@ -101,7 +101,7 @@ Vagrant.configure("2") do |config| # vboxfs: reliable, cross-platform and terribly slow performance else puts "WARNING: defaulting to the slowest sync option (vboxfs)" - config.vm.synced_folder vagrant_root, vagrant_mount + config.vm.synced_folder vagrant_root, vagrant_mount_point end # Make host SSH keys available to containers on /.ssh @@ -115,7 +115,7 @@ Vagrant.configure("2") do |config| config.vm.provider "virtualbox" do |v| v.gui = vconfig['v.gui'] # Set to true for debugging. Will unhide VM's primary console screen. - v.name = vagrant_folder + "_boot2docker" # VirtualBox VM name + v.name = vagrant_folder_name + "_boot2docker" # VirtualBox VM name v.cpus = vconfig['v.cpus'] # CPU settings. VirtualBox works much better with a single CPU. v.memory = vconfig['v.memory'] # Memory settings. end @@ -150,7 +150,7 @@ Vagrant.configure("2") do |config| echo "export VAGRANT_ROOT=$1" >> /home/docker/.profile echo "cd $1" >> /home/docker/.ashrc SCRIPT - s.args = "#{vagrant_mount}" + s.args = "#{vagrant_mount_point}" end # dsh script lookup wrapper (Drude Shell) From d33f32e7893a32f9cd604064a24638f91052ab7e Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 23 Apr 2015 17:16:36 -0400 Subject: [PATCH 02/13] use @ui object to interact with the shell --- Vagrantfile | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 69ede62..8b38dc4 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,3 +1,5 @@ +# UI Object for console interactions. +@ui = Vagrant::UI::Colored.new # Determine paths vagrant_root = File.dirname(__FILE__) # Vagrantfile location @@ -7,7 +9,7 @@ vagrant_folder_name = File.basename(vagrant_root) # Folder name only. Used as t # Use vagrant.yml for local VM configuration overrides. require 'yaml' if !File.exist?(vagrant_root + '/vagrant.yml') - raise 'Configuration file not found! Please copy vagrant.yml.dist to vagrant.yml and try again.' + @ui.error 'Configuration file not found! Please copy vagrant.yml.dist to vagrant.yml and try again.' end vconfig = YAML::load_file(vagrant_root + '/vagrant.yml') @@ -22,7 +24,7 @@ if is_windows def windows_net_share(share, path) command = 'cmd.exe' args = "/C net share #{share}=#{path} /grant:everyone,FULL || timeout 5" - puts args + @ui.info args shell = WIN32OLE.new('Shell.Application') shell.ShellExecute(command, args, nil, 'runas') end @@ -89,7 +91,7 @@ Vagrant.configure("2") do |config| elsif synced_folders['type'] == "rsync" # Only sync explicitly listed folders. if (synced_folders['folders']).nil? - puts "WARNING: 'folders' list cannot be empty when using 'rsync' sync type. Please check your vagrant.yml file." + @ui.warn "WARNING: 'folders' list cannot be empty when using 'rsync' sync type. Please check your vagrant.yml file." else for synced_folder in synced_folders['folders'] do config.vm.synced_folder "#{vagrant_root}/#{synced_folder}", "#{vagrant_mount_point}/#{synced_folder}", @@ -100,7 +102,7 @@ Vagrant.configure("2") do |config| end # vboxfs: reliable, cross-platform and terribly slow performance else - puts "WARNING: defaulting to the slowest sync option (vboxfs)" + @ui.warn "WARNING: defaulting to the slowest folder sync option (vboxfs)" config.vm.synced_folder vagrant_root, vagrant_mount_point end From e0034d3d8e01da487642ce2fce6709552699616d Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 23 Apr 2015 17:21:19 -0400 Subject: [PATCH 03/13] use our own vagrant box: blinkreaction/boot2docker --- Vagrantfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 8b38dc4..6f43e78 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -47,7 +47,8 @@ Vagrant.require_version ">= 1.6.3" Vagrant.configure("2") do |config| config.vm.define "boot2docker" - config.vm.box = "dduportal/boot2docker" + config.vm.box = "blinkreaction/boot2docker" + config.vm.box_version = "1.6.0" config.vm.box_check_update = false ## Network ## From fb63b33a89ef7da8f04349fa5c8a6192ec19e63a Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 23 Apr 2015 17:26:55 -0400 Subject: [PATCH 04/13] switch to docker-compose:1.2.0 --- Vagrantfile | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 6f43e78..a2182e6 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -138,10 +138,20 @@ Vagrant.configure("2") do |config| # https://github.com/docker/compose/issues/598#issuecomment-67762456 config.vm.provision "shell", run: "always" do |s| s.inline = <<-SCRIPT - echo 'docker run --rm -it \ - -v $(pwd):$(pwd) -v /var/run/docker.sock:/var/run/docker.sock \ - -e COMPOSE_PROJECT_NAME=$(basename $(pwd)) -w="$(pwd)" \ - blinkreaction/docker-compose $*' > /usr/local/bin/docker-compose + DC_SCRIPT=' + #/bin/sh + + # Check if we are in an interactive shell and use "-it" flags if so. + interactive=$([ -t 0 ] && echo "-it") + + # Run docker-compose in a container + docker run --rm $interactive \ + -v $(pwd):$(pwd) -v /var/run/docker.sock:/var/run/docker.sock \ + -e COMPOSE_PROJECT_NAME=$(basename $(pwd)) -w="$(pwd)" \ + blinkreaction/docker-compose:1.2.0 $* + ' + + echo "$DC_SCRIPT" > /usr/local/bin/docker-compose chmod +x /usr/local/bin/docker-compose echo 'alias fig=docker-compose' >> /home/docker/.ashrc SCRIPT From 94b7178b15d27b2189ae9c9102f6683538d05350 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 23 Apr 2015 17:27:56 -0400 Subject: [PATCH 05/13] autostart containers if docker-compose.yml is present --- Vagrantfile | 12 ++++++++++++ vagrant.yml.dist | 3 +++ 2 files changed, 15 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index a2182e6..6aaaa5f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -197,4 +197,16 @@ Vagrant.configure("2") do |config| SCRIPT end + # Automatically start containers if docker-compose.yml is present in the current directory. + # See "autostart" property in vagrant.yml. + if File.file?('./docker-compose.yml') && vconfig['compose_autostart'] + config.vm.provision "shell", run: "always", privileged: false do |s| + s.inline = <<-SCRIPT + cd $1 + docker-compose up -d + SCRIPT + s.args = "#{vagrant_mount_point}" + end + end + end diff --git a/vagrant.yml.dist b/vagrant.yml.dist index 756599c..cca4c51 100644 --- a/vagrant.yml.dist +++ b/vagrant.yml.dist @@ -31,3 +31,6 @@ hosts: #- ip: 192.168.10.11 #- ip: 192.168.10.12 #- ip: 192.168.10.13 + +# Automatically start containers if docker-compose.yml is present in the current directory (default: true). +compose_autostart: true From 7c48dca8eba6f811ffe866b183420dbacb04fef1 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 23 Apr 2015 21:53:25 -0400 Subject: [PATCH 06/13] making vconfig global --- Vagrantfile | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 6aaaa5f..63e31a9 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -11,7 +11,7 @@ require 'yaml' if !File.exist?(vagrant_root + '/vagrant.yml') @ui.error 'Configuration file not found! Please copy vagrant.yml.dist to vagrant.yml and try again.' end -vconfig = YAML::load_file(vagrant_root + '/vagrant.yml') +$vconfig = YAML::load_file(vagrant_root + '/vagrant.yml') # Determine if we are on Windows host or not is_windows = Vagrant::Util::Platform.windows? @@ -55,14 +55,14 @@ Vagrant.configure("2") do |config| # The default box private network IP is 192.168.10.10 # Configure additional IP addresses in vagrant.yml - vconfig['hosts'].each do |host| + $vconfig['hosts'].each do |host| config.vm.network "private_network", ip: host['ip'] - end unless vconfig['hosts'].nil? + end unless $vconfig['hosts'].nil? #################################################################### ## Synced folders configuration ## - synced_folders = vconfig['synced_folders'] + synced_folders = $vconfig['synced_folders'] # nfs: better performance on Mac if synced_folders['type'] == "nfs" && !is_windows config.vm.synced_folder vagrant_root, vagrant_mount_point, @@ -86,7 +86,7 @@ Vagrant.configure("2") do |config| mkdir -p vagrant $2 mount -t cifs -o uid=`id -u docker`,gid=`id -g docker`,sec=ntlm,username=$3,pass=$4 //192.168.10.1/$1 $2 SCRIPT - s.args = "#{vagrant_folder_name} #{vagrant_mount_point} #{vconfig['synced_folders']['smb_username']} #{vconfig['synced_folders']['smb_password']}" + s.args = "#{vagrant_folder_name} #{vagrant_mount_point} #{$vconfig['synced_folders']['smb_username']} #{$vconfig['synced_folders']['smb_password']}" end # rsync: the best performance, cross-platform platform, one-way only. Run `vagrant rsync-auto` to start auto sync. elsif synced_folders['type'] == "rsync" @@ -114,13 +114,13 @@ Vagrant.configure("2") do |config| ###################################################################### - ## VirtualBox VM settings + ## VirtualBox VM settings. config.vm.provider "virtualbox" do |v| - v.gui = vconfig['v.gui'] # Set to true for debugging. Will unhide VM's primary console screen. - v.name = vagrant_folder_name + "_boot2docker" # VirtualBox VM name - v.cpus = vconfig['v.cpus'] # CPU settings. VirtualBox works much better with a single CPU. - v.memory = vconfig['v.memory'] # Memory settings. + v.gui = $vconfig['v.gui'] # Set to true for debugging. Will unhide VM's primary console screen. + v.name = vagrant_folder_name + "_boot2docker" # VirtualBox VM name. + v.cpus = $vconfig['v.cpus'] # CPU settings. VirtualBox works much better with a single CPU. + v.memory = $vconfig['v.memory'] # Memory settings. end ## Provisioning scripts ## @@ -199,7 +199,7 @@ Vagrant.configure("2") do |config| # Automatically start containers if docker-compose.yml is present in the current directory. # See "autostart" property in vagrant.yml. - if File.file?('./docker-compose.yml') && vconfig['compose_autostart'] + if File.file?('./docker-compose.yml') && $vconfig['compose_autostart'] config.vm.provision "shell", run: "always", privileged: false do |s| s.inline = <<-SCRIPT cd $1 From fb0ebef75aa9001259be0e73b70f173be3b91cdc Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 23 Apr 2015 21:55:34 -0400 Subject: [PATCH 07/13] Complete automation for smb2 option on Windows. --- README.md | 27 ++++-------------- Vagrantfile | 72 +++++++++++++++++++++++++++++++++++++++++------- vagrant.yml.dist | 7 +++-- 3 files changed, 72 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 83a7d4a..856034a 100644 --- a/README.md +++ b/README.md @@ -87,6 +87,12 @@ To use the SMB synced folder type: While using SMB you have to control Vagrant from an elevated (run as admin) Git Bash shell. +**SMB2 (experimental option)** + +This is an experimental option. +Compared to `smb`, `smb2` does not require running vagrant as admin. +With this option Vagrant will automatically create a user, SMB share and mount it. + **Enabling rsync** rsync is not natively available on Windows. @@ -100,27 +106,6 @@ To use rsync on Windows: 3. Provide an explicit list of folders to sync in the `vagrant.yml` file (`folders` sequence). 4. Reload the VM: `vagrant reload` -**SMB2 (experimental option)** - -This is an experimental option. -Compared to `smb`, `smb2` does not require running vagrant as admin, but requires initial manual setup: - -1. Create a Windows user with a password (e.g. `vagrant:`) -2. Share the `` directory. - > The share name has to match the directory name. - > E.g. share `C:\Work\Projects` as `Projects` - -3. Give the user created in step 1 full access to the share. -4. Update `vagrant.yml`: - > ... - > type: 'smb2' - > ... - > smb_username: '' - > smb_password: '' - > ... - -5. Reload the VM (`vagrant reload`) - ## VirtualBox VM settings diff --git a/Vagrantfile b/Vagrantfile index 63e31a9..e82f2f4 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,7 +1,18 @@ # UI Object for console interactions. @ui = Vagrant::UI::Colored.new -# Determine paths +# Install required plugins if not present. +required_plugins = %w(vagrant-triggers) +required_plugins.each do |plugin| + need_restart = false + unless Vagrant.has_plugin? plugin + system "vagrant plugin install #{plugin}" + need_restart = true + end + exec "vagrant #{ARGV.join(' ')}" if need_restart +end + +# Determine paths. vagrant_root = File.dirname(__FILE__) # Vagrantfile location vagrant_mount_point = vagrant_root.gsub(/[a-zA-Z]:/, '') # Trim Windows drive letters vagrant_folder_name = File.basename(vagrant_root) # Folder name only. Used as the SMB share name @@ -19,15 +30,46 @@ if is_windows require 'win32ole' # Determine if Vagrant was launched from the elevated command prompt running_as_admin = ((`reg query HKU\\S-1-5-19 2>&1` =~ /ERROR/).nil? && is_windows) - - # Method to create a network share on Windows using elevated command prompt - def windows_net_share(share, path) + + # Run command in an elevated shell. + def windows_elevated_shell(args) command = 'cmd.exe' - args = "/C net share #{share}=#{path} /grant:everyone,FULL || timeout 5" - @ui.info args + args = "/C #{args} || timeout 10" shell = WIN32OLE.new('Shell.Application') shell.ShellExecute(command, args, nil, 'runas') end + + # Method to create the user and SMB network share on Windows. + def windows_net_share(share_name, path) + # Add the vagrant user if it does not exist. + smb_username = $vconfig['synced_folders']['smb_username'] + smb_password = $vconfig['synced_folders']['smb_password'] + + command_user = "net user #{smb_username} || net user #{smb_username} #{smb_password} /add" + @ui.info "Adding vagrant user" + windows_elevated_shell command_user + + # Add the SMB share if it does not exist. + command_share = "net share #{share_name} || net share #{share_name}=#{path} /grant:#{smb_username},FULL" + @ui.info "Adding vagrant SMB share" + windows_elevated_shell command_share + + # Set folder permissions. + command_permissions = "icacls #{path} /grant #{smb_username}:(OI)(CI)M" + @ui.info "Setting folder permissions" + windows_elevated_shell command_permissions + end + + # Method to remove the user and SMB network share on Windows. + def windows_net_share_remove(share_name) + smb_username = $vconfig['synced_folders']['smb_username'] + + command_user = "net user #{smb_username} /delete || echo 'User #{smb_username} does not exist' && timeout 10" + windows_elevated_shell command_user + + command_share = "net share #{share_name} /delete || echo 'Share #{share_name} does not exist' && timeout 10" + windows_elevated_shell command_share + end else # Determine if Vagrant was launched with sudo (as root). running_as_root = (Process.uid == 0) @@ -76,11 +118,21 @@ Vagrant.configure("2") do |config| type: "smb", smb_username: synced_folders['smb_username'], smb_password: synced_folders['smb_password'] - # smb2: experimental, does not require running vagrant as admin, requires initial manual setup. + # smb2: experimental, does not require running vagrant as admin. elsif synced_folders['type'] == "smb2" && is_windows - # Create the share on the Windows host - #windows_net_share vagrant_share, vagrant_root - #Mount the share in boot2docker + # Create the share before 'up'. + config.trigger.before :up, :stdout => true, :force => true do + info 'Setting up SMB user and share' + windows_net_share vagrant_folder_name, vagrant_root + end + + # Remove the share after 'halt'. + config.trigger.after :destroy, :stdout => true, :force => true do + info 'Removing SMB user and share' + windows_net_share_remove vagrant_folder_name + end + + # Mount the share in boot2docker. config.vm.provision "shell", run: "always" do |s| s.inline = <<-SCRIPT mkdir -p vagrant $2 diff --git a/vagrant.yml.dist b/vagrant.yml.dist index cca4c51..58665be 100644 --- a/vagrant.yml.dist +++ b/vagrant.yml.dist @@ -2,15 +2,16 @@ synced_folders: # nfs: better performance on Mac, recommended. # smb: better performance on Windows. Requires Vagrant to be run with admin privileges. - # smb2: experimental, does not require running vagrant as admin, requires initial manual setup. + # smb2: experimental, does not require running vagrant as admin. # rsync: the best performance, cross-platform platform, one-way only. Run `vagrant rsync-auto` to start auto sync. # When using rsync sync type the "folders" list below is mandatory. # vboxfs (or leave empty): best compatibility and ease of setup, but poor performance. type: 'nfs' # smb_user, smb_password - The username and password used for authentication to mount the SMB mount. # This is usually your Windows username and password, unless you created a dedicated user for vagrant. - smb_username: '' - smb_password: '' + # If using the 'smb2' type above the user and share will be configured automatically. + smb_username: 'vagrant' + smb_password: 'vagrant' # List of folders to sync with rsync. These should be subfolder names within the folder (e.g. "drupal7") # Uncomment and add folders per the example below as neccessary. folders: From a99c85479abf1874c45b10001c9f9385c17e7ebe Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 23 Apr 2015 21:55:52 -0400 Subject: [PATCH 08/13] misc cleanup --- Vagrantfile | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index e82f2f4..2517995 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -14,8 +14,8 @@ end # Determine paths. vagrant_root = File.dirname(__FILE__) # Vagrantfile location -vagrant_mount_point = vagrant_root.gsub(/[a-zA-Z]:/, '') # Trim Windows drive letters -vagrant_folder_name = File.basename(vagrant_root) # Folder name only. Used as the SMB share name +vagrant_mount_point = vagrant_root.gsub(/[a-zA-Z]:/, '') # Trim Windows drive letters. +vagrant_folder_name = File.basename(vagrant_root) # Folder name only. Used as the SMB share name. # Use vagrant.yml for local VM configuration overrides. require 'yaml' @@ -24,11 +24,11 @@ if !File.exist?(vagrant_root + '/vagrant.yml') end $vconfig = YAML::load_file(vagrant_root + '/vagrant.yml') -# Determine if we are on Windows host or not +# Determine if we are on Windows host or not. is_windows = Vagrant::Util::Platform.windows? if is_windows require 'win32ole' - # Determine if Vagrant was launched from the elevated command prompt + # Determine if Vagrant was launched from the elevated command prompt. running_as_admin = ((`reg query HKU\\S-1-5-19 2>&1` =~ /ERROR/).nil? && is_windows) # Run command in an elevated shell. @@ -177,7 +177,7 @@ Vagrant.configure("2") do |config| ## Provisioning scripts ## - # Allow Mac OS X docker client to connect to Docker without TLS auth + # Allow Mac OS X docker client to connect to Docker without TLS auth. # https://github.com/deis/deis/issues/2230#issuecomment-72701992 config.vm.provision "shell" do |s| s.inline = <<-SCRIPT @@ -218,7 +218,7 @@ Vagrant.configure("2") do |config| s.args = "#{vagrant_mount_point}" end - # dsh script lookup wrapper (Drude Shell) + # dsh script lookup wrapper (Drude Shell). # https://github.com/blinkreaction/drude config.vm.provision "shell", run: "always" do |s| s.inline = <<-SCRIPT From b94e777b3d1df4f3fd82db1d6180e0c844eb7c14 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 23 Apr 2015 22:27:16 -0400 Subject: [PATCH 09/13] exit on errors --- Vagrantfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 2517995..800e2ca 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -21,6 +21,7 @@ vagrant_folder_name = File.basename(vagrant_root) # Folder name only. Used as t require 'yaml' if !File.exist?(vagrant_root + '/vagrant.yml') @ui.error 'Configuration file not found! Please copy vagrant.yml.dist to vagrant.yml and try again.' + exit end $vconfig = YAML::load_file(vagrant_root + '/vagrant.yml') @@ -78,7 +79,8 @@ end # Vagrant should NOT be run as root/admin. if running_as_root # || running_as_admin - raise "Vagrant should be run as a regular user to avoid issues." + @ui.error "Vagrant should be run as a regular user to avoid issues." + exit end ###################################################################### From e944118495dda57b1fe6da148da524e756c93959 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 7 May 2015 11:33:48 -0400 Subject: [PATCH 10/13] compose_autostart: false --- vagrant.yml.dist | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vagrant.yml.dist b/vagrant.yml.dist index 58665be..3561e21 100644 --- a/vagrant.yml.dist +++ b/vagrant.yml.dist @@ -33,5 +33,5 @@ hosts: #- ip: 192.168.10.12 #- ip: 192.168.10.13 -# Automatically start containers if docker-compose.yml is present in the current directory (default: true). -compose_autostart: true +# Automatically start containers if docker-compose.yml is present in the current directory (default: false). +compose_autostart: false From f7ca8452196bdf2490d2e6cfa3dd607cb91bc13d Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 7 May 2015 11:40:26 -0400 Subject: [PATCH 11/13] Updating SMB2 option docs --- README.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 856034a..2626920 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,10 @@ The best balance between performance and convenience can be achieved with NFS on Additional steps are required to get SMB or rsync to work on Windows. [See below](#synced-folders-win). +In addition to the stock SMB synced folders option this box provides an experimental one: [SMB2](#synced-folders-smb2). +With the **SMB2** option you will receive several "elevated command prompt" prompts which you accept. +No need to enter usernames and passwords unlike the stock SMB option Vagrant ships with. + ### Mac @@ -87,11 +91,13 @@ To use the SMB synced folder type: While using SMB you have to control Vagrant from an elevated (run as admin) Git Bash shell. + **SMB2 (experimental option)** This is an experimental option. -Compared to `smb`, `smb2` does not require running vagrant as admin. -With this option Vagrant will automatically create a user, SMB share and mount it. +Compared to **SMB**, **SMB2** does not require running vagrant as admin and does not prompt for username and password. +You will receive several "elevated command prompt" prompts which you accept. +Vagrant will automatically create a user, set correct file permissions, create the SMB share, and mount it. **Enabling rsync** From c0a998580123130e869d83012e7bdf4b1865e12c Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 7 May 2015 11:42:41 -0400 Subject: [PATCH 12/13] Updating changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f29f890..6fbd879 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 0.12.0 (2015-05-07) + +- Use our own vagrant box - [blinkreaction/boot2docker](https://vagrantcloud.com/blinkreaction/boxes/boot2docker) + - Updated Docker to v1.6.0 + - Updated Docker Compose to v1.2.0 +- [SMB2 (experimental)] sync folder option for Windows - complete automation of SMB sharing setup. +- Automatically start containers if docker-compose.yml is present in the Vagrantfile directory (single project mode) +- Miscellaneous code cleanup + ## 0.11.1 (2015-04-09) - Hotfix: added check for empty hosts in vagrant.yml From 4b09a85ef33903579c1244e5e7e74c55f464c8a3 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 7 May 2015 11:42:50 -0400 Subject: [PATCH 13/13] Bumping version to v.0.12.0 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 027934e..d33c3a2 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.11.1 \ No newline at end of file +0.12.0 \ No newline at end of file