Homestead mapping folders and sites on ubuntu machine - laravel

I'm used to working in a windows environment and have homestead up and running on my windows machine.
I'm now trying to set up homestead on a machine running ubuntu, partly as a development opportunity for me and to overcome some perceived issues in windows that I've experienced with setting up development workflow. anyway....
I've successfully installed homestead and after vagrant upand changing my hosts file I can get the vagrant machine up and running. I can ping the url for my development site. However when I try and view the site in the browser - i get a timeout.
I can SSH into the vagrant machine but navigating to home/vagrantthere is no code folder - so it doesn't appear to be creating that folder on set up.
I added that folder from within the machine as sudo and gave write permissions - On examining the start up script I can see this message:
homestead: /home/vagrant/code => /media/ray/Develop/vagrant/projects
==> homestead: Detected mount owner ID within mount options. (uid: 1000 guestpath: /home/vagrant/code)
==> homestead: Detected mount group ID within mount options. (gid: 1000 guestpath: /home/vagrant/code)
Q1: Is there an error log within homestead I can view to try and work out what the issues are?
Q2: For now I'm assuming it may be a mapping issue in my homestead.yaml file - although in the past on windows this has manifested itself as ǹo input file detected`error.
My code is on a separate partition to the ubuntu machine (on my dual boot laptop). I can navigate to the files which are located in the media folder with this path:
/media/ray/Develop/vagrant/projects
Here is my current homestead.yamlfile:
---
ip: "192.168.56.56"
memory: 2048
cpus: 2
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: /media/ray/Develop/vagrant/projects
to: /home/vagrant/code
sites:
- map: wedleague.loc
to: /home/vagrant/code/wedleague/public
php: "8.1"
databases:
- homestead
- wedleague
- sandpit
features:
- mysql: true
- mariadb: false
- postgresql: false
- ohmyzsh: false
- webdriver: true
services:
- enabled:
- "mysql"
# - disabled:
# - "postgresql#11-main"
ports:
- send: 33060 # MySQL/MariaDB
to: 3306
Have I mapped this correctly? - I'm still getting used to ubuntu file system (mounted/symlink etc) over windows so wonder if I've made an error here.
Thank you

Related

Configured site for Homestead not working

Here is Homestead.yaml config :
ip: 192.168.9.10
memory: 2048
cpus: 2
provider: vmware_desktop
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
-
map: 'C:\Users\Khalil\RestfulAPI'
to: /home/vagrant/restfulapi
sites:
-
map: restfulapi.dev
to: /home/vagrant/restfulapi/public
php: "8.0"
databases:
- homestead
features:
-
mariadb: false
-
ohmyzsh: false
-
webdriver: false
name: restfulapi
hostname: restfulapi
I also added it to the hosts file : 192.168.9.10 restfulapi.dev
It works when i use http://restfulapi.local without mapping it directly as a site since i guess *.local is the default?
Running restfulapi.dev takes forever to load then gives a "connection time out", pinging the IP from my host responds with TTL expired in transit 4 times and ends with a
Ping statistics for 192.168.9.10:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
I can normally run vagrant ssh and ping 192.168.9.10 and get response, and it's also configured as eth1 on the machine when i run ip address show.
Tried provisioning, destroying the VM, setting up everything from scratch.
I attach my Homestead.yaml file for a test project that I am developing using Laravel Framework and PHPStorm.
[Homestead.yaml]
[1]: https://i.stack.imgur.com/VqkHh.png
After making changes to your Homestead.yaml file, execute
vagrant reload --provision
Once the virtual machine has finished booting, ssh into the VM through this command: vagrant ssh
Delete the version of php from your Homestead.yaml and run vagrant up and vagrant provision.

Laravel homestead ignores features to be installed

