most recently (not sure why) vagrant (1.8.1) started asking for a root password.
however at work no root privileges are given to us (no sodoer)
I am looking for a way to tell vargant to stop the nfs pruning all together
sadly the documentation does not say how to modify this particular flag and I don't know ruby much
the code gives away that there should be a flag but can't figure out to put the "false" in there
I intend to disable NFS or skip that part all together. so both would be welcome.
my starting point is my ~/.vagrant.d/Vagrantfile
Vagrant.configure('2') do |config|
config.vagrant.host :nfs_prune => false
end
error message is: Pruning invalid NFS exports. Administrator privileges will be required...
PS: no, I do not use nfs in my shared folders
you should be able to disable by using the config.nfs.functional = false
functional (bool) - Defaults to true. If false, then NFS will not be
used as a synced folder type. If a synced folder specifically requests
NFS, it will error.
vagrantfile can be loaded from multiple sources, see LOAD ORDER AND MERGING
Vagrant actually loads a series of Vagrantfiles, merging the settings
as it goes. This allows Vagrantfiles of varying level of specificity
to override prior settings. Vagrantfiles are loaded in the order shown
below. Note that if a Vagrantfile is not found at any step, Vagrant
continues with the next step.
Vagrantfile packaged with the box that is to be used for a given
machine.
Vagrantfile in your Vagrant home directory (defaults to
~/.vagrant.d). This lets you specify some defaults for your system
user.
Vagrantfile from the project directory. This is the Vagrantfile
that you will be modifying most of the time.
As you mentioned you already check point 3 and 2, check the Vagrantfile from the particular box (if any)
Related
Ok, I've started to use vagrant because a client uses it. Getting all the pieces together and make them work was truly painful... and now I'm facing a different kind of issue.
Once I run vagrant up there could be different results:
VM doesn't boot properly
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.
MySQL dies
default: ERROR 2006 (HY000) at line 1118: MySQL server has gone away
or
default: ERROR 1034 (HY000) at line 3720: Index for table 'ci_sessions' is corrupt; try to repair it
Works properly
I have to run back to back vagrant up and vagrant destroy commands, until my machine decides to boot and build properly. It's weird, I have no explanation for this, running the environment is such a gamble and takes me a lot of time until it works.
If someone knows anything about Vagrant or this strange issue, it would be very appreciated.
PD:
My Vagrantfile has been provisioned with
config.vm.provider "virtualbox" do |v|
v.memory = 4096
v.cpus = 3
end
Databases that are being loaded are huge (one of 5Gb) and I tried to include a sed command to improve max allowed package without success.
sudo sed -i "s#[client-server]#[client-server]\n\n[mysqld]\nmax_allowed_packet=256M#" /etc/my.cnf
I got this answer:
sed: -e expression #1, char 33: unterminated `s' command
It runs ok when I execute it at vagrant ssh but I'm not sure where to include it in my Vagrantfile.
I would speculate that a lot of stuff is going on in the VM during startup that either eats up resources, or just takes too long. You already point out that you give the VM only 4GB of RAM, but the database you try to load is 5GB, so the VM is likely thrashing the swap partition. That MySQL dies also suggests that you are not giving the VM the resources required.
Even if vagrant can't establish an SSH connection and times out, can you ssh into the box after a while (check "vagrant ssh-config")?
Increase RAM, and investigate (perhaps you can ask whoever packaged the box) what kind of services this VM launches as part of the boot process. Monitor whatever facilities the guest OS of the VM provides, and you should see what's going on in the VirtualBox GUI as well. Press whatever keys the guest OS uses for that purpose so that you don't just see some opaque boot screen.
As for your sed command, you can use a shell provisioner for that: https://www.vagrantup.com/docs/provisioning/shell; make sure you escape things properly when passing the command line via the inline attribute.
I don't know if this is possible I have only been using chef for about a week and a half now, I can't seem to find anything on the internet about doing this. But basically we have the chef client installed on a image. Each image has a configuration script that is run when the image is setup for the first time to set up the computer name and other settings specific to its setup.
So what I need to have happen once the config script finishes is to have a node created with the node name as the name of the computer that was entered automatically, along with aslo adding it to a role so that these nodes can later be sorted and have the correct roles added. So that going forward each new node will be created as soon as the server is setup without human interaction.
The way you do this is with the validator key system. Basically in the image have Chef installed, and have the /etc/chef/client.rb configuration created and pointed at your Chef Server, but don't create the client.pem key. If that key doesn't exist, chef-client will look for a validation key and use that to self-register with the Chef Server (by default it uses the FQDN of the server as the node name, but you can have your last-mile script append node_name "whatever" to the client.rb if you want to use something else). The difficult bit of validator-based bootstraps is how to store, access, and manage that validator key. The lazy way would be to just include it in the image, but this raises some troubling security issues. Unfortunately the best approach will depend entirely on what kind of systems you are running on and what security infrastructure is available. Also don't forget to remove the validator key after the initial bootstrap, there is a recipe in the chef-client cookbook for this.
So, I've just created a new site on Laravel Homestead. I pretty much always use .app as my local tld, and I've not had a problem with it before.
I've just created 2 new ones in my homestead.yaml file:
admin.philcross.app
philcross.app
I've run vagrant reload --provision and verified it's in my /etc/hosts file. Both domains are, and point to my VM.
If I go to philcross.app, it works. I see the webpage. If I go to admin.philcross.app, it fails, tells men There's an ICANN collision. However if I view the source, I see my webpage source. Not the error source.
To make it even more weirder, I already use a couple of local other domains locally exactly like the above (for example subdomain.domain.app locally). And it works.
The admin.philcross.app domain also works in Firefox.
I'm using Chrome, on Ubuntu 16.10.
I've tried altering the order of the domain mapping in my homestead.yaml file (ie putting admin.philcross.app before philcross.app and vice versa).
I've tried multiple timesvagrant halt / vagrant up / vagrant reload --provision / vagrant provision`
I've tried opening my hosts file with sudo and saving
Does anyone else have any ideas? I'm completely stuck, and all googling so far has just said to put the subdomain in the homestead.yaml file (not helpful).
.app is a real TLD, owned by Google. It isn't open for registrations yet, but it is likely to become available soon; your browser is warning you that your domain is likely to conflict with a real domain in the near future.
Don't use .app for internal applications or development, even locally. (Don't use .dev either; it, too, is a real TLD that belongs to Google!) Use one of the four top-level domains that has been explicitly and permanently reserved for testing:
.test
.example
.invalid
.localhost
map your sites to same root:
sites:
- map: philcross.app
to: /home/vagrant/philcross/public
- map: admin.philcross.app
to: /home/vagrant/philcross/public
I have been using vagrant for some time now and have came across "bugs" that I would like to understand more in depth.
the situation I encountered was that when provisioning a base box that I have created the /etc/exports file was loaded with the wrong IP, The file was given the IP the base box had while I was creating it, And once I packaged the base box, every time I did "vagrant up" and provisioned it there was an error because vagrant used the IP the base box had and the new box I was spinning up had a different (random) IP that i wanted vagrant to use.
So my question is, where does vagrant or virtualbox hold that data about the base box? why does it sometimes "stick" like that and sometimes doesn't? And when I'll understand where that data is stored, Is it holding any more data I can manipulate?
Coming from a MAMP Pro background, I loved the ability to have a "base" folder (/Sites in this case), have all of my projects underneath it and set custom server names/aliases with it. With Vagrant, it looks like I can accomplish the name/alias part with vagrant-hostsupdater, but if I really did just want to have the Vagrant files in /Sites and then all of them use the same config, what's the best way to specify a subfolder disk location with those custom host names?
I'm most likely over-thinking this, have just been a sucker for GUI interfaces and would love to know how to accomplish this. Thanks as always!
Clarification
What I'm used to
I used to use MAMP Pro, which allows you to setup custom host additions with their GUI interface. So, within my ~/Sites directory, I have several different projects going on, all in subfolders. The screen shot below shows how I can set a server name and specify a disk location, all from this central location.
What I'd like to do with Vagrant
Now I do know of (and used vagrant-hostsupdater), but what I was wondering is if I can set my Vagrant file in my ~/Sites directory (which is kind of like the root of the server; since all of my projects require the same setup) and then have individual host names setup for each project - so instead of having to access a subfolder like local.dev/project-1 or local.dev/project-2 I could setup server names such aslocal.project-1.comandlocal.project-2.com` from within that top-level Vagrant file and specify the subfolder it should attach that rewrite rule too.
The reason I'd like to do this is so I only have to run one vagrant up and I can then access all of my projects from one Vagrant instance as well as only keep track of one Vagrant file. Thanks!
You need to tell vagrant what hostnames you would like to use.
Directory based hostnames
Assuming you set you would like to set your hostnames based on the directory name; you can get all of the hostnames with ruby and pass them to the hostsupdater configuration.
SITES_DIR = "~/Sites"
config.hostsupdater.aliases = Dir["#{SITES_DIR}/*/"].map { |d| d.chomp('/') }
Configuration based hostnames
Alternatively you can mock up some sort of configuration that is desirable to you and what you are trying to do and evaluate/process it in ruby within the Vagrantfile.