Skip to content
This repository has been archived by the owner on Mar 20, 2024. It is now read-only.

Homestead environment setup

Ariel Vallese edited this page Apr 22, 2016 · 4 revisions

Using the Homestead environment allows you to easily setup your local environment to get up and running quickly and easily without worrying too much about web and database servers setup. This page aims to providing a guide to the additional steps required from the standard Laravel Homestead install.

1. Install Laravel Homestead

First thing you will need to do is follow the instructions from the Laravel 5.2 docs to install Laravel Homestead locally.

Note: for this guide we will assume you are using VirtualBox as the provider and the install path for Homestead is:

~/Homestead/

2. Clone the repository

Clone the repository to your local computer. For this guide we will assume the code is placed at:

~/Code/timegrid

3. Configure Homestead

Edit your Homestead.yaml file located at:

~/.homestead/Homestead.yaml

Replace...

sites: 
    - map: homestead.app
      to: /home/vagrant/Code/Laravel/public

...with:

sites:
    - map: timegrid.app
      to: /home/vagrant/Code/timegrid/public

This will create a virtual host mapping for the timegrid.app (in theory you don't need to use timegrid.app, however just be sure to make the same adjustments in later steps)

Note: you will also need to make sure your hosts file is updated to point timegrid.app to 192.168.10.10

4. Update Homestead after.sh script

We will now ask Homestead to install required PHP extensions for provisioning.

Add this to your after.sh file:

sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php7.0-intl

This will enable the PHP intl extension.

5. Configure your .env file

Copy the example .env

cp .env.example .env

Set the application key

php artisan key:generate

Make sure you have these settings for homestead:

APP_URL=http://timegrid.app/

DB_HOST=timegrid.app
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

ROOT_REPORT_MAIL=<your email here>
STORAGE_PATH=/home/vagrant/Code/timegrid/storage

Note: this guide does not yet cover the Test DB setup

6. Composer install and database scripts

You should now be able to SSH to the Homestead environment by doing:

cd ~/Homestead
vagrant ssh

Note: if the VM is not yet running you may need to provision it by doing:

vagrant up

Then you can run the install scripts from within the Homestead VM.

cd ~/Code/timegrid
sudo composer install

Migrate the database:

php artisan migrate

Seed the database

php artisan db:seed

Update geoip database:

php artisan geoip:update

7. Ready to use timegrid

You should now be able to view the app by typing http://timegrid.app/ on your browser. You can also now make any code changes to the local repository and it will be reflected at this address.