Back

Homestead adding new sites (vagrant destroy)


Is the only way to add new sites to your Vagrant setup to edit the Homestead.yaml file and then "vagrant destroy".
I'm trying to switch over from MAMP (Pro) but can't see myself doing this, because as far as I can tell, "vagrant destroy" will remove all databases.
Can't see myself wanting to add a new site under this and having to destroy and rebuild every project's database, even with artisan migrate and db:seed.

Am I doing it wrong?

sambarocker replied 5 years ago

"vagrant reload" is not enough?

ChrisSoutham replied 5 years ago

I'll give that a try, thanks.

michaelaccenture replied 5 years ago

Or in putty via ssh, "serve domain.app /home/vagrant/Code/path/to/public/directory"

But I haven't got that working yet :)

ChrisSoutham replied 5 years ago

Hmm, while 'vagrant reload' will sync the newly mapped folder it doesn't seem to touch the sites elements. Looks like 'vagrant destroy' is the only option.

michaelaccenture replied 5 years ago

Can confirm vagrant destroy works, I have validated this. But the serve option still eludes me. If you can get the serve option to work it bypasses the need to destroy the vagrant box.

So far I have ran the serve command:

  • Added the domain to the hosts file
  • Validated the files exist on the VM and my local
  • Ran composer update
  • Ran php artisan dump-autoload
  • Checked the available roots

Still get the response "No input file specified." on any route listed.

michaelaccenture replied 5 years ago

Got to the root of my issue, the serve command is working. However the variables $1 and $2 are not populated and being passed to the script.

I therefore have /etc/nginx/sites-enabled/$1, and server entries keep being appended to this file.

Any one had similar things happen? or even a solution?

scottwakefield replied 5 years ago

This could be of some help: https://github.com/laravel/homestead/pull/6

shabushabu replied 5 years ago Solution

Haven't used Homestead, but I would try this:

vagrant provision

or

vagrant reload --provision

There's really no need to destroy the whole VM.

michaelaccenture replied 5 years ago

Thanks Scott, that solved it!

Also checkout https://github.com/laravel/homestead/issues/13

If you just want to patch it on your own.

@Shabushabu - I will definitely give the provision command a whirl later to see if that is also a fix.

shabushabu replied 5 years ago

That's a big part of what makes Vagrant so awesome. For me anyways. You change something in a config file, like adding a new site. Then you run the provisioners again after that and everything that's missing gets added. Doesn't matter which provisioner you use. Could be Ansible, SaltStack, Chef or Puppet. They all keep track of your files and if something changes then it'll get updated the next time you provision your VM. Only reason why this approach might not work is if Homestead uses only bash scripts.

UPDATE: Had a look at Homesteads vagrant config file and it seems to be only running shell provisioners, so the provision command might or might not work, depending on these shell scripts.

ChrisSoutham replied 5 years ago

shabushabu

vagrant reload --provision

This seems to work, thank you - it leaves a trail of folders on the vagrant machine but not exactly difficult to clean up. Better than rebuilding every time anyway!

shabushabu replied 5 years ago

It's just a development machine, so whatever folders it creates it might actually need. And if it doesn't then they won't do any harm. I wouldn't worry about them. Anyways, glad I could help.

algomis replied 5 years ago

It works for me too. Thank you so much, I was going insane trying to find a fix for this error.

villimagg replied 4 years ago
vagrant reload --provison

That did the trick! Thinking about aliasing that command to perhaps 'vrp' as in v(agrant) r(eload) (--)p(rovision).

Any thoughts?

villimagg replied 4 years ago
vagrant reload --provison

That did the trick! Thinking about aliasing that command to perhaps 'vrp' as in v(agrant) r(eload) (--)p(rovision).

Any thoughts?

whoacowboy replied 3 years ago

+1 and 6 chars


Sign in to participate in this thread!



We'd like to thank these amazing companies for supporting us