|
1 | 1 | # -*- mode: ruby -*-
|
2 | 2 | # vi: set ft=ruby :
|
3 | 3 |
|
4 |
| -# All Vagrant configuration is done below. The "2" in Vagrant.configure |
5 |
| -# configures the configuration version (we support older styles for |
6 |
| -# backwards compatibility). Please don't change it unless you know what |
7 |
| -# you're doing. |
8 |
| -Vagrant.configure(2) do |config| |
9 |
| - # The most common configuration options are documented and commented below. |
10 |
| - # For a complete reference, please see the online documentation at |
11 |
| - # https://docs.vagrantup.com. |
12 |
| - |
13 |
| - # Every Vagrant development environment requires a box. You can search for |
14 |
| - # boxes at https://atlas.hashicorp.com/search. |
15 |
| - config.vm.box = "torchbox/wagtail-stretch64" |
16 |
| - config.vm.box_version = "~> 1.0" |
17 |
| - |
18 |
| - # Disable automatic box update checking. If you disable this, then |
19 |
| - # boxes will only be checked for updates when the user runs |
20 |
| - # `vagrant box outdated`. This is not recommended. |
21 |
| - # config.vm.box_check_update = false |
22 |
| - |
23 |
| - # Workaround to prevent missing linux headers making new installs fail. |
24 |
| - # Adapted from https://github.com/dotless-de/vagrant-vbguest/issues/351#issuecomment-536282015 |
25 |
| - if Vagrant.has_plugin?("vagrant-vbguest") |
26 |
| - class WorkaroundVbguest < VagrantVbguest::Installers::Linux |
27 |
| - def install(opts=nil, &block) |
28 |
| - puts 'Ensuring we\'ve got the correct build environment for vbguest...' |
29 |
| - communicate.sudo('apt-get -y --force-yes update', (opts || {}).merge(:error_check => false), &block) |
30 |
| - communicate.sudo('apt-get -y --force-yes install -y build-essential linux-headers-amd64 linux-image-amd64', (opts || {}).merge(:error_check => false), &block) |
31 |
| - puts 'Continuing with vbguest installation...' |
32 |
| - super |
33 |
| - puts 'Performing vbguest post-installation steps...' |
34 |
| - communicate.sudo('usermod -a -G vboxsf vagrant', (opts || {}).merge(:error_check => false), &block) |
35 |
| - end |
36 |
| - def reboot_after_install?(opts=nil, &block) |
37 |
| - true |
38 |
| - end |
39 |
| - end |
40 | 4 |
|
41 |
| - |
42 |
| - config.vbguest.installer = WorkaroundVbguest |
| 5 | +Vagrant.configure(2) do |config| |
| 6 | + config.vm.box = "wagtail/buster64" |
| 7 | + config.vm.box_version = "~> 1.1.0" |
| 8 | + |
| 9 | + # If a 'Vagrantfile.local' file exists, import any configuration settings |
| 10 | + # defined there into here. Vagrantfile.local is ignored in version control, |
| 11 | + # so this can be used to add configuration specific to this computer. |
| 12 | + # `git rev-parse` just helps find it if `vagrant up` is not run from the project root. |
| 13 | + vagrantfile_local = `git rev-parse --show-toplevel`.split("\n")[0] + "/Vagrantfile.local" |
| 14 | + if File.exist? "Vagrantfile.local" |
| 15 | + instance_eval File.read("Vagrantfile.local"), "Vagrantfile.local" |
43 | 16 | end
|
44 |
| - # End workaround |
45 |
| - |
46 |
| - # Create a forwarded port mapping which allows access to a specific port |
47 |
| - # within the machine from a port on the host machine. In the example below, |
48 |
| - # accessing "localhost:8000" will access port 8000 on the guest machine. |
49 |
| - config.vm.network "forwarded_port", guest: 8000, host: 8000, auto_correct: true |
50 |
| - |
51 |
| - # Create a private network, which allows host-only access to the machine |
52 |
| - # using a specific IP. |
53 |
| - # config.vm.network "private_network", ip: "192.168.33.10" |
54 |
| - |
55 |
| - # Create a public network, which generally matched to bridged network. |
56 |
| - # Bridged networks make the machine appear as another physical device on |
57 |
| - # your network. |
58 |
| - # config.vm.network "public_network" |
59 | 17 |
|
60 |
| - # Share an additional folder to the guest VM. The first argument is |
61 |
| - # the path on the host to the actual folder. The second argument is |
62 |
| - # the path on the guest to mount the folder. And the optional third |
63 |
| - # argument is a set of non-required options. |
64 |
| - # config.vm.synced_folder "../data", "/vagrant_data" |
65 |
| - |
66 |
| - # Provider-specific configuration so you can fine-tune various |
67 |
| - # backing providers for Vagrant. These expose provider-specific options. |
68 |
| - # Example for VirtualBox: |
69 |
| - # |
70 |
| - # config.vm.provider "virtualbox" do |vb| |
71 |
| - # # Display the VirtualBox GUI when booting the machine |
72 |
| - # vb.gui = true |
73 |
| - # |
74 |
| - # # Customize the amount of memory on the VM: |
75 |
| - # vb.memory = "1024" |
76 |
| - # end |
77 |
| - # |
78 |
| - # View the documentation for the provider you are using for more |
79 |
| - # information on available options. |
| 18 | + config.vm.network "forwarded_port", guest: 8000, host: @FORWARD_PORT || 8000, auto_correct: true |
| 19 | + config.vm.provision :shell, :path => "vagrant/provision.sh", :args => "wagtailio" |
| 20 | + config.ssh.forward_agent = true |
80 | 21 |
|
81 |
| - # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies |
82 |
| - # such as FTP and Heroku are also available. See the documentation at |
83 |
| - # https://docs.vagrantup.com/v2/push/atlas.html for more information. |
84 |
| - # config.push.define "atlas" do |push| |
85 |
| - # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME" |
86 |
| - # end |
| 22 | + config.vm.provider "virtualbox" do |vb| |
| 23 | + # increase memory by default; can be changed in Vagrantfile_local.rb |
| 24 | + vb.memory = @MEMORY_MB || 2048 |
| 25 | + end |
87 | 26 |
|
88 |
| - # Enable provisioning with a shell script. Additional provisioners such as |
89 |
| - # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the |
90 |
| - # documentation for more information about their specific syntax and use. |
91 |
| - # config.vm.provision "shell", inline: <<-SHELL |
92 |
| - # sudo apt-get update |
93 |
| - # sudo apt-get install -y apache2 |
94 |
| - # SHELL |
95 |
| - config.vm.provision :shell, :path => "vagrant/provision.sh", :args => "wagtailio" |
| 27 | + # https://www.vagrantup.com/docs/synced-folders/nfs.html |
| 28 | + if @NFS |
| 29 | + puts "NFS=#{@NFS}" |
| 30 | + config.vm.synced_folder ".", "/vagrant", :nfs => @NFS, :mount_options => ['actimeo=2'] |
| 31 | + config.vm.network :private_network, type: "dhcp" |
| 32 | + end |
96 | 33 |
|
97 |
| - # Enable agent forwarding over SSH connections. |
98 |
| - config.ssh.forward_agent = true |
| 34 | + if Vagrant.has_plugin?("vagrant-vbguest") |
| 35 | + config.vbguest.auto_update = false |
| 36 | + end |
99 | 37 | end
|
0 commit comments