Austin Hunter
Austin Hunter

Reputation: 394

How to open and run a existing Vagrant/Homestead project

I recently was given a Laravel/php project. I downloaded the project from gitHub and am trying to get it to run.

Here is a screenshot of the file system for the downloaded project:

enter image description here

Here is the file system of the homestead directory:

enter image description here

And here is my homestead.yaml:

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: parallels

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/code
      to: /home/vagrant/code

sites:
    - map: homestead.test
      to: /home/vagrant/code/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

The project is ran using a Homestead/Vagrant setup, and I am trying to figure out how to do that. I have Homestead and Vagrant installed, could someone help me figure this out?

Upvotes: 2

Views: 5305

Answers (3)

edesilets
edesilets

Reputation: 180

Here is the General rundown.....

  1. So if your on Ubuntu or OSX you need to add homestead.test to your /etc/hosts file along and direct it to the ip address specified in your homestead.yml (Via the config you provided it's 192.168.10.10)

  2. Next: Go into your Homestead folder and run vagrant provision.
    WHATS HAPPENING: This will run "homestead's" provision script. (Per your config it will create a "homestead" database and map the Nginx config to your virtual machine's folder of /home/vagrant/code/public. It will also copy the contents of ~/code (might want to use an absolute file path.) on your local machine to the virtual machine's folder of /home/vagrant/code. So far everything is looking good in your config, but see my note on the file path

  3. Log into your vagrant box (aka: virtual machine) using vagrant ssh. (if its down bring the box up with vagrant up)

  4. Navigate into that project directory in the virtual machine. cd /home/vagrant/code/public

  5. Install packages by using composer command --> composer install

  6. Things will break if you don't generate a encryption key for they project. You can generate one by running artisan key:generate

  7. Hit your endpoint! Looks like you called yours homestead.test. If chrome stops your with a HSTS warning for ssl. (You can google how to properly fix this issue. In the meantime if you see that page you can type badidea and you can continue on)

  8. If you have issue from here it could be database credentials stoping you. The default user name for your homestead database is homestead and the default password is secret.

I hope I was able to fill in the blanks that you may have encountered on your setup. Also keep in mind that your can run php artisan serve --port=8080 on your local machine.( You will have to install missing packages manually via homebrew or apt-get install apt-get docs) Information about this can be found on Local Development Server Header. https://laravel.com has great docs with small voids so also look there for further help. Good Luck!

So from you information provided above in your comment back to me your project is running Laravel Framework 4.2.* . So the command I told you to run doesn't exist yet. (artisan key:generate) This command is only available in 5.* if I remember correctly.

Upvotes: 3

webdevdani
webdevdani

Reputation: 1102

If you have VirtualBox installed, you should be able to just run vagrant up from the Homestead project directory. https://laravel.com/docs/5.5/homestead#launching-the-vagrant-box

Upvotes: -1

joepferguson
joepferguson

Reputation: 1088

Start with the Homestead docs: http://laravel.com/docs/homestead

You'll likely need Virtualbox (If you don't already have it installed)

Upvotes: 0

Related Questions