On my local machine I have created using homestead vagrant box a laravel project. Now I have an Homestead folder that contains many files like Vagrantfile, Homestead.yaml configuration and as soon as. I have also another folder sibling of Homestead folder that contain the Laravel files project. My question is how to share on Git this folders in order to clone the repository from another machine and recreate automatically the same Vagrant machine and the laravel project? In both folders there are composer.json files.Thanks in advance.
1 Answers
Depends on what you want to achieve. If you want to have a "frozen" in time vagrant box you would init homestead, let it do it's thing and them remove anything that's not mentioned in the vagrant file, then use that as a base for your repo. You can also fork homestead, run init and the use that as a base.
Homestead has an extra provisioning script, by convention named after.sh
(see this for an example and this to see when it's called), which could clone your project from a separate repo into a place of your choosing (consistent with the project root you set up in your homestead file).
My point is -- don't mix development environment setup with your project files.
All of the above could be done under assumption you would have all the prerequisite software installed on your machine (vagrant, homestead, git, etc). Otherwise (maybe homestead would do it for you) you might also right a custom setup script that would check those dependencies, attempt to install them and the up
the homestead box based on your configuration (something like a pre-init to init.sh
:)). Or just put the instructions in the readme file (or link to Laravel's documentation).
I hope this helps!