cnb/dockerino

Dockerized development environment for laravel

This package's canonical repository appears to be gone and the package has been frozen as a result.

v1.0.1 2018-02-23 20:30 UTC

This package is not auto-updated.

Last update: 2019-08-02 15:57:12 UTC


README

68747470733a2f2f7669676e657474652e77696b69612e6e6f636f6f6b69652e6e65742f73696d70736f6e732f696d616765732f382f38342f4e65645f466c616e646572732e706e672f7265766973696f6e2f6c61746573743f63623d3230313030353133313630313536

A simple Artisan extension that enables creation of required services with docker, bsaed on the content of the .env file

Setup

First make sure you created your own .env file, based on the .env.example that is likely to be found in any Laravel project,

cp .env.example .env

Commands

The available commands are pretty self explanatory, calling php artisan will show (amongst others), the following:

  docker:destroy       Destroy Docker machines
  docker:start         Start Docker services, based on .env
  docker:state         Get Docker state
  docker:stop          Stop Docker

MySQL & Redis

Dockerino will read the env file and (do its best to) figure out what are the services required to run your project correctly. The extension will ignore most sections, except for those that are related to external services. For example if the .env contains something like

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=myapp
DB_USERNAME=root
DB_PASSWORD=SECRET

Dockerino will create a docker machine shaped after this configuration. As of now all machines will only have the root user, this is convenient, since root doesn't require additional grants, which can slow down development.

if DB_CONNECTION is something other than MySQL, it will skip it and not create the service.

Same goes for Redis. If QUEUE_DRIVER=redis Dockerino will be looking for a section like

REDIS_HOST=rocketpostredis.devel
REDIS_PASSWORD=password
REDIS_PORT=6379

and if found it will create the appropriate services.

What's next

Next, you can serve your app locally with:

php artisan serve

and if you specified localhost as your host(s) everything should run fine. If your host is something other than localhost, you'd have to update you etc/hosts file or use a service like dnsmasq to redirect certain domains to your local machine.

If you're running your machine in apache or nginx you have to make sure your docker machines are accessible from the application.