-
-
Notifications
You must be signed in to change notification settings - Fork 607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Vagrant config #828
Vagrant config #828
Conversation
Can I make a suggestion: I edit my local Vagrantfile to mount WP plugins I'm working on into the VM. Can the configuration be edited to allow one to include a src/dest array:
or something like this? |
@mAAdhaTTah sure, makes sense 👍 |
@mAAdhaTTah added, try it out 👼 |
Adds a new `vagrant.default.yml` config file which is used for Vagrant related settings in `Vagrantfile.` `vagrant.local.yml` is also supported as a local, untracked config file which takes precedence over the default.
8011095
to
f6be4ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR will make the Trellis Vagrant config so much nicer and cleaner!
Important. The one issue I think must be dealt with is how the vagrant_synced_folders
loop handles bindfs folders. I've added two inline comments in the code to explain. It avoids a vagrant-bindfs error such as this:
vagrant-bindfs:
* Path '../db' is relative but an absolute path is attended
Probably. One issue you probably want to address is fixing the sequence of the CHANGELOG.md entries to be chronological (fixing sequence with Ansible 2.3 compatibility
entry).
Maybe. There are two issues you'll only maybe want to address:
- You could change the
vagrant_ansible_version
to 2.3 - You could move
def hosts(sites)
up underdef load_wordpress_sites
(inlib/trellis/vagrant.rb
) because they're similar in concept and that would match the sequence and proximity in which they are called inVagrantfile
.
Probably not. One issue you will probably not care to address is that you could put a comment at the top of vagrant.default.yml
saying "Jinja2 variables and templating will not function in this file."
lib/trellis/vagrant.rb
Outdated
end | ||
|
||
def nfs_path(site_name) | ||
"/vagrant-nfs-#{site_name}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be used for nfs path names in the vagrant_synced_folders
loop:
- def nfs_path(site_name)
- "/vagrant-nfs-#{site_name}"
+ def nfs_path(path)
+ "/vagrant-nfs-#{File.basename(path)}"
end
Vagrantfile
Outdated
config.vm.synced_folder folder['local_path'], folder['destination'], options | ||
|
||
if folder.fetch('bindfs', true) | ||
config.bindfs.bind_folder folder['local_path'], folder['destination'], options |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When using vagrant-bindfs, the convention appears to be...
- do a regular vagrant folder sync from
somedir
to/vagrant/somedir-nfs
- do a bindfs sync from
/vagrant/somedir-nfs
to/final_path_on_vm/somedir
Combined with the File.basename()
adjustment to nfs_path()
proposed in a separate comment, the following seems to handle it.
+ destination_folder = folder.fetch('bindfs', true) ? nfs_path(folder['destination']) : folder['destination']
- config.vm.synced_folder folder['local_path'], folder['destination'], options
+ config.vm.synced_folder folder['local_path'], destination_folder, options
if folder.fetch('bindfs', true)
- config.bindfs.bind_folder folder['local_path'], folder['destination'], options
+ config.bindfs.bind_folder destination_folder, folder['destination'], folder.fetch('bindfs_options', {})
The other piece to this is the bindfs_options
, which are different from a regular vagrant sync dir options
and must be treated differently. The above appears to successfully handle the following example
# vagrant.local.yml
vagrant_synced_folders:
- local_path: ../db
destination: /home/vagrant/db
create: false
type: nfs
bindfs: true
bindfs_options:
o: 'nonempty'
p: '0644,a+D'
- local_path: ../test
destination: /home/vagrant/test
create: false
type: virtualbox
bindfs: false
mount_options:
- 'dmode=755'
- 'fmode=644'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌 updated
👍 Looks great to me! |
Inspired by https://github.com/geerlingguy/drupal-vm
Todo:
vagrant.yml
. drupal-vm usesdefault.config.yml
?