From f06439b7dd9c52717df7a50da4b4c794ab1e48b7 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Wed, 4 Nov 2015 16:11:18 -0500 Subject: [PATCH 01/15] Typo: vboxfs => vboxsf --- README.md | 8 ++++---- Vagrantfile | 2 +- vagrant.yml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 4ab69f0..a344e0b 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ Boot2docker Vagrant box for optimized Docker and Docker Compose use on Mac and W ## What is this? This is a temporary solution to achieve better performance with synced folders and docker data volumes on Mac and Windows. -The stock boot2docker currently mounts host volumes via the default VirtualBox Guest Additions (vboxfs) mode, which is terribly slow. Much better performance can be achieved with NFS, SMB or rsync. +The stock boot2docker currently mounts host volumes via the default VirtualBox Guest Additions (vboxsf) mode, which is terribly slow. Much better performance can be achieved with NFS, SMB or rsync. ## Prerequisites @@ -69,7 +69,7 @@ Run the following command within your `` (shared boo2docker VM for mul ## Synced Folders options This box supports all [Synced Folder](http://docs.vagrantup.com/v2/synced-folders/) options provided by Vagrant: -- vboxfs - native VirtualBox method, cross-platform, convenient and reliable, terribly slow +- vboxsf - native VirtualBox method, cross-platform, convenient and reliable, terribly slow - NFS - better performance and convenience for Mac - SMB - better performance and convenience for Windows (on par with NFS on Mac) - rsync - best performance, cross-platform, one-way only @@ -89,7 +89,7 @@ If you use rsync, you'll have to run `vagrant rsync-auto` in a separate terminal ### Mac Option comparison for Mac Drupal developers (using `time drush si -y` as a test case): -- vboxfs: 6x (slowest) +- vboxsf: 6x (slowest) - NFS: 1.3x - rsync: 1x (fastest) @@ -99,7 +99,7 @@ NFS provides good performance and convenience. It is the default and recommended ### Windows Option comparison for Windows Drupal developers (using `time drush si -y` as a test case): -- vboxfs: 5x (slowest) +- vboxsf: 5x (slowest) - SMB: 2x - rsync: 1x (fastest) diff --git a/Vagrantfile b/Vagrantfile index cb52504..e88c069 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -176,7 +176,7 @@ Vagrant.configure("2") do |config| rsync__args: ["--verbose", "--archive", "--delete", "-z", "--chmod=ugo=rwX"] end end - # vboxfs: reliable, cross-platform and terribly slow performance + # vboxsf: reliable, cross-platform and terribly slow performance else @ui.warn "WARNING: defaulting to the slowest folder sync option (vboxfs)" config.vm.synced_folder vagrant_root, vagrant_mount_point, diff --git a/vagrant.yml b/vagrant.yml index 009fa3a..b0f980b 100644 --- a/vagrant.yml +++ b/vagrant.yml @@ -6,7 +6,7 @@ synced_folders: # 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. + # vboxsf (or leave empty): best compatibility and ease of setup, but poor performance. type: 'nfs2' # 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. From bf3d068f2486bdbe69e5ae03dd290e8ae3de944f Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Wed, 4 Nov 2015 16:14:36 -0500 Subject: [PATCH 02/15] Switching to vagrant-gatling-rsync. Auto start rsync-auto in background. --- Vagrantfile | 39 +++++++++++++++++++++++++++++++++------ vagrant.yml | 10 +++++++++- 2 files changed, 42 insertions(+), 7 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index e88c069..8e8fc66 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -2,7 +2,7 @@ @ui = Vagrant::UI::Colored.new # Install required plugins if not present. -required_plugins = %w(vagrant-triggers) +required_plugins = ["vagrant-triggers", "vagrant-gatling-rsync"] required_plugins.each do |plugin| need_restart = false unless Vagrant.has_plugin? plugin @@ -163,17 +163,44 @@ Vagrant.configure("2") do |config| SCRIPT s.args = "#{vagrant_folder_name} #{vagrant_mount_point} #{$vconfig['synced_folders']['smb_username']} #{$vconfig['synced_folders']['smb_password']} #{host_ip}" end - # rsync: the best performance, cross-platform platform, one-way only. Run `vagrant rsync-auto` to start auto sync. + # rsync: the best performance, cross-platform platform, one-way only. elsif synced_folders['type'] == "rsync" + # Construct and array for rsync_exclude + rsync_exclude = [] + unless synced_folders['rsync_exclude'].nil? + for item in synced_folders['rsync_exclude'] do + rsync_exclude.push(item) + end + end + # Only sync explicitly listed folders. - if (synced_folders['folders']).nil? - @ui.warn "WARNING: 'folders' list cannot be empty when using 'rsync' sync type. Please check your vagrant.yml file." + if (synced_folders['rsync_folders']).nil? + @ui.error "ERROR: 'folders' list cannot be empty when using 'rsync' sync type. Please check your vagrant.yml file." + exit else - for synced_folder in synced_folders['folders'] do + for synced_folder in synced_folders['rsync_folders'] do 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"] + rsync__exclude: rsync_exclude, + end + end + # Configure vagrant-gatling-rsync + config.gatling.rsync_on_startup = false + config.gatling.latency = synced_folders['rsync_latency'] + config.gatling.time_format = "%H:%M:%S" + + # Launch gatling-rsync-auto in the background + if synced_folders['rsync_auto'] + [:up, :reload].each do |trigger| + config.trigger.after trigger do + info "Starting background rsync-auto process..." + info "Run 'tail -f #{vagrant_root}/rsync.log' to see logs." + # Kill the old sync process + run "bash -c \"kill $(ps aux | grep 'ruby.*vagrant gatling-rsync-auto' | grep -v grep | awk '{ print $2 }') >/dev/null 2>&1 || true\"" + # Start a new sync process in background + run 'bash -c "vagrant gatling-rsync-auto > rsync.log &"' + end end end # vboxsf: reliable, cross-platform and terribly slow performance diff --git a/vagrant.yml b/vagrant.yml index b0f980b..198aab6 100644 --- a/vagrant.yml +++ b/vagrant.yml @@ -19,10 +19,18 @@ synced_folders: # 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. # Note: you'll have to run `vagrant rsync-auto` in the background to keep the files in sync as you make changes - folders: + rsync_folders: #- "projectA" # rsync projectA folder #- "projectB" # rsync projectB folder #- "" # rsync the whole folder. WARNING: don't do this if your folder is big. + # Coalescing threshold in seconds for https://github.com/smerrill/vagrant-gatling-rsync + rsync_latency: 0.5 + # Start rsync-auto automatically + rsync_auto: true + # Patterns excluded from rsync. Passed as --exclude to rsync. + rsync_exclude: + - ".git/" + #- "files/" # VirtualBox VM settings v.gui: false # Set to true for debugging. Will unhide VM's primary console screen. From 61c463209bf45633c0680dda7fe9d1b72c177489 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Wed, 4 Nov 2015 16:15:52 -0500 Subject: [PATCH 03/15] Revise default rsync options --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index 8e8fc66..cafd3f5 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -181,8 +181,8 @@ Vagrant.configure("2") do |config| for synced_folder in synced_folders['rsync_folders'] do config.vm.synced_folder "#{vagrant_root}/#{synced_folder}", "#{vagrant_mount_point}/#{synced_folder}", type: "rsync", - rsync__args: ["--verbose", "--archive", "--delete", "-z", "--chmod=ugo=rwX"] rsync__exclude: rsync_exclude, + rsync__args: ["--archive", "--delete", "--compress", "--whole-file"] end end # Configure vagrant-gatling-rsync From b5560fa2fd8111fd5ba65a63dae73ea491464ea8 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Wed, 4 Nov 2015 16:16:34 -0500 Subject: [PATCH 04/15] Revise default vboxsf options --- Vagrantfile | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index cafd3f5..879e3d3 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -205,9 +205,8 @@ Vagrant.configure("2") do |config| end # vboxsf: reliable, cross-platform and terribly slow performance else - @ui.warn "WARNING: defaulting to the slowest folder sync option (vboxfs)" - config.vm.synced_folder vagrant_root, vagrant_mount_point, - mount_options: ["dmode=770", "fmode=660"] + @ui.warn "WARNING: defaulting to the slowest folder sync option (vboxsf)" + config.vm.synced_folder vagrant_root, vagrant_mount_point end # Make host home directory available to containers in /.home From 89f76bcf800f510ab1661db49aaf6fc9a978dff6 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Wed, 4 Nov 2015 16:17:27 -0500 Subject: [PATCH 05/15] Provide a way to defined individual mounts --- Vagrantfile | 14 ++++++++++++++ vagrant.yml | 12 ++++++++++++ 2 files changed, 26 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index 879e3d3..ec73c77 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -209,6 +209,20 @@ Vagrant.configure("2") do |config| config.vm.synced_folder vagrant_root, vagrant_mount_point end + # Individual mounts + unless synced_folders['individual_mounts'].nil? + for synced_folder in synced_folders['individual_mounts'] do + if synced_folder['type'] == 'vboxsf' + config.vm.synced_folder synced_folder['location'], synced_folder['mount'], + mount_options: [synced_folder['options']] + elsif synced_folder['type'] == 'nfs' + config.vm.synced_folder synced_folder['location'], synced_folder['mount'], + type: "nfs", + mount_options: [synced_folder['options']] + end + end + end + # Make host home directory available to containers in /.home if File.directory?(File.expand_path("~")) config.vm.synced_folder "~", "/.home" diff --git a/vagrant.yml b/vagrant.yml index 198aab6..a42d639 100644 --- a/vagrant.yml +++ b/vagrant.yml @@ -31,6 +31,18 @@ synced_folders: rsync_exclude: - ".git/" #- "files/" + # List of folders to mount individually. This is really only needed in the case where you want a container to write + # something back to the Host OS. If that describes your situation, use type = vboxsf. If you just want more control + # over what's mounted, go with type = nfs, which is much faster. + individual_mounts: + #- location: './logs' + # mount: '/home/docker/logs' + # type: 'vboxsf' + # options: 'uid=501,gid=20' + #- location: './logs' + # mount: '/home/docker/logs' + # type: 'nfs' + # options: 'nolock,vers=3,tcp' # VirtualBox VM settings v.gui: false # Set to true for debugging. Will unhide VM's primary console screen. From c8f4a8c311030905810799f50dd3b1e65361e625 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Thu, 5 Nov 2015 23:12:25 -0500 Subject: [PATCH 06/15] Background rsync-auto improvements. Mac only --- Vagrantfile | 18 +++++++++++++----- vagrant.yml | 4 ++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index ec73c77..4dd1252 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -191,15 +191,23 @@ Vagrant.configure("2") do |config| config.gatling.time_format = "%H:%M:%S" # Launch gatling-rsync-auto in the background - if synced_folders['rsync_auto'] - [:up, :reload].each do |trigger| + if synced_folders['rsync_auto'] && !is_windows + [:up, :reload, :resume].each do |trigger| config.trigger.after trigger do - info "Starting background rsync-auto process..." + success "Starting background rsync-auto process..." info "Run 'tail -f #{vagrant_root}/rsync.log' to see logs." # Kill the old sync process - run "bash -c \"kill $(ps aux | grep 'ruby.*vagrant gatling-rsync-auto' | grep -v grep | awk '{ print $2 }') >/dev/null 2>&1 || true\"" + `kill $(pgrep -f rsync-auto) > /dev/null 2>&1 || true` # Start a new sync process in background - run 'bash -c "vagrant gatling-rsync-auto > rsync.log &"' + `vagrant gatling-rsync-auto >> rsync.log &` + end + end + [:halt, :suspend, :destroy].each do |trigger| + config.trigger.before trigger do + # Kill rsync-auto process + success "Stopping background rsync-auto process..." + `kill $(pgrep -f rsync-auto) > /dev/null 2>&1 || true` + `rm -f rsync.log` end end end diff --git a/vagrant.yml b/vagrant.yml index a42d639..163bd2a 100644 --- a/vagrant.yml +++ b/vagrant.yml @@ -5,7 +5,7 @@ synced_folders: # smb: better performance on Windows. Requires Vagrant to be run with admin privileges. # 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. + # When using rsync sync type the "rsync_folders" list below is mandatory. # vboxsf (or leave empty): best compatibility and ease of setup, but poor performance. type: 'nfs2' # smb_user, smb_password - The username and password used for authentication to mount the SMB mount. @@ -25,7 +25,7 @@ synced_folders: #- "" # rsync the whole folder. WARNING: don't do this if your folder is big. # Coalescing threshold in seconds for https://github.com/smerrill/vagrant-gatling-rsync rsync_latency: 0.5 - # Start rsync-auto automatically + # Start rsync-auto automatically (Mac only for now) rsync_auto: true # Patterns excluded from rsync. Passed as --exclude to rsync. rsync_exclude: From 6da6874657935c26a27a20426d1d6523a981790e Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Mon, 9 Nov 2015 21:57:18 -0500 Subject: [PATCH 07/15] Add "group=system" label to dns and vhost-proxy containers --- Vagrantfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index 4dd1252..bd1ea9f 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -285,8 +285,9 @@ Vagrant.configure("2") do |config| s.inline = <<-SCRIPT echo "Starting system-wide DNS service... " docker rm -f dns > /dev/null 2>&1 || true - docker run -d --name dns -p $1:53:53/udp -p 172.17.42.1:53:53/udp --cap-add=NET_ADMIN \ - --dns 8.8.8.8 -v /var/run/docker.sock:/var/run/docker.sock \ + docker run -d --name dns --label "group=system" \ + -p $1:53:53/udp -p 172.17.42.1:53:53/udp --cap-add=NET_ADMIN --dns 8.8.8.8 \ + -v /var/run/docker.sock:/var/run/docker.sock \ blinkreaction/dns-discovery@sha256:f1322ab6d5496c8587e59e47b0a8b1479a444098b40ddd598e85e9ab4ce146d8 > /dev/null SCRIPT s.args = "#{box_ip}" @@ -300,7 +301,8 @@ Vagrant.configure("2") do |config| s.inline = <<-SCRIPT echo "Starting system-wide HTTP/HTTPS reverse proxy on $1... " docker rm -f vhost-proxy > /dev/null 2>&1 || true - docker run -d --name vhost-proxy -p $1:80:80 -p $1:443:443 -v /var/run/docker.sock:/tmp/docker.sock \ + docker run -d --name vhost-proxy --label "group=system" -p $1:80:80 -p $1:443:443 \ + -v /var/run/docker.sock:/tmp/docker.sock \ blinkreaction/nginx-proxy@sha256:1707c0fd2fa4f0e98a656f748a4edb8a04578e9dc63115acc23a05225f151e04 > /dev/null SCRIPT s.args = "#{box_ip}" From c2819a4cfadcd6c03d10b86b16d78b5921773a20 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Mon, 9 Nov 2015 22:01:07 -0500 Subject: [PATCH 08/15] Update versions: b2d base box v1.9.0, docker v1.9.0, docker-compose v1.5.0 --- Vagrantfile | 2 +- scripts/presetup-mac.sh | 4 ++-- scripts/presetup-win.sh | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index bd1ea9f..59a2138 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -98,7 +98,7 @@ Vagrant.configure("2") do |config| config.vm.define "boot2docker" config.vm.box = "blinkreaction/boot2docker" - config.vm.box_version = "1.8.3" + config.vm.box_version = "1.9.0" config.vm.box_check_update = true ## Network ## diff --git a/scripts/presetup-mac.sh b/scripts/presetup-mac.sh index 065a056..d8edc49 100755 --- a/scripts/presetup-mac.sh +++ b/scripts/presetup-mac.sh @@ -1,7 +1,7 @@ #!/bin/bash -DOCKER_VERSION=1.8.3 -DOCKER_COMPOSE_VERSION=1.4.2 +DOCKER_VERSION=1.9.0 +DOCKER_COMPOSE_VERSION=1.5.0 # Console colors red='\033[0;31m' diff --git a/scripts/presetup-win.sh b/scripts/presetup-win.sh index 72f911c..bf2eb10 100644 --- a/scripts/presetup-win.sh +++ b/scripts/presetup-win.sh @@ -1,7 +1,7 @@ #!/bin/bash -DOCKER_VERSION=1.8.3 -DOCKER_COMPOSE_VERSION=1.4.2 +DOCKER_VERSION=1.9.0 +DOCKER_COMPOSE_VERSION=1.5.0 # For testing if [ ! $B2D_BRANCH == "" ]; then From b648d65479242d2259b7cd8815e11851810b3b44 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Tue, 10 Nov 2015 09:45:16 -0500 Subject: [PATCH 09/15] Install docker-compose as a binary on Windows --- scripts/presetup-win.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/scripts/presetup-win.sh b/scripts/presetup-win.sh index bf2eb10..b135266 100644 --- a/scripts/presetup-win.sh +++ b/scripts/presetup-win.sh @@ -20,12 +20,9 @@ cscript $WINDIR/Temp/presetup-win.vbs curl -L https://get.docker.com/builds/Windows/i386/docker-$DOCKER_VERSION.exe -o /usr/local/bin/docker chmod +x /usr/local/bin/docker -# Install Docker Compose (via pip) -pact install python-setuptools libxml2-devel libxslt-devel libyaml-devel -curl -skS https://bootstrap.pypa.io/get-pip.py | python -pip install virtualenv -curl -skS https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python -pip install -U docker-compose==$DOCKER_COMPOSE_VERSION +# Install Docker Compose +curl -L https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-Windows-x86_64.exe > /usr/local/bin/docker-compose +chmod +x /usr/local/bin/docker-compose # Git settings echo "Adjusting git defaults" From 5ec1f13ac468056a2de4df09248628dd5948b751 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Tue, 10 Nov 2015 12:39:23 -0500 Subject: [PATCH 10/15] Support authenticating against docker hub. Fixes: #36 Credits: @deviantintegral --- Vagrantfile | 11 +++++++++++ vagrant.yml | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/Vagrantfile b/Vagrantfile index 59a2138..b247a93 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -279,6 +279,17 @@ Vagrant.configure("2") do |config| SCRIPT end + # Let users provide credentials to log in to Docker Hub. + if $vconfig['docker_registry_auth'] + config.vm.provision "trigger", :option => "value" do |trigger| + trigger.fire do + info 'Authenticating with the Docker registry...' + system "docker -H localhost:2375 login" + end + end + config.vm.provision "file", source: "~/.docker/config.json", destination: ".docker/config.json" + end + # System-wide dnsmasq service for DNS discovery and name resolution # Image: blinkreaction/dns-discovery v1.0.0 config.vm.provision "shell", run: "always", privileged: false do |s| diff --git a/vagrant.yml b/vagrant.yml index 163bd2a..d88cd43 100644 --- a/vagrant.yml +++ b/vagrant.yml @@ -60,6 +60,11 @@ ip: #- 192.168.10.12 #- 192.168.10.13 +# Registry authentication. If your machine uses a private image, you must log in +# to the registry before running docker-machine up. This is especially useful +# when combined with compose_autostart: true. +docker_registry_auth: false + # Automatically start containers if docker-compose.yml is present in the current directory (default: false). compose_autostart: false From 81b85094444f1af0bd027cec81985eb07ffc0787 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Wed, 11 Nov 2015 11:32:57 -0500 Subject: [PATCH 11/15] Make sure smb2 vagrant user password never expires --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index b247a93..b6a62c1 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -52,7 +52,7 @@ if is_windows 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" + command_user = "net user #{smb_username} || ( net user #{smb_username} #{smb_password} /add && WMIC USERACCOUNT WHERE \"Name='vagrant'\" SET PasswordExpires=FALSE )" @ui.info "Adding vagrant user" windows_elevated_shell command_user From 22850f62796fcd4fa328ddb237f42f86457f9af6 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Wed, 11 Nov 2015 11:37:10 -0500 Subject: [PATCH 12/15] Fix permissions with smb2 - give all access --- Vagrantfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Vagrantfile b/Vagrantfile index b6a62c1..e56c114 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -159,7 +159,7 @@ Vagrant.configure("2") do |config| config.vm.provision "shell", run: "always" do |s| s.inline = <<-SCRIPT mkdir -p vagrant $2 - mount -t cifs -o uid=`id -u docker`,gid=`id -g docker`,sec=ntlm,username=$3,pass=$4,dir_mode=0755,file_mode=0644 //$5/$1 $2 + mount -t cifs -o uid=`id -u docker`,gid=`id -g docker`,sec=ntlm,username=$3,pass=$4,dir_mode=0777,file_mode=0666 //$5/$1 $2 SCRIPT s.args = "#{vagrant_folder_name} #{vagrant_mount_point} #{$vconfig['synced_folders']['smb_username']} #{$vconfig['synced_folders']['smb_password']} #{host_ip}" end From d6efe8d2091eeb79885e7e239346f2595b6c0e82 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Wed, 11 Nov 2015 12:08:00 -0500 Subject: [PATCH 13/15] Adding 'default' synced folder option --- Vagrantfile | 30 ++++++++++++++++++++---------- vagrant.yml | 10 ++++++---- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/Vagrantfile b/Vagrantfile index e56c114..32d18a5 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -118,28 +118,32 @@ Vagrant.configure("2") do |config| ## Synced folders configuration ## synced_folders = $vconfig['synced_folders'] - # nfs: better performance on Mac + # nfs: Better performance on Mac if synced_folders['type'] == "nfs" && !is_windows + @ui.success "Using nfs synced folder option" 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 - # nfs2: better performance on Mac, experimental - elsif synced_folders['type'] == "nfs2" && !is_windows + # nfs2: Optimized NFS settings for even better performance on Mac, experimental + elsif ( synced_folders['type'] == "nfs2" || synced_folders['type'] == "default" ) && !is_windows + @ui.success "Using nfs2 synced folder option" config.vm.synced_folder vagrant_root, vagrant_mount_point, type: "nfs", mount_options: ["nolock", "noacl", "nocto", "noatime", "nodiratime", "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. + # smb: Better performance on Windows. Requires Vagrant to be run with admin privileges. elsif synced_folders['type'] == "smb" && is_windows + @ui.success "Using smb synced folder option" config.vm.synced_folder vagrant_root, vagrant_mount_point, type: "smb", smb_username: synced_folders['smb_username'], smb_password: synced_folders['smb_password'] - # smb2: experimental, does not require running vagrant as admin. - elsif synced_folders['type'] == "smb2" && is_windows + # smb2: Better performance on Windows. Does not require running vagrant as admin. + elsif ( synced_folders['type'] == "smb2" || synced_folders['type'] == "default" ) && is_windows + @ui.success "Using smb2 synced folder option" if $vconfig['synced_folders']['smb2_auto'] # Create the share before 'up'. @@ -165,6 +169,8 @@ Vagrant.configure("2") do |config| end # rsync: the best performance, cross-platform platform, one-way only. elsif synced_folders['type'] == "rsync" + @ui.success "Using rsync synced folder option" + # Construct and array for rsync_exclude rsync_exclude = [] unless synced_folders['rsync_exclude'].nil? @@ -174,7 +180,7 @@ Vagrant.configure("2") do |config| end # Only sync explicitly listed folders. - if (synced_folders['rsync_folders']).nil? + if synced_folders['rsync_folders'].nil? @ui.error "ERROR: 'folders' list cannot be empty when using 'rsync' sync type. Please check your vagrant.yml file." exit else @@ -212,13 +218,17 @@ Vagrant.configure("2") do |config| end end # vboxsf: reliable, cross-platform and terribly slow performance - else - @ui.warn "WARNING: defaulting to the slowest folder sync option (vboxsf)" - config.vm.synced_folder vagrant_root, vagrant_mount_point + elsif synced_folders['type'] == "vboxsf" + @ui.warn "WARNING: Using the SLOWEST folder sync option (vboxsf)" + config.vm.synced_folder vagrant_root, vagrant_mount_point + # Warn if neither synced_folder not individual_mounts is enabled + elsif synced_folders['individual_mounts'].nil? + @ui.error "ERROR: Synced folders not enabled or misconfigured. The VM will not have access to files on the host." end # Individual mounts unless synced_folders['individual_mounts'].nil? + @ui.success "Using individual_mounts synced folder option" for synced_folder in synced_folders['individual_mounts'] do if synced_folder['type'] == 'vboxsf' config.vm.synced_folder synced_folder['location'], synced_folder['mount'], diff --git a/vagrant.yml b/vagrant.yml index d88cd43..0abd5f4 100644 --- a/vagrant.yml +++ b/vagrant.yml @@ -1,13 +1,15 @@ # Sync folders configuration synced_folders: # nfs: better performance on Mac, recommended. - # nfs2: optimized NFS settings, experimental. + # nfs2: optimized NFS settings, experimental (default for Mac). # smb: better performance on Windows. Requires Vagrant to be run with admin privileges. - # smb2: experimental, does not require running vagrant as admin. + # smb2: better performance on Windows. Does not require running vagrant as admin (default for Windows). # rsync: the best performance, cross-platform platform, one-way only. Run `vagrant rsync-auto` to start auto sync. # When using rsync sync type the "rsync_folders" list below is mandatory. - # vboxsf (or leave empty): best compatibility and ease of setup, but poor performance. - type: 'nfs2' + # vboxsf: best compatibility and ease of setup, but poor performance. + # default: defaults to nfs2 on Mac and smb2 on Windows. + # '': disable synced folders. Useful in case you want to use 'individual_mounts' option below. + type: 'default' # 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. # If using the 'smb2' type above the user and share will be configured automatically. From 627b9f5e07fb6eebe884642a86cd4759c3b2f837 Mon Sep 17 00:00:00 2001 From: Leonid Makarov Date: Wed, 11 Nov 2015 12:08:18 -0500 Subject: [PATCH 14/15] Reorganized docs --- README.md | 262 ++++--------------------------------- docs/networking.md | 97 ++++++++++++++ docs/synced-folders.md | 42 ++++++ docs/tips.md | 33 +++++ docs/vm-settings.md | 10 ++ scripts/presetup-ubuntu.sh | 83 ++++++++++++ vagrant.yml | 12 +- 7 files changed, 295 insertions(+), 244 deletions(-) create mode 100644 docs/networking.md create mode 100644 docs/synced-folders.md create mode 100644 docs/tips.md create mode 100644 docs/vm-settings.md create mode 100644 scripts/presetup-ubuntu.sh diff --git a/README.md b/README.md index a344e0b..a4fba67 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,12 @@ # Boot2docker Vagrant Box Boot2docker Vagrant box for optimized Docker and Docker Compose use on Mac and Windows. + ## What is this? -This is a temporary solution to achieve better performance with synced folders and docker data volumes on Mac and Windows. -The stock boot2docker currently mounts host volumes via the default VirtualBox Guest Additions (vboxsf) mode, which is terribly slow. Much better performance can be achieved with NFS, SMB or rsync. + +This is a temporary solution to achieve better performance with synced folders and docker data volumes on Mac and Windows. + +The stock boot2docker/docker-machine mounts host volumes via VirtualBox Guest Additions (vboxsf) mode, which is is terribly slow. Much better performance can be achieved with **nfs** (Mac), **smb** (Windows) or **rsync** (Mac and Windows). ## Prerequisites @@ -11,10 +14,10 @@ The stock boot2docker currently mounts host volumes via the default VirtualBox G 2. [Vagrant](https://www.vagrantup.com/) 1.7.3+ 3. [Babun](http://babun.github.io) - A Linux-type shell, **Windows only** -Proceed to [Setup and usage](#setup) if you already have all prerequisites installed or prefer to install some/all manually. +For best result and a clean setup it is recommended to remove any previous versions of VirtualBox, Vagrant, boot2docker, docker and docker-compose. -Automatic **installation** and **updates** of prerequisites is available via the following one-liners. -Make sure to stop all VirtualBox VMs prior to performing updates. +Automatic **installation** and **updates** of prerequisites is available via the one-liners below. +**Make sure to stop all VirtualBox VMs prior to performing updates.** **Mac** @@ -24,265 +27,46 @@ Prerequisites are installed using **brew/cask** (brew and cask will be installed **Windows** -**On Windows you will need a good Linux-type shell. [Babun](http://babun.github.io) is a great option. All automated scripts and instructions in this project assume using Babun shell and were not tested with other CYGWIN shells.** +**All automated scripts and instructions in this project assume using Babun shell and are not tested with other shells.** Prerequisites are installed using **babun** and **chocolatey** (chocolatey will be installed if missing). -**Docker Compose will be installed natively on Windows via pip!** - -1. Download and install [Babun](http://babun.github.io) -2. Run the following in babun - - ``` bash <(curl -s https://raw.githubusercontent.com/blinkreaction/boot2docker-vagrant/master/scripts/presetup-win.sh) - ``` + ## Setup and usage -### Automatic installation (Mac and Windows) +### Automatic installation -Run the following command within your `` (shared boo2docker VM for multiple projects, recommended) or `` (dedicated boot2docker VM) directory: +Designate a root folder that the VM will have access to (e.g. `~/Projects`) and run there: bash <(curl -s https://raw.githubusercontent.com/blinkreaction/boot2docker-vagrant/master/scripts/setup.sh) -### Manual installation (Mac and Windows) +### Manual installation -1. Copy `Vagrantfile` and `vagrant.yml` files from this repo into your `` (shared boo2docker VM for multiple projects, recommended) or `` (dedicated boot2docker VM) directory. -2. Rename `vagrant.yml.dist` to `vagrant.yml` -3. Launch Terminal (Mac) or Babun (Windows) -4. cd to ``, start the VM +1. Copy `Vagrantfile` and `vagrant.yml` into a designated folder +2. Inside the folder run ``` - cd vagrant up ``` -5. Verify installation +3. Verify your setup by checking docker client and server versions - ``` + ``` docker version - docker-compose --version ``` - -## Synced Folders options - -This box supports all [Synced Folder](http://docs.vagrantup.com/v2/synced-folders/) options provided by Vagrant: -- vboxsf - native VirtualBox method, cross-platform, convenient and reliable, terribly slow -- NFS - better performance and convenience for Mac -- SMB - better performance and convenience for Windows (on par with NFS on Mac) -- rsync - best performance, cross-platform, one-way only - -Follow the instructions in the `vagrant.yml` file to switch between different sync options. -The best balance between performance and convenience can be achieved with NFS on Mac (default) and SMB on Windows (not default). - -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. - -If you use rsync, you'll have to run `vagrant rsync-auto` in a separate terminal to keep the files in sync as you make changes. - - -### Mac - -Option comparison for Mac Drupal developers (using `time drush si -y` as a test case): -- vboxsf: 6x (slowest) -- NFS: 1.3x -- rsync: 1x (fastest) - -NFS provides good performance and convenience. It is the default and recommended option on Mac. - - -### Windows - -Option comparison for Windows Drupal developers (using `time drush si -y` as a test case): -- vboxsf: 5x (slowest) -- SMB: 2x -- rsync: 1x (fastest) - -SMB provides good performance and convenience. It is the recommended option, but NOT the default one on Windows. - -**Enabling SMB** - -To use the SMB synced folder type: - -1. Stop the VM with: `vagrant halt` -2. Choose `smb` as the sync type in the `vagrant.yml` file. -3. Launch Git Bash as an administrator -4. Start the VM: `vagrant up` - -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 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** - -rsync is not natively available on Windows. -Git for Windows comes with Git Bash shell, which is based on [MinGW/MSYS](http://www.mingw.org/wiki/msys). -MSYS has a package for rsync, which can be installed and accessed via Git Bash. - -To use rsync on Windows: - -1. Download and extract the content on this [archive](https://drive.google.com/open?id=0B130F0xKxOWCTUN1d3djZGZ0M2M&authuser=0) into the `bin` directory of your Git installation (e.g. `c:\Program Files (x86)\Git\bin\`). -2. Choose `rsync` as the sync type in the `vagrant.yml` file. -3. Provide an explicit list of folders to sync in the `vagrant.yml` file (`folders` sequence). -4. Reload the VM: `vagrant reload` -5. Run `vagrant rsync-auto` to keep the files in sync as you make changes. - - -## VirtualBox VM settings - -Open `vagrant.yml` file and edit respective values. - -- `v.gui` - Set to `true` for debugging. This will unhide VM's primary console screen. Default: `false`. -- `v.memory` - Memory settings (MB). Default: `2048`. -- `v.cpus: 1` - number of virtual CPU cores. Default: `1`. - -Please note, VirtualBox works much better with a single CPU in most cases, this it is not recommended to change the `v.cpus` value. - - -## Network settings - -The default box private network IP is `192.168.10.10`. -To map additional IP addresses for use with multiple projects open `vagrant.yml` and ucomment respective lines: - -```yaml -hosts: - - ip: 192.168.10.11 - - ip: 192.168.10.12 - - ip: 192.168.10.13 -``` - -Project specific `:` mapping for containers is done in via docker-compose in `docker-compose.yml` - - -## vhost-proxy - -As an alternative to using dedicated IPs for different projects a built-in vhost-proxy container can be used. -It binds to `192.168.10.10:80` (the default box IP address) and routes web requests based on the `Host` header. - -### How to use -- Set `vhost_proxy: true` in your vagrant.yml file and do a 'vagrant reload' -- Set the `VIRTUAL_HOST` environment variable for the web container in your setup (e.g. `VIRTUAL_HOST=example.com`) -- Add an entry in your hosts file (e.g. `/etc/hosts`) to point the domain to the default box IP (`192.168.10.10`) - - As an alternative see [Wildcard DNS](#dns) instructions below -- Multiple domain names can be separated by comas: `VIRTUAL_HOST=example.com,www.example.com` - -Example docker run - -``` -docker run --name nginx -d -e "VIRTUAL_HOST=example.com" nginx:latest -``` - -Example docker-compose.yml entry - -``` -# Web node -web: - image: nginx:latest - ports: - - "80" - environment: - - VIRTUAL_HOST=example.com -``` - -Example hosts file entry - -``` -192.168.10.10 example.com -``` - -It is completely fine to use both the vhost-proxy approach and the dedicated IPs approach concurently: - - `"80"` - expose port "80", docker will randomly pick an available port on the Docker Host - - `"192.168.10.11:80:80"` - dedicated IP:port mapping - - -## DNS and service discovery - -### DNS resolution - -The built-in `dns` container can be used to resolve all `*.drude` domain names to `192.168.10.10` (VM's primary IP address), where vhost-proxy listens on port 80. - -**Mac** - -``` -sudo mkdir -p /etc/resolver -echo -e "\n# .drude domain resolution\nnameserver 192.168.10.10" | sudo tee -a /etc/resolver/drude -``` - -**Windows** - -On Windows add `192.168.10.10` as the primary DNS server and your LAN/ISP/Google DNS as secondary. - - -### Service discovery - -The built-in `dns` container can also be used for local DNS based service discovery. -You can define an arbitrary domain name via the `DOMAIN_NAME` environment variable for any container and it will be resolved to the internal IP address of that container. - -**Example** - -``` -docker run --name nginx -d -e "DOMAIN_NAME=my-project.web.docker" nginx:latest -docker run busybox ping my-project.web.docker -c 1 -``` - -``` -PING my_project.web.docker (172.17.42.8): 56 data bytes -64 bytes from 172.17.42.8: seq=0 ttl=64 time=0.052 ms -... - -``` - -Multiple domain names can be separated by comas: `DOMAIN_NAME=my-project.web.docker,www.my-project.web.docker` - -## Tips - -### Automate DOCKER_HOST variable export - -This is only necessary for manual instllations. On Mac the [setup.sh](setup.sh) scripts takes care of this for you. - -Add the following in your .bashrc, .zshrc, etc. file to automate the environment variable export: - - # Docker (default for Vagrant based boxes) - export DOCKER_HOST=tcp://localhost:2375 - -If you also have `$(boot2docker shellinit)` there, then make sure those lines go BEFORE it, e.g.: - - # Docker (default for Vagrant based boxes) - export DOCKER_HOST=tcp://localhost:2375 - - # boot2docker shellinit - $(boot2docker shellinit) - -This way if boot2docker is NOT running, your `DOCKER_HOST` will default to `tcp://localhost:2375`. -Otherwise `$(boot2docker shellinit)` will overwrite the variables and set `DOCKER_HOST` to point to the boot2docker VM. - -### Vagrant control -Vagrant can be controlled (e.g. `vagrant up`, `vagrant ssh`, `vagrant reload`, etc.) from the root directory of the Vagrantfile as well as from any subdirectory. This is very usefull when working with multiple projects in subdirectories. - -### Sublime Text 3 users -Add this to your user settings (Sublime Text > Preferences > Settings - User): - - { - "atomic_save": false - } -ST3 does not update the ctime extended file attribute when saving a file. This leads to NFS not seeing the changes in a file unless the file size changes as well (i.e. changing a single symbol in a file with ST3 will not be visible over NFS). The setting above fixes that. +## Documentation - -## troubleshooting +- [Synced folders](docs/synced-folders.md) +- [VirtualBox VM settings](docs/vm-settings.md) +- [Networking](docs/networking.md) +- [Troubleshooting](docs/troubleshooting.md) +- [Tips](docs/tips.md) -See [Troubleshooting](docs/troubleshooting.md) section of the docs. ## License diff --git a/docs/networking.md b/docs/networking.md new file mode 100644 index 0000000..bc6f973 --- /dev/null +++ b/docs/networking.md @@ -0,0 +1,97 @@ +# Networking + + +## VM network settings + +The default box private network IP is `192.168.10.10`. +To map additional IP addresses for use with multiple projects open `vagrant.yml` and ucomment respective lines: + +```yaml +hosts: + - ip: 192.168.10.11 + - ip: 192.168.10.12 + - ip: 192.168.10.13 +``` + +Project specific `:` mapping for containers is done in via docker-compose in `docker-compose.yml` + + +## vhost-proxy + +As an alternative to using dedicated IPs for different projects a built-in vhost-proxy container can be used. +It binds to `192.168.10.10:80` (the default box IP address) and routes web requests based on the `Host` header. + +### How to use +- Set `vhost_proxy: true` in your vagrant.yml file and do a 'vagrant reload' +- Set the `VIRTUAL_HOST` environment variable for the web container in your setup (e.g. `VIRTUAL_HOST=example.com`) +- Add an entry in your hosts file (e.g. `/etc/hosts`) to point the domain to the default box IP (`192.168.10.10`) + - As an alternative see [Wildcard DNS](#dns) instructions below +- Multiple domain names can be separated by comas: `VIRTUAL_HOST=example.com,www.example.com` + +Example docker run + +``` +docker run --name nginx -d -e "VIRTUAL_HOST=example.com" nginx:latest +``` + +Example docker-compose.yml entry + +``` +# Web node +web: + image: nginx:latest + ports: + - "80" + environment: + - VIRTUAL_HOST=example.com +``` + +Example hosts file entry + +``` +192.168.10.10 example.com +``` + +It is completely fine to use both the vhost-proxy approach and the dedicated IPs approach concurently: + - `"80"` - expose port "80", docker will randomly pick an available port on the Docker Host + - `"192.168.10.11:80:80"` - dedicated IP:port mapping + + +## DNS and service discovery + +### DNS resolution + +The built-in `dns` container can be used to resolve all `*.drude` domain names to `192.168.10.10` (VM's primary IP address), where vhost-proxy listens on port 80. + +**Mac** + +``` +sudo mkdir -p /etc/resolver +echo -e "\n# .drude domain resolution\nnameserver 192.168.10.10" | sudo tee -a /etc/resolver/drude +``` + +**Windows** + +On Windows add `192.168.10.10` as the primary DNS server and your LAN/ISP/Google DNS as secondary. + + +### Service discovery + +The built-in `dns` container can also be used for local DNS based service discovery. +You can define an arbitrary domain name via the `DOMAIN_NAME` environment variable for any container and it will be resolved to the internal IP address of that container. + +**Example** + +``` +docker run --name nginx -d -e "DOMAIN_NAME=my-project.web.docker" nginx:latest +docker run busybox ping my-project.web.docker -c 1 +``` + +``` +PING my_project.web.docker (172.17.42.8): 56 data bytes +64 bytes from 172.17.42.8: seq=0 ttl=64 time=0.052 ms +... + +``` + +Multiple domain names can be separated by comas: `DOMAIN_NAME=my-project.web.docker,www.my-project.web.docker` diff --git a/docs/synced-folders.md b/docs/synced-folders.md new file mode 100644 index 0000000..c7069f0 --- /dev/null +++ b/docs/synced-folders.md @@ -0,0 +1,42 @@ +# Synced Folders + +This box supports all [Synced Folder](http://docs.vagrantup.com/v2/synced-folders/) options provided by Vagrant +as well two custom optimized options : +- vboxsf - native VirtualBox method, cross-platform, convenient and reliable, terribly slow +- nfs: better performance and convenience on Mac +- nfs2: optimized nfs settings, experimental (default on Mac) +- smb: better performance and convenience on Windows. Requires Vagrant to be run with admin privileges (not recommended). +- smb2: does not require running vagrant as admin (default on Windows). +- rsync: best performance, cross-platform platform, one-way only + +Follow the instructions in the `vagrant.yml` file to switch between different sync options. +The best balance between performance and convenience can be achieved with **nfs2** on Mac (default) and **smb2** on Windows (default). + +If you use rsync on Windows, you'll have to run `vagrant gatling-rsync-auto` in a separate terminal to keep the files in sync as you make changes. +This is automated on Mac with `rsync_auto` set to `true` in `vagrant.yml`. + + +## Mac + +Option comparison for Mac Drupal developers (using `time drush si -y` as a test case): +- vboxsf: 6x (slowest) +- nfs: 1.3x +- rsync: 1x (fastest) + +NFS provides good performance and convenience (used by default on Mac) + + +## Windows + +Option comparison for Windows Drupal developers (using `time drush si -y` as a test case): +- vboxsf: 5x (slowest) +- smb: 2x +- rsync: 1x (fastest) + +**smb** provides good performance and convenience (used by default on Windows) + +**smb vs smb2** + +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. diff --git a/docs/tips.md b/docs/tips.md new file mode 100644 index 0000000..5581dcc --- /dev/null +++ b/docs/tips.md @@ -0,0 +1,33 @@ +# Tips + +## Automate DOCKER_HOST variable export + +This is only necessary for manual instllations. [setup.sh](../scripts/setup.sh) script takes care of this for you. + +Add the following in your .bashrc, .zshrc, etc. file to automate the environment variable export: + + # Docker (default for Vagrant based boxes) + export DOCKER_HOST=tcp://localhost:2375 + +If you also have `$(boot2docker shellinit)` there, then make sure those lines go BEFORE it, e.g.: + + # Docker (default for Vagrant based boxes) + export DOCKER_HOST=tcp://localhost:2375 + + # boot2docker shellinit + $(boot2docker shellinit) + +This way if boot2docker is NOT running, your `DOCKER_HOST` will default to `tcp://localhost:2375`. +Otherwise `$(boot2docker shellinit)` will overwrite the variables and set `DOCKER_HOST` to point to the boot2docker VM. + +## Vagrant control +Vagrant can be controlled (e.g. `vagrant up`, `vagrant ssh`, `vagrant reload`, etc.) from the root directory of the Vagrantfile as well as from any subdirectory. This is very usefull when working with multiple projects in subdirectories. + +## Sublime Text 3 users +Add this to your user settings (Sublime Text > Preferences > Settings - User): + + { + "atomic_save": false + } + +ST3 does not update the ctime extended file attribute when saving a file. This leads to NFS not seeing the changes in a file unless the file size changes as well (i.e. changing a single symbol in a file with ST3 will not be visible over NFS). The setting above fixes that. diff --git a/docs/vm-settings.md b/docs/vm-settings.md new file mode 100644 index 0000000..d9c7b1c --- /dev/null +++ b/docs/vm-settings.md @@ -0,0 +1,10 @@ + +# VirtualBox VM settings + +Open `vagrant.yml` file and edit respective values. + +- `v.gui` - Set to `true` for debugging. This will unhide VM's primary console screen. Default: `false`. +- `v.memory` - Memory settings (MB). Default: `2048`. +- `v.cpus: 1` - number of virtual CPU cores. Default: `1`. + +Please note, VirtualBox works much better with a single CPU in most cases, this it is not recommended to change the `v.cpus` value. diff --git a/scripts/presetup-ubuntu.sh b/scripts/presetup-ubuntu.sh new file mode 100644 index 0000000..d231599 --- /dev/null +++ b/scripts/presetup-ubuntu.sh @@ -0,0 +1,83 @@ +#!/bin/bash + +DOCKER_VERSION=1.9.0 +DOCKER_COMPOSE_VERSION=1.5.0 + +#-------------------------- Helper functions -------------------------------- + +# Console colors +red='\033[0;31m' +green='\033[0;32m' +yellow='\033[1;33m' +NC='\033[0m' + +echo-red () { echo -e "${red}$1${NC}"; } +echo-green () { echo -e "${green}$1${NC}"; } +echo-yellow () { echo -e "${yellow}$1${NC}"; } + +if_failed () +{ + if [ ! $? -eq 0 ]; then + if [[ "$1" == "" ]]; then msg="dsh: error"; else msg="$1"; fi + echo-red "dsh: $msg" + exit 1 + fi +} + +#-------------------------- Installation -------------------------------- + +if [ -r /etc/lsb-release ]; then + lsb_dist="$(. /etc/lsb-release && echo "$DISTRIB_ID")" + lsb_release="$(. /etc/lsb-release && echo "$DISTRIB_RELEASE")" +fi + +if [[ $lsb_dist != 'Ubuntu' || $lsb_release < '14.04' ]]; then + echo-red "Sorry, this script only supports Ubuntu 14.04+" + exit 1 +fi + +echo-green "Installing Docker..." +curl -sSL https://get.docker.com/ | sh && \ +sudo usermod -aG docker $(whoami) && \ +sudo docker version +if_failed "Docker installation/upgrade failed." + +echo-green "Installing Docker Compose..." +sudo curl -L https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION/docker-compose-`uname -s`-`uname -m` -o /usr/local/bin/docker-compose && \ +sudo chmod +x /usr/local/bin/docker-compose && \ +docker-compose --version +if_failed "Docker Compose installation/upgrade failed." + +echo-green "Adding a subnet for DockerBox..." +ip_mask="192.168.10.1/24" +# Make sure we don't do this twice +if ! grep -q $ip_mask /etc/network/interfaces; then + cat > /tmp/dockerbox.ip.addr < Date: Wed, 11 Nov 2015 15:44:12 -0500 Subject: [PATCH 15/15] Bump to 1.3.0 --- CHANGELOG.md | 17 +++++++++++++++++ VERSION | 2 +- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6629e5..e15c993 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,22 @@ # Changelog +## 1.3.0 (2015-11-10) + +- Version updates + - boot2docker base box v1.9.0 + - Docker v1.9.0 + - Docker Compose v1.5.0 (now installed as a binary on Windows) +- Default to **nfs2** on Mac and **smb2** on Windows +- rsync + - Switching to vagrant-gatling-rsync for better rsync-auto performance + - Auto start gatling-rsync-auto **in background** (Mac only) +- Revised vboxsf, smb and rsync settings +- Fixed vagrant user account expiration (smb2 option) +- Added a way to define individual mounts +- Added "group=system" label to dns and vhost-proxy containers +- Added support for authentication against docker hub +- Fixed typo: vboxfs => vboxsf + ## 1.2.1 (2015-10-28) - Update path to shell scripts in README.md diff --git a/VERSION b/VERSION index 6085e94..f0bb29e 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.1 +1.3.0