-1

Am working on Laravel for the first time. I have a source code on GIT and database of Laravel application. I came to know that it will not run on windows environment. So I installed Virtual Box, Vagrant machine and GIT. Now I don't know how to proceed with setting up local Dev environment. How can find out the source code is compatible to Laravel homestead or just Laravel . What is the difference between running an application in Laravel and in Laravel homestead version.

Can anyone guide me with local Dev environment? Or can someone share the resources which can help in setting up the environment? How can I integrate existing GIT source code in new combination of vagrant-virtualbox-Laravel?

Mangesh Sathe
  • 1,987
  • 4
  • 21
  • 40

1 Answers1

1

One way to it, is to install Vagrant and virtual box. In vagrant, you would then have a Vagrant Box, where Laravel is pre-installed.

The Vagrant Box name with laravel within it is called Homestead.

The idea with Homestead is, that you have everything within one package, instead of 10 different packages (Ubuntu server, Git, PHP, Apache, Nginx, MySQL ect.)

So to answer the headline: Homestead is a Vagrant Box, and Laravel is an MVC Framework

Now to what I believe you really want to know:

You can easily follow these steps (https://laravel.com/docs/5.7/homestead)

But instead of installing a raw laravel installation, you would simply clone the one you want to work on.

Steps:

  • Install vagrant and virtual box
  • Create a new folder within your ~ dir, with name "code"
  • CMD: vagrant box add laravel/homestead
  • CMD: git clone https://github.com/laravel/homestead.git ~/Homestead
  • CMD: cd ~/Homestead
  • CMD: init.bat (for windows), bash init.sh (for MAC)
  • NOTE: The above might not work from git bash, and you may need to go into original CMD and CD to homestead holder.
  • CMD: vagrant up
  • CMD: vagrant SSH (from within Homestead holder, but not sure if it makes any difference if you are not within the homestead folder)
  • At this point, when you LS you should see a folder named "code" and nothing else
  • CMD: cd code
  • CMD: git clone theRepositoryYouWant

Now a couple more things:

  • Install HeidiSQL
  • in HeidiSQL you use the data from Homestead.yaml (within your Homestead folder) to login to the database.
  • Remember to php artisan migrate when you are on the server, within the "code" dir and have cloned the repository
Patrick
  • 781
  • 2
  • 5
  • 23
  • Thanks for the quick reply..I will start with what you have just mentioned here... – Mangesh Sathe Oct 23 '18 at 11:05
  • should I select 3rd option after vagrant box add laravel/homestead command? am running this command inside code directory – Mangesh Sathe Oct 23 '18 at 11:27
  • Select the one that says virtual box, if it is virtual box you installed :) Run everything from within Homestead directory, to be on the safe line :) – Patrick Oct 23 '18 at 11:28
  • After running git clone https://github.com/laravel/homestead.git ~/Homestead, at the command prompt its saying Homestead already exists and its not empty directory – Mangesh Sathe Oct 23 '18 at 11:52
  • my code folder where am running CMD is at c:\project\code but git clone https://github.com/laravel/homestead.git ~/Homestead is saying its already there in c:\users\myname – Mangesh Sathe Oct 23 '18 at 11:54
  • You might have installed it earlier. Try CD to homestead folder and do "vagrant up" and then "vagrant ssh" – Patrick Oct 23 '18 at 11:56
  • I got it correct now, I just changed your command to git clone https://github.com/laravel/homestead.git Homestead (just removed ~/) I thought vagrant uses ~/ for directory separator ! – Mangesh Sathe Oct 23 '18 at 11:58
  • Good, let me know if you need further assistance :) – Patrick Oct 23 '18 at 12:23
  • Sure! machine got restarted during vagrant up...so reconfiguring it again – Mangesh Sathe Oct 23 '18 at 12:26
  • Actually we are using Amazon workspace so whenever I run vagrant up command, workspace gets rebooted. I could not proceed after that. Am trying to find out plugin that stops this amazon workspace reboot. – Mangesh Sathe Oct 24 '18 at 09:28
  • Try this: `vagrant plugin install vagrant-aws` and then `vagrant up --provider=aws` or simply follow these directions: https://github.com/mitchellh/vagrant-aws – Patrick Oct 24 '18 at 09:33
  • Again stuck at vagrant up --provider=aws , error saying One or more of the needed AWS credentials are missing, but the credential conf file where vagrant wanted me to modify is not there in mentioned path. – Mangesh Sathe Oct 24 '18 at 14:46
  • BTW Thanks for your help! – Mangesh Sathe Oct 24 '18 at 14:46