Laravel development environment in Docker containers
dup
dartisan make:auth
dcomposer update
dnodejs npm install
dgulp-watch
Make sure you have docker
docker-machine
and docker-compose
installed. See here for installing them
git clone https://github.com/SpiralOutDotEu/dockervel.git
cd dockervel
sudo su
. ./aliases.sh
dup
and you have a server running! Hit localhost
in your browser and you will see nginx fault message becasuse there is no www/public/index.php
.
dcomposer-create
dcomposer-create-lumen
dpermit
dartisan make:auth
, dartisan migrate
dpermit
Now you have a registration system active. Go to localhost
and register a new user to see that db's are running ok.
dnodejs npm install
dnodejs gulp install
dulp-watch
Now there is one container running gulp watch
and monitors changes on files according your gulpfile.js
dunit
aliases.sh contains shortcuts to common commands. run dot space dot /aliases.sh to activate aliases for this terminal session.
. ./aliases.sh
and now for this terminal session you have aliases like dartisan
, dcomposer
, dnodejs
, dup
, dstop
, dunit
.
If you don't want to work with aliases, open the script and see the coressponding commands next to each alias.
In the following document it is supposed that you have executed aliashes.sh
as su
and you have the aliases active.
dcomposer-create
localhost
in your browser and you see the Laravel welcome screendcomposer-create-lumen
localhost
in your browser and you see the Lumen welcome screensince containers have different user in them, you have to change the permisions in www/ folder to be able to write. type:
dpermit
it will simply chmod -R 777 www
Remember to run dpermit
after each time the www
folder has a new file.
change DB_HOST
in .env
to point to mysql
. This is the name that it is used in docker-compose.yml (link: -mysql:mysql
)
DB_HOST=mysql
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
change REDIS_HOST
in .env
to point to predis
. This is the name that it is used in docker-compose.yml (link: -redis:predis
).
REDIS_HOST=predis
REDIS_PASSWORD=null
REDIS_PORT=6379
in Laravel 5.2 there are some issues with redis
namespace, so to avoid conflicts predis
is used.
Also you have to change /config/app.php, and replace:
'Redis' => Illuminate\Support\Facades\Redis::class,
with
'LaravelRedis' => Illuminate\Support\Facades\Redis::class,
Use it like:
$redis= LaravelRedis::connection();
$redis->set('name', 'myname');
$redis->get('name');
type dartisan
followed by an artisan command
example:
$ dartisan make:auth
$ dartisan migrate
$ dartisan tinker
type dcomposer
followed by a composer command
example:
$ dcomposer update
$ dcomposer require predis/predis
to install node modules in your project run
dnodejs npm install
install gulp with:
dnodejs gulp install:
run gulp once:
dgulp
add gulp watch:
dgulp-watch
Thanx to: