After installing the homestead and adding the box, and configured the Homestead.yaml that contains the url homestead.app
After doing an up and ssh, going to /etc/nginx/sites-enabled the homestead.app was there.
So I changed the homestead.app into site.daison.app in my Homestead.yaml from my hosts and doing a homestead halt and homestead up again and ssh just to reload my configurations as I thought.
Going back to the /etc/nginx/sites-enabled the homestead.app still remain.
So what I did is to destroy my homestead using the command homestead destroy and doing the up and ssh again going back to /etc/nginx/sites-enabled the config site.daison.app is now there.
Question:
Is there a way to do this and reload my homestead configurations instead of destroying it and doing things again and again?
Go to the directory where you homestead is created. Type in the terminal
vagrant provision
Homestead is just a predefined vagrant-box.
Documentation:
http://laravel.com/docs/4.2/homestead#daily-usage
Related
I can not see my project page on browser after do vagrant provision also I did vagrant relaod --provision
move homestead folder to inside www folder or do php artisan serve than exit and try again vagrant provision
I got a php project which is already done and for starters I have to put it up on a server (planning to use Heroku). I am new to PHP virtual boxes, Laravel, etc. The person who made the project recommended to use Laravel so I started to get things going that way. I am running on Windows 10 and using cmder as my terminal.
I downloaded VirtualBox & Vagrant.
Then using commander I added the Laravel/Homestead box
by doing:
vagrant box add laravel/homestead
in the folder c:\Users\Jacky\vagrant\ubuntu (At least I think that is where I added it)
Afterwards I believe I did
vagrant init
or vagrant init laravel/homestead
whatever I did afterwards I was able to run
vagrant ssh
and get into the system. There I was able to check and I had php and composer installed.
I then followed laravels instructions and created a homestead folder at c:\Jack\Homestead
ran git checkout for v7.19.2
ran init.bat
and configured the Homestead.yaml file
I made the following folder map
- map: C:\Jack\myapp\public
to: /home/vagrant/myapp
and the following site map
- map: myapp.test
to: /home/vagrant/myapp/public
I am a bit confused with the directory structure of this whole thing and not sure if I was supposed to put the myapp directory inside c:\Jack\Homestead\myapp or if just doing it like i did in c:\Jack\myapp is fine.
Anyways that still worked and I could see it in my web browser. So far all was good.
Then the project instructions told me to do the following
run composer install
There was an env.example file I had to change to .env and change some setting
run php artisan key:generate
run php artisan migrate --seed
run php artisan passport:install
run php artisan storage:link
At this point I got an error that the Symlink could not be created, so I googled and found in Stack Overflow to restart as admin. I ran cmder as admin and have been having a heart attack for the last 30 minutes since it told me I had to vagrant up and when I did so it couldnt find my box and even doing vagrant box list
I would get no results and it wanted to redownload which takes over 3 hours.
I just restarted without admin and I do find that my Laravel/Homestead box is listed so I assume it was installed for my user and not admin so I guess I cant run cmder as admin.
So now I am trying to connect again, I am not sure in which folder I should be running the vagrant commands but I only seem to have a VagrantFile in my C:\Jack\Homestead folder so if I run a vagrant command anywhere else it gives me an error that a vagrant environment is required, etc.
So I tried the following inside my homestead folder:
vagrant ssh - I get:
VM must be running to open SSH connection. Run `vagrant up to start the virtual machine.
(In my VirtualBox Manager i see my homestead-7 VM running though)
vagrant up - I get:
Bringing machine 'homestead-7' up with 'virtualbox' provider...
==> homestead-7: Importing base box 'laravel/homestead'...
==> homestead-7: Matching MAC address for NAT networking...
==> homestead-7: Checking if box 'laravel/homestead' is up to date...
A VirtualBox machine with the name 'homestead-7' already exists.
Please use another name or delete the machine with the existing
name, and try again.
vagrant ssh 'homestead-7' I also get
VM must be running to open SSH connection. Run vagrant up
to start the virtual machine.
And the problem is once I do connect I assume I will still have the same problem running:
php artisan storage:link
So my questions are as follows:
Where should I have my projects myapp folder, should it be where it is at C:\Jack\myapp or am I supposed to put it in C:\Jack\Homestead\myapp
Is the VagrantFile supposed to be only in my Homestead folder and is that where I should be running all my Vagrant commands from? Like vagrant ssh and vagrant up
How do I connect again now that I am getting those errors running vagrant ssh and vagrant up
Once I connect I assume I will get the same error running php artisan storage:link since to run as administrator seems to not work what do I do?
I Assume that I should run git init and heroku create inside the myapp folder is this correct?
1) I always keep my apps folders outside of the Homestead folder. Your Homestead folder contains a git project, so if you put your apps inside you should include the folder in the .gitignore file. I think it's easier if you just put your apps elsewhere.
2) Vagrantfile is suposed to only be inside of your Homestead folder ( c:\Jack\Homestead). You should run all your vagrant commands inside the Homestead folder.
3) I used to get this error when I tried to run 'vagrant up' to a project that used the same box name 'homestead-7'. If you have version control, check if the file c:\Jack\Homestead\.vagrant\machines\homestead-7\virtualbox\id has been changed. If so, try restoring the old value and running 'vagrant up' again.
4) You are running in a windows environment, right? Windows can be a little temperamental with symlinks inside vagrant. You'll get the same problem if you try to npm install something. What I do to solve this is to run npm (and php artisan storage:link) outside of the virtual machine, in the host pc, inside the root of the app folder. Just a reminder: to do that you will need php installed in your host machine.
5) All commands related to the app (and not the virtual machine) should be run inside the virtual machine, in the folder app (ex: /home/vagrant/code/myapp) or inside the app folder of your host machine. Those two folders are in sync, thanks to vagrant.
I used to work with homestead on a mac machine, but since i don't have access to that mac machine anymore i'm back on my windows machine.
So today i installed homestead with no problems, ran vagrant up and got: No input file specified.
which is normal because i didn't set my homestead.yaml to the right folders. so this i where i started to ran into problems.
I have a .Projects folder in my user directory and there i have a laravel 5.4 installation called test
this is my homestead.yaml (only the folder's and site's section)
folders:
- map: ~/Projects
to: /home/vagrant/Projects
sites:
- map: test.dev
to: /home/vagrant/Projects/test/public
Still the same message and i realy don't know why i hope someone with homestead + windows can help me !
You need to serve your site from homestead ssh.
serve test.dev /home/vagrant/Projects/test/public
then sudo nginx restart
You need to register your site from homestead first.
I tried setting up a virtual machine using Homestead box. I followed documentation on Laravel site for setting up Homestead.
When I ran the command vagrant up, it seemed to work in setting a VM. Then it asked to run vagrant provision, which I did.
I can't get pass red text 'You are already using composer version 1.1.3 (stable channel)'. I don't know what to do next.
Update: here is Homestead.yaml file:
Needed to edit the file at
~/.homestead/Homestead.yaml
instead of
~/Homestead/Homestead.yaml
after that reload it as usual
vagrant reload --provision
Add
~/.composer/vendor/bin
to Your PATH on host machine (not inside vm).
After restart terminal You can use homestead command.
I did a global install of Laravel homestead, edited my ~/.homestead/Homestead.yaml-file and spun up the VM with homestead up. Everything worked fine, but then I needed to add another site. I edited Homestead.yaml to contain the new project, the tried to run homestead provision to apply the changes to the VM. The only thing that outputs is:
==> default: VM not created. Moving on...
I interpret that as the VM is not running, but it is. The only thing working here is homestead destroy followed by homestead up, but that (by its nature) detroys the VM's saved state. I though that vagrant commands was applicable to homestead as well, but vagrant suspend && vagrant up --provision doesn't help.
So.. How do I apply my new config to an already-existing homestead VM?
I found the answer at Laracasts. Copied directly from there:
Try doing this... You should see a vagrant box that is listed that is linked to your composer/vendor...
vagrant global-status
Example Output:
$ vagrant global-status
id name provider state directory
-----------------------------------------------------------------------------------------------------
1ace413 default virtualbox running (...)/laravel/homestead
Then go ahead and run:
vagrant provision {ID}
Example input:
vagrant provision 1ace413
ID being the id of the vagrant instance in the above step.
You should then be good to go!
I recently change my laptop from 32 bit to 64 bit and have to redo installation and setup of my Homestead again.
After setup everything I run below command
vagrant reload --provision
and I get the same feedback which is
==> default: VM not created. Moving on...
After that I try this command and all works well.
vagrant up
I think for first time running Homestead, no need to reload --provision.
You can run vagrant provision to update homesteads websites. However you have to find where the Vagrantfile for the Homestead VM is. If you did the global install it should be in .composer/vendor/laravel/homestead/ directory. You need to change into that directory
cd ~/.composer/vendor/laravel/homestead
Then you need to provision the VM
vagrant provision
Your homestead box should then reflect the changes in the Homestead.yml file.
Edit: I am not at my mac right now so the directory path is a guess of what I remember it being the last time I provisioned my box so please take that into consideration but I am very sure that path should be correct.
I had my VM provision vertualbox running
so i had to exit first