Skip to content

Commit

Permalink
Update remote filesystem mount options for various platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
marek-obuchowicz committed Mar 21, 2016
1 parent d2573a5 commit 43e6a53
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 9 deletions.
24 changes: 18 additions & 6 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,24 @@ def bold(text); colorize(text, "\033[1;97m"); end
# Check whether we are running UNIX or Windows-based machine
if Vagrant::Util::Platform.windows?
HOSTS_PATH = 'c:\WINDOWS\system32\drivers\etc\hosts'
SYNCED_FOLDER_TYPE = 'virtualbox'
IS_WINDOWS = true
IS_UNIX = false
IS_LINUX = false
IS_OSX = false
SYNCED_FOLDER_OPTIONS = { type: 'virtualbox' }
else
HOSTS_PATH = '/etc/hosts'
SYNCED_FOLDER_TYPE = 'nfs'
IS_WINDOWS = false
IS_UNIX = true
if (/darwin/ =~ Vagrant::Util::Platform.platform)
IS_LINUX = false
IS_OSX = true
SYNCED_FOLDER_OPTIONS = { type: 'nfs', mount_options: ['noatime,fsc,actimeo=1'] }
else
IS_LINUX = true
IS_OSX = false
SYNCED_FOLDER_OPTIONS = { type: 'nfs', mount_options: ['nolock,noatime,fsc,actimeo=1'] }
end
end

# Verify if salt/pillar directories are present
Expand Down Expand Up @@ -123,8 +135,8 @@ Vagrant.configure(2) do |config|

# SaltStack masterless setup
if Dir.exists?(PILLAR_DIRECTORY) && Dir.exists?(SALT_DIRECTORY)
config.vm.synced_folder SALT_DIRECTORY, "/srv/salt/", type: SYNCED_FOLDER_TYPE
config.vm.synced_folder PILLAR_DIRECTORY, "/srv/pillar/", type: SYNCED_FOLDER_TYPE
config.vm.synced_folder SALT_DIRECTORY, "/srv/salt/", SYNCED_FOLDER_OPTIONS
config.vm.synced_folder PILLAR_DIRECTORY, "/srv/pillar/", SYNCED_FOLDER_OPTIONS
config.vm.provision :salt do |salt|
salt.minion_config = "salt_minion"
salt.run_highstate = true
Expand All @@ -151,8 +163,8 @@ Vagrant.configure(2) do |config|
end

# Share the application code with VM
config.vm.synced_folder SPRYKER_DIRECTORY, "/data/shop/development/current", type: SYNCED_FOLDER_TYPE
if SYNCED_FOLDER_TYPE == "nfs"
config.vm.synced_folder SPRYKER_DIRECTORY, "/data/shop/development/current", SYNCED_FOLDER_OPTIONS
if IS_UNIX
config.nfs.map_uid = Process.uid
config.nfs.map_gid = Process.gid
end
Expand Down
18 changes: 15 additions & 3 deletions Vagrantfile-quick
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,24 @@ def bold(text); colorize(text, "\033[1;97m"); end
# Check whether we are running UNIX or Windows-based machine
if Vagrant::Util::Platform.windows?
HOSTS_PATH = 'c:\WINDOWS\system32\drivers\etc\hosts'
SYNCED_FOLDER_TYPE = 'virtualbox'
IS_WINDOWS = true
IS_UNIX = false
IS_LINUX = false
IS_OSX = false
SYNCED_FOLDER_OPTIONS = { type: 'virtualbox' }
else
HOSTS_PATH = '/etc/hosts'
SYNCED_FOLDER_TYPE = 'nfs'
IS_WINDOWS = false
IS_UNIX = true
if (/darwin/ =~ Vagrant::Util::Platform.platform)
IS_LINUX = false
IS_OSX = true
SYNCED_FOLDER_OPTIONS = { type: 'nfs', mount_options: ['noatime,fsc,actimeo=1'] }
else
IS_LINUX = true
IS_OSX = false
SYNCED_FOLDER_OPTIONS = { type: 'nfs', mount_options: ['nolock,noatime,fsc,actimeo=1'] }
end
end

# Clone Spryker (if repository is given)
Expand Down Expand Up @@ -116,7 +128,7 @@ Vagrant.configure(2) do |config|
end

# Share the application code with VM
config.vm.synced_folder SPRYKER_DIRECTORY, "/data/shop/development/current", type: SYNCED_FOLDER_TYPE
config.vm.synced_folder SPRYKER_DIRECTORY, "/data/shop/development/current", SYNCED_FOLDER_OPTIONS
if SYNCED_FOLDER_TYPE == "nfs"
config.nfs.map_uid = Process.uid
config.nfs.map_gid = Process.gid
Expand Down

0 comments on commit 43e6a53

Please sign in to comment.