Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

add NFS support and rewrite bootlocal.sh proccess #5

Merged
merged 1 commit into from
Jan 13, 2015
Merged

add NFS support and rewrite bootlocal.sh proccess #5

merged 1 commit into from
Jan 13, 2015

Conversation

Freyskeyd
Copy link

Hey,

NFS

In order to be able to use NFS for synced_folder i've add nfs-client start command in bootlocal.sh

To use NFS, add type: "nfs" to your synced_folder.

config.vm.synced_folder ".", "/vagrant", type: "nfs"

Bootlocal

When we want to execute commands when /vagrant is mounted, we can use SYSTEM-V but, vagrant provision run when folders are mounted.

So we can simply use a config.vm.provision "shell", path: "bootlocal.sh", run: "always".

If something more complicated is needed,you can add rules when filesystems are mounted:

in /etc/udev/rules.d/ create a new file like 50-vagrant-mounts.rules

# Start on mount
SUBSYSTEM=="bdi",ACTION=="add",RUN+="/do/something'"
# Stop on unmount
SUBSYSTEM=="bdi",ACTION=="remove",RUN+="/do/somehting/else'"

If you want to use bootlocal.sh in a fresh project, you just need to create a file next to the vagrantfile.

Common issue

When using vagrant 1.7.x with ensecure key, vagrant will replace this key by a new one. It's throw error when reloading the box (Warning: Authentication failure. Retrying...).

To resolve this little issue, simply add: config.ssh.insert_key = false to your Vagrantfile.

Tricks

To make docker client working with a private networked docker server you need to add in your bootlocal.sh:

/usr/local/etc/init.d/docker restart
cp -r /var/lib/boot2docker/tls /vagrant/

Next, you need to export cert path: export DOCKER_CERT_PATH=$PWD/tls

See ya.

@dduportal
Copy link
Owner

Hey, thank you very much for this PR.

I'll push some additional changes before release :

  • Adding your tips and trick to the DOC file
  • Adding a private network by default letting the user decide which way (NAT or private) to use

dduportal added a commit that referenced this pull request Jan 13, 2015
add NFS support and rewrite bootlocal.sh proccess
@dduportal dduportal merged commit 0f54568 into dduportal:master Jan 13, 2015
@phpguru
Copy link

phpguru commented May 19, 2015

Just a tip that if you've done everything including the "Tricks" above and still get this error, make sure the export you have defined for DOCKER_CERT_PATH and the other DOCKER_* env vars are correct and typo-free in ~/.bash_profile and re-source it (source ~/.bash_profile) before vagrant up. You get a bad file descriptor error in case Vagrant cannot mount the nfs volume path you define, and the keys are required to be where they need to be (on the host, the Mac) before that mount can happen. If you have vagrant up already, and just the nfs mount failed, you can vagrant ssh and run the first command under the Tricks section above at the Vagrant VM shell prompt, which regenerates the keys, but the copy operation providing the keys to the host, via the shared folder /vagrant, won't work if that path is not mounted yet. In theory you can try to scp the keys to the default gateway IP of the Vagrant box (which means the Mac, YMMV) or try a different share mechanism, eg VBoxSF just to get the keys in the right spot, before trying again.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants