How is done in production today?

You can easily add a 2nd disk to the storage server, and then use it
for anything you like.

Sample Vagrant file with 1 extra disk

vm_name="db12102"
size_file_to_dbdisk = 50

Vagrant.configure(2) do |config|
  config.vm.box = "alvaro/oracle6-preinstall"
  config.vm.hostname = "#{vm_name}.kikitux.net"
  config.vm.network :private_network, ip: "192.168.78.3"
  config.vm.provider :virtualbox do |vb|
    vb.name = vm_name
    vb.customize ["modifyvm", :id, "--memory", 5555]
    vb.customize ["modifyvm", :id, "--cpus", 4]
    port=2
    ["1"].each do |disk|
      file_to_dbdisk = "Y:/VirtualBox/#{vm_name}/#{vm_name}-disk#{disk}.vdi"
      if !File.exist?(file_to_dbdisk)
        vb.customize ['createhd', '--filename', file_to_dbdisk,
'--size', (size_file_to_dbdisk * 1024).floor ]
      end
      vb.customize ['storageattach', :id, '--storagectl', 'SATA
Controller', '--port', port, '--device', 0, '--type', 'hdd',
'--medium', file_to_dbdisk]
      port=port+1
    end
  end
  config.vm.provision "shell", path: "scripts/sdb.sh"

end



Sample script that won't delete if there is anything in the disk

#!/bin/bash

blkid /dev/sdb*
if [ $? -ne 0 ]; then
  mkfs.ext4 -F /dev/sdb
  blkid /dev/sdb 2>&1>/dev/null && echo $(blkid /dev/sdb -o export |
head -n1) /u01/stage ext4 defaults 0 0 >> /etc/fstab
  mkdir -p /u01/stage
  mount /u01/stage
else
  echo "filesystem metadata found on sdb, ignoring"
fi



Alvaro

On Tue, Dec 8, 2015 at 11:54 PM, Bjorn W <[email protected]> wrote:
> Hi,
> I'm using Vagrant to model a production environment with 5 machines:
>
> - 1 database server
> - 1 storage server
> - 2 webservers
> - 1 loadbalancer.
>
> So far most of it works as theorized except for storage.
>
> My initial idea was to sync shared folders from my host laptop via Vagrant
> to the storage server VM and run a NFS server re-sharing the shared Vagrant
> folders the (guest) from storage server to, in this case, the webservers.
> However sharing synced (tried both default as well as NFS) Vagrant folders
> using this approach does not work: the storage server mounts the shared
> Vagrant folder and allows access to it. I can see a mount and I'm able to
> write something to it (on the webserver machine and see the result on the
> storage server as well). However existing folders on the storage server seem
> empty when I view them from the webserver machine. Any clues on what is
> causing this? Also I'm interested in how you would model a production
> environment like I described and in particular how would you share data
> (between the guest VM's as well as between the host and the guest VM's).
>
> ps: For now I'm going to test a workaround: Using Vagrant shared folders as
> the storage machine instead. So basically I mount the shared folders on the
> webserver VM's directly instead of via a storage server.
>
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in violation
> of those guidelines may result in your removal from this mailing list.
>
> GitHub Issues: https://github.com/mitchellh/vagrant/issues
> IRC: #vagrant on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vagrant-up/a3fc17d8-ab23-408c-a159-6bb48a90d264%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/CAHqq0exLDGf1_cXn-MDb_52BHAW0R_vdW6-KNunb%3DxXfD0U72Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to