Adjusting Homestead Settings for Two Separate Projects and VMs - laravel

This is a question related to setting up Homestead for my two Laravel projects.
I currently have a Laravel project under this file directory Code/laravel. Within /laravel/ is where my first project's file resides (so my app folders.. storage folders.. et cetera).
My Homestead.yaml file is currently set up in this way:
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Code
to: /home/vagrant/Code
sites:
- map: localhost
to: /home/vagrant/Code/Laravel/public
So when I run vagrant up, my host file which mapped that IP address to the URL app.dev would show my Code/laravel/public folder's pages.
However, I am currently in the process of setting up a NEW project.
This new project goes under Code/schedulizer (where schedulizer is the name of the new project).
How would I change my Homestead settings to add the second project?
tl;dr: So to summarize, I have two SEPARATE projects under /Code/. My current Homestead settings is only configured for the project under Code/laravel and not Code/schedulizer. I want to have a VM for each project. What should I change my Homestead.yaml settings to?

ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Code // This is all your projects folder
to: /home/vagrant/Code // Will be placed here on homestead
sites:
- map: laravel.app // Laravel project domain
to: /home/vagrant/Code/laravel/public // Path to your public folder for laravel project
- map: schedulizer.app // Schedulizer project domain
to: /home/vagrant/Code/schedulizer/public // Path to your public folder for schedulizer project
After Homestead.yaml configuration need to run vagrant reload --provision
You cant find more detailed info here.

Related

can't find downloaded laravel files in mapped homestead folder

i just set up homestead and made sure that my folder is mapped correctly( by displaying some php content ), but when i download laravel from the virtual machine i can't find the files in the mapped folder.
homestead.yaml :
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: C:/Users/neo/Code
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
- map: fresh.app
to: /home/vagrant/Code/fresh/public
databases:
- homestead
- fresh
hosts:
127.0.0.1 localhost
127.0.0.1 localhost
192.168.10.10 fresh.app
Make sure your laravel homestead is in your home root's directory. Also
Change your
- map: C:/Users/neo/Code
to
- map: /Users/neo/Code
Then in your Homestead environment run command:
vagrant reload --provision
It should work fine now and map your folder.

Config homestead to map more than 1 project

I have mapped one project in the homestead yaml file and runs perfectly
but I tried to figure out how it works if I map more than one site
The domain name that is specified in the file as a second site I want to map is in this case called lkprojects.app
To be more concrete I want to direct to my lkprojects.app homestead domain
but it fails and I have tried with the serve command and homestead provision
So I'm a little confused about how I get that to work using the lkprojects.app domain
My homestead.yaml file looks like:
<code>
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: C:\Users\leo\.ssh\id_rsa.pub
keys:
- /Users/leo/.ssh/id_rsa
folders:
- map: /Projects
to: /home/vagrant/Projects/
sites:
- map: athliit.app
to: /home/vagrant/Projects/athliit/public
- map: lkprojects.app
to: /home/vagrant/Projects/lkprojects/public
databases:
- homestead
- athliit
- lkprojects
variables:
- key: APP_ENV
value: local
</code>
So if anyone knows what I'm doing wrong I would like some input.
Couple things:
Make sure you have added them to your hosts file:
192.168.10.10 athliit.app
192.168.10.10 lkprojects.app
In windows it's located in C:\Windows\System32\drivers\etc\hosts. OSX/Linux in /etc/hosts
Have you ran vagrant provision? This will propagate any config changes to your homestead instance

My Laravel Homestead doesn't work

