Skip to content

configuring your development environment

Joey Kendall-Morwick edited this page Aug 23, 2015 · 18 revisions

How to Configure your Development Environment for SafeAssist

SafeAssist is built on top of the Laravel PHP MVC framework. The instructions below (including links) assume some familiarity with using a UNIX command-line. If you understand how to use basic commands like "cd", you should be fine.

Download Necessary Tools

SafeAssist is developed through an instance of the Laravel Homestead virtual machine, so your first step will be to get an instance of this VM running. Visit the link above and follow the instructions up to the point which reads "Cloning the Homestead Repository". If you're using Windows, use the "git shell" that comes with the windows github client (see below for installation link) to run commands from the terminal.

Clone SafeAssist

Next, clone the safe assist repository using either a GUI client or the command-line client.

Configure Homestead

Continue following the homestead installation instructions up to the "configuring shared folders" section. Make sure that under "folders" the "laravel-src" folder from your Safe-Assist clone is linked to /home/vagrant/safeassist. Also Make sure safeassist.app is linked to /home/vagrant/safeassist/public under "sites". Finally, list "safeassist" under databases. If you're using windows, use the git method to download homestead, enter the new "Homestead" directory, and run additional commands from there (including "bash init.sh", and in later steps "vagrant up", etc).

As an example, here is my Homestead.yaml file:

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

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: /home/joey/git/Safe-Assist/laravel-src
      to: /home/vagrant/safeassist

sites:
    - map: safeassist.app
      to: /home/vagrant/safeassist/public

databases:
    - safeassist

variables:
    - key: APP_ENV
      value: local

Finish the configuration instructions by updating your hosts file (using safeassist.app instead of homestead.app). If you're on windows, use these instructions to edit the hosts file.

Download assets for laravel

Next, start up the vagrant VM ("vagrant up" from the command-line) and connect to it ("vagrant ssh", or follow the instructions for windows on the installation page). Change directories to safeassist ("cd safeassist") and the run the "composer install" command. Wait until it completes.

Provide the environment file

Now create a file in this folder (either from the vagrant VM or with your editor of choice on the host OS side) called ".env". This will contain the configuration for Safe-Assist. Below is a sample .env file you can use:

APP_ENV=local
APP_DEBUG=true
APP_KEY=wqhf2JWr5UfJCbmAPOmqzOoP1x38Ho4e

DB_HOST=localhost
DB_DATABASE=safeassist
DB_USERNAME=homestead
DB_PASSWORD=secret

CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

MAIL_DRIVER=smtp
MAIL_HOST=mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null

Load a database

From your host OS, you should now be able to open a browser and visit "http://safeassist.app" to test the application. Now, in order to properly test it, you'll need to load a schema and perhaps some test data in to the database. Currently we have only the schema to load (though some additional sql files with test data will be developed). From the command-line from the guest OS in vagrant, run the commmand "mysql -u homestead -p". Then the password should be "secret", or whatever username/password combination you used in your .env file. Next type "use safeassist;" to switch to the safeassist database. Now copy/paste the contents of the SQL file you wish to load (model/database_schema.sql contains the bare schema with no test data).

When you are finished, use the "vagrant halt" command to stop the machine or the "vagrant destroy" command to take down the virtual machine and clear out the database. You can start it up again later with "vagrant up", but you will also then have to reload the database if you used the destroy option.

Check the glossary for definitions of the terms we use throughout our application/codebase, and add entries where necessary.

Expand our requirements analysis by creating or editing User Stories or creating a new issue you see resulting from them.

Clone this wiki locally