Homestead Directory Missing After Reboot VM or Computer - macos

Homestead.yaml
folders:
- map: /Applications/MAMP/htdocs/code
to: /home/vagrant/code
Local directory : /Applications/MAMP/htdocs/code
Homestead directory : /home/vagrant/code
Everything is working perfectly beofore I reboot my computer, my homestead directory doesn't seem to sync with my local one anymore. They're missing completely.
I start my homestead VM , and SSH into it.
Then, I go into ~/code, and nothing there.
I tried to research into it, but people seem to have the same issue.
What is going on here ?
How can I fix this ?

In my local homestead directory, I run vagrant reload, I got this
and it works 100% for me.
vagrant reload : restarts vagrant machine, loads new Vagrantfile.

in your terminal Change directory to where your Homestead file was created
and type "VAGRANT UP" lower case.
well it work for me

Related

Laravel Homestead and vagrant don't create the folder inside vagrant box

I use Laravel Homestead for one year it all was good before I had decided change php version.
Firstly I update vagrant. Secondly I executed all commands from updating guide
vagrant destroy
git fetch
git pull origin release
vagrant box update
vagrant up
After vagrant up I saw that my databases were not created and my folder was not mounted (http://joxi.ru/Vm66DpgF410M5m).
I tried to connet via vagrant ssh, but there is not folder "code"
My Homestead.yaml
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: /home/ubuntu/PhpstormProjects/fntr
to: /home/vagrant/code/fntr
schedule: true
sites:
- map: fntr.test
to: /home/vagrant/code/fntr/public
php: "7.4"
databases:
- homestead
- testing
- imports
- prod_copy
I tried use vagrant destroy && vagrant up. I also tried vagrant reload --provision.
I have found the same issues in google and github, but this advices (http://joxi.ru/52a53oGUEBZMZ2 and other) did not help me.
I have the latest versions of vagrant and homestead.
I think that schedule: true not belongs to folders but to sites, try to remove it and run vagrant reload --provision.
I have found solution. But I am not sure that it is solution exactly.
I just reinstalled laravel homestead. Yes, I deleted homestead folder and went via instalation tutorial again.
Then I pasted my old Homestead.yaml and init vagrant box again.
Note if you want to try this method do not forget copy all of your after.sh, homestead.yaml and other files which can be lost

Homestead "No input file specified" with default settings?

Like title says, homestead.test default set up shows "no input file specified" - I have read every single thread (I think) regarding to this topic and I just can't figure out why this still occurs
Homestead.yaml
folders:
- map: ~/code
to: /home/vagrant/code
sites:
- map: homestead.test
to: /home/vagrant/code
I try to show simple Hello world on the screen. I have index.php inside code directory on my local machine and in the box.
Only error-ish thing what happened during the installation process is when I run vagrant provision/homestead provision it shows this red text:
homestead-7: You are running composer as "root", while "/home/vagrant/.composer" is owned by "vagrant"
homestead-7: You are already using composer version 1.6.5 (stable channel).
I researched this and found github issue: #806 - where svpernova09 stated:
This is nothing to worry about. This is the result of an upstream
change to ensure .composer is owned by the vagrant user.
At this point, I have no idea what I can do to make this work.
Any suggestions?
FYI, I have edited /etc/hosts -file and run provision after each edit.
Create a separate directory for your project (e.g. my_project), put index.php in that directory, and update the sites section accordingly.
sites:
- map: homestead.test
to: /home/vagrant/code/my_project
After that change run vagrant with:
vagrant up --provision

Laravel 5: second app is pointing to first app, how can I fix this?

Changed the application folder names in question to application1/application2 just for the purposes of this question.
If it makes any difference, I am using Homestead/Vagrant/VirtualBox.
In my homestead.yaml, I have this:
folders:
- map: ~/Homestead/Projects
to: /home/vagrant/Sites
sites:
- map: application1.app
to: /home/vagrant/Sites/application1/public
- map: application2.app
to: /home/vagrant/Sites/application2/public
In my hosts file, I have this:
127.0.0.1 application1.app application2.app
192.168.10.10 application1.app application2.app
When I just had the application1.app on both the homestead.yaml and hosts file, all was fine and dandy. Everything is still fine and dandy, however when I try to go to application2.app, it goes to the project in application1.app.
I tried flushing my DNS cache, no luck.
I tried vagrant --provision, no luck.
Can anyone please explain to me what I'm, doing wrong?
For anyone with this problem
Solved this with vagrant provision. My other method of vagrant --provision didn't work because there is no provision flag (according to freenode #laravel irc), so that must be for an older version - not Laravel 5.

How can I refresh homestead for a new site in my environment?

I'm running Laravel 4 on my development machine (Mac) with homestead and enjoying it thus far but having trouble when adding a new site. The problem is that I add lines like this for a new site in my ~/.homestead/Homestead.yaml file:
folders:
- map: ~/Sites
to: /home/vagrant/Sites
sites:
- map: listingnaples.dev
to: /home/vagrant/Sites/listingnaples.com/public
- map: videocraftersusa.dev
to: /home/vagrant/Sites/videocraftersusa.com/
Then, my /etc/hosts looks like this:
# MY SITES
192.168.10.10 listingnaples.dev
192.168.10.10 videocraftersusa.dev
192.168.10.10 laneyandchris.dev
If i go in and do a homestead destroy followed by homestead up I can access any of those new sites. That deletes my databases though and really sets me back. How do I "refresh" so to speak? If I add myawesomesite.dev to my /etc/hosts, how can I have homestead pick it up?
I tried homestead --provision but that isn't a recognized command.
For what it's worth, in my ~/.homestead/ directory, I do not have a VagrantFile. Not sure where that's at so I can't run a vagrant provision either.
You can also reload the box and the settings
vagrant reload --provision
This reload the box and see if there are changes, if that's the case it will make the changes while reloading
I just ssh using homestead ssh and then add this line
serve domain.app /home/vagrant/Code/path/to/public/directory
where you replace domain.app to your app name, the same you use on your yaml file and your path to your new public site directory, then just homestead up and you could see it active.
Try run vagrant global-status. You'll see the list of running boxes at this time, like this:
MacBook-Pro-lancedikson:~ lancedikson$ vagrant global-status
id name provider state directory
------------------------------------------------------------------------------------------
9710b02 default virtualbox running /Users/lancedikson/.composer/vendor/laravel/homestead
The above shows information about all known Vagrant environments
on this machine. This data is cached and may not be completely
up-to-date. To interact with any of the machines, you can go to
that directory and run Vagrant, or you can use the ID directly
with Vagrant commands from any directory. For example:
"vagrant destroy 1a2b3c4d"
That's all. Now run vagrant provision 9710b02 and it will be provisioned.
As of Laravel 5 and more importantly Homestead 2.0, just run:
homestead up
Then:
homestead provision
You have to use vagrant provision anyway from the same directory where Homestead.yaml is.
You can run:
homestead up --provision
In my case I had a Homestead.yaml in ~/.homestead/ and in ~/Homestead/.
I am not sure if the default location changed or that I changed it manually (maybe because I did not like the hidden dir), but make sure you don't have multiple Homestead.yaml files. I now symlinked them so I can not confuse myself any further.
But normally, homestead provision or homestead up --provision (when it was turned off) should do.

Vagrant - Homestead Setup Multiple sites

I have mapped the folders etc using the homestead.yaml;
ip: "192.168.10.10"
...
folders:
- map: /Users/User/Desktop/folder/Homestead/First
to: /home/vagrant/First
- map: /Users/User/Desktop/folder/Homestead/Second
to: /home/vagrant/Second
sites:
- map: first.dev
to: /home/vagrant/First/public
- map: second.dev
to: /home/vagrant/Second/public
But when i set up the hosts file, etc/hosts with my second.dev to 192.168.10.10 i find that the mapping goes to first.dev, not the mapping that i have set up for second.dev.
How can i go about making the mapping return the correct site?
EDIT: I am using Mac OS X.
Using Vagrant commands
Run the command vagrant provision within terminal or your command prompt within the folder where homestead files are located.
Another equivalent command is vagrant up --provision this will provision the vagrant machine as well as run it.
Using Global Homestead
You can use the command homestead provision to re-provision the vagrant machine, regardless of the place you call it from within the terminal.
Alternatively, you can use the serve command to add the information to your Homestead.yaml file for you. Like so;
serve domain.app /home/vagrant/Code/path/to/public/directory
But add this to your hosts file so you can access the your app via domain.app in your browser.

Resources