-
Notifications
You must be signed in to change notification settings - Fork 336
Homestead environment setup
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.
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/
Clone the repository to your local computer. For this guide we will assume the code is placed at:
~/Code/timegrid
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
to192.168.10.10
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.
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
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
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.
alariva