I'm having problem to understand how to run my website using vagrant and Laravel Homestead environment.
I added laravel/homestead box without any problems. Then I ran vagrant init laravel/homestead and it worked too.
I managed to create Homestead.yaml and here's what it contains:
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/www
to: /home/vagrant/code
sites:
- map: project.dev
to: /home/vagrant/code/project
databases:
- homestead
variables:
- key: APP_ENV
value: local
vagrant up runs correctly, but I don't know how to access my website. I added 192.168.10.10 project.dev to my /etc/hosts.
I want to keep my project at ~/www/project. First thing that I didn't understand from the docs is, what is the folder at sites / map / to setting supposed to be? My local folder or a folder in the virtual environment?
The next thing I don't understand is why when I do vagrant ssh and then ls, I don't see any files, even though there's index.php at my ~/www/project. I thought they are going to be synchronized automatically.
When I go to project.dev in the browser, it timeouts. I tried project.dev:8000 as well and 192.168.10.10, but nothing works.
Please help me.
You are forgetting the folders parameter, also your indentation should be with spaces and not with tabs, thats the way yaml works, everything else seems to be fine but try to make it with something similar to this one
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/www/project
to: /home/vagrant/code
sites:
- map: project.dev
to: /home/vagrant/code/project/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
you're missing the folder share settings in you're homestead.yaml file.
Try adding
folders:
- map: ~/www/project
to: /home/vagrant/code
Look at the docs here
http://laravel.com/docs/5.1/homestead#configuring-homestead under Configuring Shared Folders
I think this is the common issue that someone new to Laravel Homestead is facing.
Laravel Homestead basically provides an image that gets a VM ready for Laravel development. The yaml config on "sites" is basically use to configure Nginx - it does not install a Laravel project on the path specified.
So for a new homestead VM, you just have to ssh into your Homestead VM, and type and run this:
composer global require "laravel/installer=~1.1"
Once done, on you /home/vagrant/code folder (in the VM, not your host), type and run this:
laravel new project
Where the "project" is the name given to your new project. Since your yaml is already configured to "project", the above command will work fine. Obviously, this is clearly not the only way to get Laravel as you can use composer create-project to install Laravel directly.
Once done, you should be able to visit http://project.dev on your host's browser, if your host file is configured with this added entry:
192.168.10.10<tab>project.dev
Alternatively, you can configure your host file to be
127.0.0.1<tab>project.dev
Which you can then view on your host's browser via http://project.dev:8000
Hope the above explains clear enough. Enjoy!

After installing Homestead I get "No input file specified" in the browser. How can I access my laravel project

I think I finally got homestead installed on my laptop! Now, I am trying to view my laravel project in the browser.
When I open "dev.app" in the browser I get a message that say "No input file specified." which I think means that my homestead is working but the laravel project is not there/setup.
I have created a folder called Projects on my local laptop (i.e. ~/Projects). Then from inside of it i executed this command
laravel new dev
But I still get the same error message in the browser i.e. "No input file specified." I have also tried to open this link "dev.app"/dev" but I still get the same message.
What I am doing wrong?
Here is the content of my Homestead.yaml file
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Projects
to: /home/vagrant/Code
sites:
- map: dev.app
to: /home/vagrant/Code/Laravel/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
Additional, when I execute the following 2 commands in order
cd ~/Projects
ls
I see the following directories dev homestead
What should I do to see my project when I go to dev.app ? Do I need to do anything from my Ubuntu VM or I should be able to edit the files directly in located on ~\Projects\dev" from my laptop?
Add an entry in /etc/hosts on your local machine
192.168.10.10 dev.app
Correct the path to the public folder in the sites section of your Homestead.yaml
sites:
- map: dev.app
to: /home/vagrant/Code/dev/public

Homestead virtualbox error, the host path of the shared folder is missing: ~/Code

Iam trying to use homestead laravel, seems some issue that am feeling strange.
root#seetha-H81M-S:/home# homestead up
Bringing machine 'default' up with 'virtualbox' provider...
There are errors in the configuration of this machine. Please fix
the following errors and try again:
vm:
* The host path of the shared folder is missing: ~/Code
homestead.yaml
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: ~/Code
to: /home/Homestead
sites:
- map: nal.app
to: /home/seetha/Homestead/nal/public
There is a folder named Homestead in /home/Homestead , still seems not working.
I have find similar questions in stack-overflow but nothing seems working for me.
Can anyone help me to solve this issue.
Thanks in advance.
OS Ubuntu 14.04
I had the same problem and fixed it by bash init.sh
Run the bash init.sh command from the Homestead directory to create the Homestead.yaml configuration file. The Homestead.yaml file will be placed in the ~/.homestead hidden directory.
If you are changing Homestead.yaml again, you have to re-run bash init.sh again. It will ask for overwrite, say yes.
You have this issue when your folders are not properly mapped.
This is how to map your folders in vagrant Homestead.yaml
folders:
- map: ~/Code
to: /home/vagrant/Code
~/Code means /home/yourUsername/Code must exist in your host computer.
The code folder will house all your Laravel apps.
Example you could have the following apps in Code folder which are on your host
/home/vagrant/Code/laravelapp
/home/vagrant/Code/laravelapp2
Homestead.yaml may now look like this
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: /wamp/www
to: /home/vagrant/Code
sites:
- map: laravel.dev
to: /home/vagrant/Code/laravelapp/public
- map: laravel.dev2
to: /home/vagrant/Code/laravelapp2/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
# blackfire:
# - id: foo
# token: bar

Resources