Reputation: 10748
Can someone explain the Homestead.yaml file in details. Not fully understanding its contents is bothering me.
Here is the complete 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: ~/Code
to: /home/vagrant/Code
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
databases:
- homestead
variables:
- key: APP_ENV
value: local
And here is what I understand about its content, correct me if I'm wrong and of course add comments.
authorize: ~/.ssh/id_rsa.pub
A directory in your local machine where you store the public .ssh file. This folder can be any folder in your local machine, right?keys: - ~/.ssh/id_rsa
A directory in your local machine where you store the local .ssh file. This folder can be any folder in your local machine, right?folders:
- map: ~/Code
to: /home/vagrant/Code
-map: A directory in your local machine where you store all of your porjects. This folder can be any folder in your local machine, right?
to: I believe this is where your projects will be stored in the virtual machine, if this is correct, does the last folder needs to match the last folder in the local structure?
sites:
- map: homestead.app
to: /home/vagrant/Code/Laravel/public
-map: I believe this is the url or domain you will be using to get to your site and it can be anything you want as long as you add it to your localhost file, correct?
to: I'm not sure what this is...
databases:
- homestead
A databese called homestead will be created automatically, correct?
Thanks
Upvotes: 11
Views: 12272
Reputation: 2447
You can also add an options
element to the map/to
elements in the folder
element, as in the example below, and to that, specify a range of options, which are documented in the Vagrant documentation.
- map: ~/Workspace/my/mapped/directory
to: /home/vagrant/my/directory
options:
owner: "www-data"
group: "www-data"
mount_options: ["dmode=0770,fmode=774"]
Upvotes: 5
Reputation: 2914
Though I am late to answer but I recently installed Homestead and Homestead.YAML was hard to understand as official documentation is lacking. Stumbled upon a very good article but its too long to copy here so I will just provide a link to it, Hope it may help newbies.
https://abbasharoon.me/homestead-yaml-explained-a-z/
Upvotes: 4
Reputation: 59
databases: - homestead A databese called homestead will be created automatically, correct?
Yes.
And if you want to create more databases, you can just add the database name bellow the - homestead
, and then run the command homestead provision
, you will see the database is created.
NOTICE the provision is harmful, for it will reset the database, and the data in you database will be removed as same as the tables.
Upvotes: 5
Reputation: 10517
authorize: ~/.ssh/id_rsa.pub A directory in your local machine where you store the public .ssh file. This folder can be any folder in your local machine, right? Yes
keys: - ~/.ssh/id_rsa A directory in your local machine where you store the local .ssh file. This folder can be any folder in your local machine, right? Yes
Homestead.yaml uses lots of defaults, this way when creating a new .ssh key you do not need to touch anything
folders: - map: ~/Code to: /home/vagrant/Code
-map: A directory in your local machine where you store all of your porjects. This folder can be any folder in your local machine, right? Yes to: I believe this is where your projects will be stored in the virtual machine, if this is correct, does the last folder needs to match the last folder in the local structure? No there isno need to, you just specify a route in your virtual machine and it will be filled with all files in the -map: folder
sites: - map: homestead.app to: /home/vagrant/Code/Laravel/public
-map: I believe this is the url or domain you will be using to get to your site and it can be anything you want as long as you add it to your localhost file, correct? to: I'm not sure what this is...
This two lines are configuring something like a virtualhost, i'm not sure how it really works internally, but basically you map one folder (to) to one domain (map), this will create a new virtualhost so that you can access you website by typing: homestead.app in you local machine browser. Remember that you need to edit your hosts file, either /etc/hosts or /windows/system32/drivers/etc/hosts and add a new line something like:
192.168.10.10 homestead.app
databases: - homestead Not sure about this one, i will take a look at it but it seems to me that you are right, just define a new name and omestead will create DB for you.
Hope this helps
Upvotes: 8