Skip/Ignore boot errors for vagrant up - vagrant

Hi Guys I have a situation where I don't want use vagrant user or any other user for ssh. Whenever I do vagrant up the VM's boots and I get the below error for ssh. Its because of timeout as it is unable to find vagrant user. By default when we do vagrant up the vagrants checks for vm to boot and it does the same by sshing. Is there is way where I can ignore this bootstrap error or skip the ssh step? I did an extensive search and unable to find any documentation regarding the same. The reason I need this is because I have multiple VM which needs to be started one by one. I need to skip this error or ignore the below error so that all the VM's are started.
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within the
configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that Vagrant
had when attempting to connect to the machine. These errors are
usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes. Verify
that authentication configurations are also setup properly, as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

Related

Vagrant | Homestead - vagrant up command connection timeout

When I execute the 'vagrant up' command, it says
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

Vagrant hangs after macOS upgrade

After upgrading to macOS Mojave, my local vagrant stopped working with timeout error after SSH auth method: private key as below:
mch1: SSH address: 127.0.0.1:2222
mch1: SSH username: vagrant
mch1: SSH auth method: private key
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
Vagrant version : 2.2.2
VirtualBoxVersion 5.2.22 r126460 (Qt5.6.3)
Most probably this is an issue with the new security features on Mojave.
Please give the console app (from where you ran vagrant up, e.g. iTerm2) full write permissions on the disk
System preferences
Security & Privacy
Privacy
Full Disk Access
then restart console and try again.

Figwheel not hot reloading or updating on file save when using vagrant

When running figwheel from with a vagrant box it seems that file changes aren't noticed and as a result figwheel does not update/reload the page.
After spending hours trying to figure out what was going on it eventually came down to how figwheel detects file changes.
To detect file changes figwheel uses the hawk library which in turn uses the operating system to that tell hawk the file has updated. Because vagrant defaults to using vboxsf there is no underlying update mechanism to provide updates that the file has changed, see here. To fix this we just need to tell figwheel, and thus hawk, to poll for file changes:
:figwheel {:hawk-options {:watcher :polling}
Just pop this in the your profile.clj and that will allow figwheel to see changes after the file has been saved, although it does take a while for the polling to pick up the changes so wait a little bit.
This only however solves half of the problem because figwheel still requires an active websocket connection to actually push the code changes. This is complicated by the fact the a vagrant vm is a separate machine on the network and requires you expose this websocket to more than just localhost. This can be achieved by adding another key to the figwheel map in project.clj:
:figwheel {:server-ip "0.0.0.0"}
and then exposing the figwheel websocket port in the vagrantfile:
config.vm.network "forwarded_port", guest: 3449, host: 3449
and that should fix figwheel on vagrant!
FYI had a similar problem and work on the following solution
troubleshooting on vagrant docker
to quote
Watch Task not working in Docker / Vagrant?
Scenario: Changes made to a file mounted with Docker / Vagrant between
the guest and host os via NFS; filesystem events are not received
correctly.
Resolution: Use rsync in these environments, as NFS does not support
inotify. You may also wish to run a repl server in the guest os and
connect to it from the host.

provision multiple servers in a single VM using vagrant

Can we use vagrant to provision multiple services in a single virtual machine , say tomcat and mysql. but a service should get installed in VM as per user input something like "vagrant up mysql".
I have already been looked in to Mutiple VM deployment using vagrant but here what i want is to have services in same VM based on user input.
Is there a way to do that?
Thanks!!
Since all those machines are virtual and you sometimes want to have only mysql there, sometimes only tomcat and sometimes both, just use multi-machine:
http://docs.vagrantup.com/v2/multi-machine/
Then you will be able to start your machine, for example, like this:
vagrant up mysql
vagrant up tomcat
vagrant up both
You can configure them to have the same IP and never start all of them at once. This should work for you.

What are the advantages of using Chef-server with Vagrant v/s Chef-Solo with Vagrant?

I've done some read-up on Vagrant with Chef-Server v/s Vagrant with Chef-solo and have found blogs talking about the usage of the same. I've failed to find anybody summarizing the advantages of either approach. So, here's my question.
I understand that Vagrant cannot spin up virtual machines on a remote machine. This means running "vagrant up" on a particular machine will spin up VMs on that machine alone.
First of all, is this understanding right?
If yes, what’s the point of using a chef server to provision the server?
I feel that if I’m using Vagrant, using chef solo is the way to go and chef
server isn’t adding any value.
Do you think I’m missing something?
Vagrant is used for spin up VMs and you can provision those VMs with the help of chef recipes or via any other provisioning method. https://docs.vagrantup.com/v2/provisioning/index.html
Now, Difference between Chef Server and Chef-Solo:
Chef Server works in Client Server Architecture. You can control or manage all your nodes (VMs launched by Vagrant) with the help of Chef Server. In a particular VM, you can search for other nodes with the help of Chef Server.
Chef-Solo works in Solo mode means, you can provision only single node and you can not get any information about the other nodes. However several techniques exists to overcome such situations like chef-solo-search.

Resources