Vagrant not syncing files to Virtual Machine - laravel

I am using Vagrant with Homestead on Windows 10 to sync my Laravel app to virtualbox.
Everything seems fine until i run laravel app in browser via custom domain like laravel.app then i get error No input file specified.
When i ssh into virtualbox i see that no files have been added from my project folder.
My homestead.yaml is most definitely configured correctly and i have entry in hosts file for custom domain.
I use all the latest versions and i did vagrant provision
I think my problem is somewhere in virtualbox but don't know where.
Here is my homestead.yaml config file http://pastebin.com/nJCqD4Qq

Related

local folder not populated when create new project

I am attempting to set up Homestead on a Windows 10 machine using VirtualBox and Vagrant so it can live in a virtual machine.
Using Git Bash, here is the sequence of steps thus far -
connect to Homestead virtual machine using vagrant ssh
run this command to create a new project called Laravel:
look at folders in Homestead directly on VM:
So far, so good.
Now here is where things don't seem to be working properly -
look in storage location on host operating system where Homestead.yaml is configured to park files
but there are no files there
Two questions:
What needs to be changed so the files appear in the designated location on Z:?
Once the change has been made, how will the files appear there when the project has already been created on the VM?
EDIT:
I was able to remove the original Laravel project using the comment below from #dparoli. After cd code I executed composer create-project --prefer-dist laravel/laravel Laravel but encountered the error shown below: [ErrorException] mkdir(): File exists. I'm guessing there's left over stuff from the first attempt. What should be done to clear up the error?

How to switch synced folder without reloading Vagrant?

Environment: Windows Host running Vagrant and VirtualBox with Ubuntu as the guest OS
Background: Doing basic provisioning inside Vagrantfile
When switching between various sites, I have found that I have to first run vagrant halt, cd in the Windows CLI to the base folder of the site I next want to work on (where the Vagrantfile is stored), and then vagrant up again in order for the synced folder in the guest OS to be mapped correctly to the code folder on the Windows host. This shutting down and restarting takes more time than I would like. I tried simply running vagrant provision after cd'ing in the Windows CLI to the folder of the site I want to work on, but this did not re-map the synced folder. I also tried vagrant suspend, cd'ed to another site folder, and then ran vagrant resume --provision, but this did not re-map the synced folder either. Is there any way to re-map the synced folder without going through the vagrant halt, cd another_site, vagrant up sequence?
1 Vagrantfile = 1 VirtualBox VM
so basically you're in folder1/ with its own Vagrantfile, you have started and managed this VM. You now want to "switch" to another VM (not just a folder) so you need to shutdown the current VM, go to the folder2 and start this VM.
What you want is to have a single VM and multiple project folder (site) linked within this VM. some projects like homestead let you easily managed this. Otherwise you can manage yourself: you need a single Vagrantfile (so it will be only 1 VM) and then all your projects within this project structure.

Proper way to destroy and re-create a VM with Homestead

I have followed the instructions here: http://laravel.com/docs/5.1/homestead to get a local Homestead VM. It worked perfectly and I got Laravel up and running (serve homestead.app /public) and synced to a folder on my host machine (say ~/Code).
After trying to get Xdebug running, I messed up with a few configuration files (nginx.conf, php.ini, etc.). and thus, I destroyed that VM instance by running "vagrant destroy default". I then boot-up the VM again ('vagrant up') and ssh into the box. The files which I changed were reverted (expected) and the ~/Code directory had the Laravel sample app which I had created previously (again, expected as it was copied over from my host machine).
What I don't get is why the server was still running successfully and I could access my sample app from my host machine? I never ran 'serve homestead.app /public' again and yet the server was already running serving the /public folder. I find this very confusing.
So what’s the correct way to destroy and recreate Homestead VMs?
Cheers, SK.
Destroy command does't remove box.
Here is docs. https://docs.vagrantup.com/v2/cli/destroy.html
To delete it:
homestead yourbox remove
if it doesn't work, try
vagrant yourbox remove

Vagrant synced folders disappearing

I'm using vagrant and have hashicorp/precise32 box. My projects in /products/ folder on this box. I want to reach this folder from my host computer. So added this configuration to my Vagrantfile
config.vm.synced_folder "/products","/products"
Also created /products folder on host. But after reload when I connect to box over SSH, /products folder's all contents are disappearing. When I comment out the config.vm.synced_folder line and reload, contents appering again.
Can you please tell me what's I missing?
Thank you.
Vagrant sync folder works the other way around
Synced folders enable Vagrant to sync a folder on the host machine to
the guest machine, allowing you to continue working on your project's
files on your host machine, but use the resources in the guest machine
to compile or run your project.
so if you have an existing folder on your guest machine and you ask vagrant to create a sync folder with one of your folder from the host, it will do but replace the content from the content of your host.
There is an old question with some good reference to understand it further

Vagrant doesnt open my fuelphp project

I was using a computer with an already configured Vagrant/VirtualBox ambient. Now, I need to put this box in another computer.
So, I do the vagrant package and added the box in my new computer.
So when I go vagrant up and vagrant ssh everything looks perfect, and all my files are there.
But when I try to access my localhost, vagrant just show me "It Works" page.
I guess I'm missing some reference or link to my project or something like that.
I'm using Ubuntu in both computers and my project use FuelPhp.
You have some options here.
First Option
Use a synced folder in your Vagrantfile
e.g
config.vm.synced_folder ".", "/var/www"
This will change your share folder mount in /vagrant/educarebr to /var/www and Apache will see the folder.
Second Option
Create a symbolic link in vagrant using a provisioner, as Shell Script.
Third Option
Create a new virtual host in your Apache with DocumentRoot /vagrant/educarebr.
However, check your old Vagrantfile and compare with your new Vagrantfile that you are using with box created with vagrant package.

Resources