Vagrantfile 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # -*- mode: ruby -*-
  2. # vi: set ft=ruby :
  3. Vagrant.configure(2) do |config|
  4. config.vm.box = "openfalcon-docker"
  5. config.vm.host_name = "openfalcon-docker"
  6. # Use default insecure key
  7. config.ssh.insert_key = false
  8. # All configurations use 10.20.30.40 as entry.
  9. config.vm.network "private_network", ip: "10.20.30.40"
  10. # MySQL needs at least 1024 MB
  11. config.vm.provider "virtualbox" do |vb|
  12. vb.memory = "2048"
  13. end
  14. # Let timezone in guest be same as host
  15. # Install timezone plugin:
  16. # $ vagrant plugin install vagrant-timezone
  17. if Vagrant.has_plugin?("vagrant-timezone")
  18. config.timezone.value = "Asia/Taipei"
  19. end
  20. # Auto snapshot when vagrant up first
  21. # Install trigger and snapshot plugin:
  22. # $ vagrant plugin install vagrant-triggers
  23. # $ vagrant plugin install vagrant-vbox-snapshot
  24. if Vagrant.has_plugin?("vagrant-triggers") and Vagrant.has_plugin?("vagrant-vbox-snapshot")
  25. config.trigger.after :up do
  26. `vagrant snapshot list "#{@machine.name}"`
  27. unless $?.exitstatus == 0
  28. `vagrant snapshot take "#{@machine.name}" baseline`
  29. @machine.ui.info("Took initial snapshot")
  30. end
  31. end
  32. config.trigger.before :destroy do
  33. `vagrant snapshot delete "#{@machine.name}" baseline`
  34. end
  35. end
  36. end