I want to add Minio to my Homestead VM. I've added the features option to the homestead.yml file, but running vagrant reload --provision doens't change anything and visiting http://homestead:9600/ gives me a ERR_CONNECTION_REFUSED. What am I missing here?
---
ip: "192.168.10.10"
memory: 4096
cpus: 1
provider: virtualbox
name: ausbildungsportal
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: E:\programierung\ausbildungslink
to: /home/vagrant/code/ausbildungslink
- map: E:\programierung\uptimechecker
to: /home/vagrant/code/uptimechecker
sites:
- map: azubi.tested
to: /home/vagrant/code/uptimechecker/public
- map: help.tested
to: /home/vagrant/code/ausbildungslink/public
databases:
- homestead
- azubiportal
- ausbildungslink
features:
- minio: true
I tried it and it didn't work for me. Fixed it by updating to the latest version of homestead
composer require laravel/homestead
I've just faced the same issue, leaving my solution here just in case.
For each feature, a separate script is triggered to manage the installation.
E.g. for docker it is homestead/scripts/features/docker.sh.
Inside it is checking if the feature is already installed (may look slightly different depending on the version):
if [ -f /home/$WSL_USER_NAME/.homestead-features/docker ]
then
echo "docker already installed."
exit 0
fi
So, if the feature is not installed, but still ignored by the Homestead script, you can just delete the needed file inside the VM (e.g. /home/vagrant/.homestead-features/docker for docker feature, similar for other features).

How to troubleshoot and enable folder synchronisation in Laravel Homestead?

I have followed instructions (https://laravel.com/docs/5.2/homestead) to set up laravel running in a Vagrant/Homestead box.
In the end, I should be able to the website from virtual machine by accessing homestead.app in browser on my host machine.
I´ve tried accessing in different ways, with and without specifying port 8000:
http://homestead.app - connection timeout
http://192.168.10.10 - connection timeout
http://localhost - connection timeout
http://127.0.0.1 - connection refused
After troubleshooting I have found that files are not synced to the virtual machine.
E:\homestead_local\Laravel\public\ contains index.php which I try to access. It is not synced to the VM.
I can´t find any error logs on server.
Also, on VM home/vagrant folder was empty after I did everything from instructions. I´m not sure if that was supposed to happen.
Instructions of what I did, keeping them short:
Installed Virtualbox 4.2 and Vagrant 1.8.1
Dowloaded vagrant box:
vagrant box add laravel/homestead
Installed Homestead 0.4.1
git clone https://github.com/laravel/homestead.git Homestead
Initialized homestead:
bash init.sh
Edited homestead.yaml file
Edited hosts file
Hosts file:
192.168.10.10 homestead.app
127.0.0.1 homestead.app
homestead.yaml file:
ip: "192.168.10.10"
memory: 768
cpus: 1
provider: virtualbox
authorize: ~/.ssh/id_rsa.pub
keys:
- ~/.ssh/id_rsa
folders:
- map: E:\HSprojects
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
databases:
- homestead
Questions
After running "vagrant up" my CMD shows this:
....
default: Mounting shared folders...
default: /vagrant => E:/Homestead
Why is it showing E:/Homestead and not E:/HSProjects?
Is sharing between folders bidirectional? I can't find a clear answer on this, but I assume they are.

My Homestead reset when i restart my machine

I'm facing a problem that everytime i restart my machine homestead reset, i mean when i ssh to my box, i can't find the directories in the development directory
I mean that i find the directories on my machine but when i ssh to homestead i can't find them
i tried to run homestead provision but nothing changed, still can link between my machine and the virtual box
you see below that i have laravel directory linked to my current box code\laravel
My setup like that
---
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: laravel.app
to: /home/vagrant/code/laravel/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
Sounds annoying. Have you tried using vagrant reload instead?
In case you know when you're going to shut down your computer (not when low battery is forcing a shutdown) you can save your vagrant box's state by doing vagrant suspend and after boot: vagrant resume.
Hope this works for you.

Laravel Homestead shared folder missing

I've got Vagrant and Virtual Box installed. I'm in the process of trying to get Homestead working. My .yaml file looks like
---
ip: "192.168.10.10"
memory: 2048
cpus: 1
authorize: C:/Users/GiggleSquid/.ssh/id_rsa.pub
keys:
- C:/Users/GiggleSquid/.ssh/id_rsa
folders:
- map: D:/Code
to: /home/vagrant/Code
sites:
- map: 8Byte.app
to: /home/vagrant/Code/Projects/8Byte/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
But every time I run vagrant up in Git Bash, it throws an error
GiggleSquid#SQUID-RIG /d/Code/Homestead (master)
$ vagrant 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
Any ideas?
Exactly same answer to error log. You Code folder is missing in your Windows environment. Create a folder name Code placed in D:/
You should check VirtualBox version. VirtualBox5.0 version doesn't work shard folder. it is working on VirtualBox 4.3 version.

Resources