Abhirath Mahipal
Abhirath Mahipal

Reputation: 956

Vagrant doesn't read Homestead.yaml

I've been trying to sync a folder between my computer and a Homestead VM run using Vagrant. My guess is that Vagrant isn't reading my Homestead.yaml file as no change is reflected in the VM.

I've tried the following:

contents of ~/.homestead

Homestead.yaml

---
ip: "192.168.10.10"
memory: 512
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Desktop/Laravel_Recipes
      to: /home/vagrant/Laravel_Recipes

sites:
    - map: recipes.dev
      to: /home/vagrant/Laravel_Recipes/public

databases:
    - homestead

# blackfire:
#     - id: foo
#       token: bar
#       client-id: foo
#       client-token: bar

# ports:
#     - send: 50000
#       to: 5000
#     - send: 7777
#       to: 777
#       protocol: udp

Upvotes: 2

Views: 2251

Answers (3)

Abhirath Mahipal
Abhirath Mahipal

Reputation: 956

Cause

I followed along the tutorial given on Laravel's Website like everyone else. I cloned their github repo to ~/Homestead like given in the tutorial. After running the bash script as mentioned the directory ~/.homestead came into existence. They mention running vagrant up while inside the .homestead directory. It needs the files present in the Homestead directory.

So the best solution would be to use
git clone https://github.com/laravel/homestead.git ~/.homestead
instead of
git clone https://github.com/laravel/homestead.git Homestead.

Explanation

Turned out I was using an almost empty Vagrantfile filled entirely with comments. Hence I wasn't using the Vagrantfile provided by Laravel. I used the default Vagrant file that came up after running vagrant init laravel/homestead

The plain Vagrantfile has almost zero settings. It doesn't look for any YAML or JSON file for user specified settings. Every change I made turned out to be useless due to this reason.

The vagrant file has to explicitly load the Homestead.yaml file in order to get the user settings. You can either edit the Vagrantfile (you need to know the basic of Ruby or tinker around) or just use the configured Vagrantfile that comes with Laravel.

The following articles helped me understand:

Upvotes: 2

M. Jenkins
M. Jenkins

Reputation: 1

The problem is that the Vagrantfile created with init.sh during the aliases phase is trying to be written to .homestead If you have that directory it will be created and you can copy it to the ~/Homestead directory and vagrant will work properly. Otherwise you can copy the Vagrantfile from ~/Homestead/resources/localized to ~/Homestead

Upvotes: 0

Gayan
Gayan

Reputation: 3704

When you do homestead up your existing configurations loaded from the Homestead.yaml file.

But if you change any if the existing configuration that won't be affected until you do homestead provision

Reference: Configure Homestead

Upvotes: 1

Related Questions