Reputation: 2711
I have received instructions from a developer about Vagrant that might be just flat out wrong. I've reached out to this dev 10 times and can't get the delivered Vagrant box to work properly.
The dev gave me a zip file that is supposed to be a Vagrant box.
The contents are:
README.md config/ company-name/
Vagrantfile custom/ bin/
The contents of the config/
dir are
box.yaml files vms.yaml
default.yaml user.yaml
facts-devbox.yaml user.yaml-sample
I assume this is the structure of a devbox that you'd download and run.
I follow the instructions of the dev and cd [described folder]
I then run vagrant up
This triggers a lengthy installation process with a lot of custom scripts...
I then run vagrant ssh
and use bitbucket to pull files into /var/www
in the Vagrant VM.
The confusing thing to me is that there are a ton of files that end up on my host machine.
Everything I install to /var/www/
in the Vagrant VM appear on the host file system in /var/www
as well.
Is this normal procedure for a Vagrant box? What is the point of a VM that puts files all over the host machine?
Is there some typical Vagrant config file that might reveal details about a shared folder structure like this between VM and host?
I know the best answer is ask the dev... but in this case communication has failed so many times over with this agency and they are basically unaware of how their own system works.
Upvotes: 0
Views: 1017
Reputation: 53793
Is this normal procedure for a Vagrant box?
Yep its a normal procedure and its a good point of vagrant - you dont need to exchange big fat files and boxes are hosted on the cloud (most comes from https://atlas.hashicorp.com/boxes nowdays)
so when you did run vagrant up
vagrant actually had to download a box and install on your system and then runs a set of provision steps.
Thats all good - most teams commits project including the vagrantfile, a new team member joins, clone the repo, vagrant up and he has same env as everyone else.
The dev gave me a zip file that is supposed to be a Vagrant box.
He did not give you the vagrant box but the project folder containing the Vagrantfile with all configuration about the provisoning
If you open your Vagrantfile you will have a param as
config.vm.box = "something" (maybe something/something)
config.vm.box_url = "url" (is the box is private and hosted somewhere by your company)
basically those parameters instructs vagrant where to download the box and vagrant will install the box locally for you when you run vagrant up
so you dont need to manage this part. This is a very good improvement that has been made
This triggers a lengthy installation process with a lot of custom scripts...
Yep, provisioning can take some time depending what you install on your VM (DB, app server, config ...) but this process is only done once when you setup the VM. After this as long as you do not need to vagrant destroy
the machine, booting the instance will be much faster
What is the point of a VM that puts files all over the host machine?
Is there some typical Vagrant config file that might reveal details about a shared folder structure like this between VM and host?
These 2 questions come together, so as you get, the Vagrantfile is the key file with vagrant config. vagrant can also manage shared folder for you, so you probably have a config like
config.vm.synced_folder "/var/www", "/var/www"
since you mentioned
Everything I install to /var/www/ in the Vagrant VM appear on the host file system in /var/www as well.
This part is bad indeed and I will not recommend for this but its good to share your VM /var/www
or /var/wwww/site-xxx
with a folder on your host (but not your local /var/www
) so everything you change on your host will be synced for you on the VM. so you work with you local tools on your host and everything is refreshed on the VM
Upvotes: 3