Skip to content

Latest commit

 

History

History
103 lines (84 loc) · 3 KB

setup.md

File metadata and controls

103 lines (84 loc) · 3 KB

Setup

Kickstart your development environment with this guide.

Install Docker

The current Docker environment is based on Docker Toolbox. If you don't have Docker Toolbox installed, you can download it here.

Creating the Docker Virtual Machine

To generate a virtual machine, run the following command anywhere in your terminal:

docker-machine create default --driver=virtualbox

To prevent permission problems we leverage Docker-Machine-NFS to mount volumes as NFS. First, install docker-machine-nfs and then run the following command:

docker-machine-nfs default --nfs-config="-alldirs -maproot=0" --mount-opts="noacl,async,nolock,vers=3,udp,noatime,actimeo=1"

As a final step, load the docker-machine:

eval $(docker-machine env default)

Register domain names in hosts-file

The development stack will expose the following domains:

  • simplerestchat.dev - the URL of application

These domains need to be added to the /etc/hosts files. First look up the ip-address of your Docker VM:

docker-machine ip $(docker-machine active)

Next, open the hosts file

sudo nano /etc/hosts

Append the following line to the file (change the ip-address to your Docker VM's ip):

192.168.99.100  simplerestchat.dev

Install vendor dependencies with Composer

To install all composer dependencies, run the following command:

docker run --rm -v $(PWD):/app -v $($HOME)/.composer:/composer --user $(id -u):$(id -g) composer install --optimize-autoloader --no-interaction --no-progress --no-scripts

Setup Docker development environment

Create the required network in order to communicate with the reverse proxy:

docker network create traefik_bridge_gateway --driver bridge

From the root directory of the repository, create a Docker Registry which will host our images:

docker-compose -f docker-compose.local.yml up -d registry

Next, build the App image (Multistage build):

docker-compose -f docker-compose.local.yml build

After the image was build successfully, push it to the registry:

docker-compose -f docker-compose.local.yml push

Now the image has been pushed to the registry, we can start the development stack with:

docker-compose -f docker-compose.local.yml up -d

Create the database

touch database/database.sqlite 

Configure environment variables

Create an .env file and set your enviroment variables. There is an .env.example file in order to help you.

Migrate the database

To migrate the database, run the following through the command-line:

php artisan migrate

Seed the database

To seed the database, run the following through the command-line:

php artisan db:seed 

Is it working?

Try:

open http://simplerestchat.dev

You should see the Laravel Lumen homepage with the version information

Get your Postman ready