Skip to content
LaraDock for MSA dev env with Node.JS app
Shell PHP Dockerfile
Branch: master
Clone or download

Latest commit

Latest commit 7418fa9 Feb 26, 2020

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.laradock-multi test Feb 15, 2020
cmd use rebuild with deploy Feb 16, 2020
dumps 1st scratch Feb 1, 2020
projects new minore changes Feb 15, 2020
.gitignore new minore changes Feb 15, 2020
Integrate.md use rebuild with deploy Feb 16, 2020
LICENSE
Readme.md Update Readme.md Feb 26, 2020

Readme.md

LaraDock Multi

Laradock wrapper template for running multiple related projects with different versions of PHP and Node.js such as Microservice Architecture (MSA)

Demo used

Instruction for configure step-by-step

  • Integrate Demo of usage with Cloud env (Yandex Cloud for example as simple and useful)

Commands

  • cmd/bash.sh laravel - connect to LaraDock-multi service
  • cmd/logs.sh - waiting for all logs
  • cmd/logs.sh nginx laravel - waiting for logs of nginx and laravel workers or cli
  • cmd/ps.sh - shop details about LaraDock-multi services
  • cmd/rebuild.sh - remove, load updates and rebuild each one LaraDock-multi services
  • cmd/rebuild.sh laravel-fpm nginx rebuild only laravel-fpm and nginx
  • cmd/stop.sh - stop all services
  • cmd/stop.sh nginx api - stop services: nginx and api
  • cmd/up.sh - start all services
  • cmd/up.sh nginx api - start services: nginx and api

Setup

Install Docker-CE with Docker-compose

apt install docker docker-compose

Download Laradock-Multi with laradock

git clone https://github.com/bagart/laradock-multi.git
cd laradock-multi

Autoconfigure and Auto-deploy

You cal automate Configure, Upgrade and download Laradock with command

cmd/deploy.sh

Force Upgrade Laradock Multi. It's will remove laradock path

cmd/deploy.sh upgrade

Manual Configure(upgrade) multi-env

git clone https://github.com/Laradock/laradock.git
cp ./.laradock-multi/. ./laradock/ -r

Also, you can use git submodule add https://github.com/Laradock/laradock.git

Install projects

PHP Site like Laravel

I will use dummy laravel-like php site for demo

mkdir projects/laravel
mkdir projects/laravel/public
echo '<?php phpinfo();' >> projects/laravel/public/index.php

But you can install original laravel or your exist project

composer create-project --prefer-dist laravel/laravel projects/laravel

Node.JS

I will use pretty CoreUi admin template on ReactJS

git clone https://github.com/coreui/coreui-free-react-admin-template.git projects/dashboard
cp laradock/nginx/sites/dashboard.conf.example laradock/nginx/sites/dashboard.conf

It's already added: dashboard docker in docker-compose.multi.yml. You can copy this section for using with other node.js projects

Configure

Feel free to changing .laradock-multi options

Using

Using is similar to https://github.com/bagart/laradock_env

cmd/up.sh

Important note:

  • Nginx crush in runtime after load config, if some dependency service (php-fpm, node.js) not started. So, immediately cmd/ps.sh will return success result and failed in next call
  • laravel service is empty by default
  • dashboard not configured by default

HTTP Service

Alternative

docker-compose override

Also you can use docker-compose.override.yml https://docs.docker.com/compose/extends/. But it's depends on platform

cd laradock;
cp docker-compose.multi.yml docker-compose.override.yml

and remove all typical service like db or docker-in-docker Result:

  • docker-compose ps will equal:
    • docker-compose ps -f docker-compose.yml -f docker-compose.override.yml
  • docker-compose logs will equal:
    • docker-compose logs -f docker-compose.yml -f docker-compose.override.yml

But docker-compose up without specs will failed

CMD from project

Open default preoject with IDE

Switch to internal bash terminal

use Laradock-multi:

cmd/up.sh

copy this dir to each new project

cp -r projects/default/cmd projects/laravel/cmd 

Update

git pull
cd laradock
git pull
cd ..

add all changes

  • from: diff .laradock-multi/docker-compose.yml.orig laradock/docker-compose.yml

    • to laradock/docker-compose.multiple.yml
      • workspace to api, laravel, default
      • php-fpm to api-fpm, laravel-fpm, php-fpm
      • each one with same name
  • from: diff .laradock-multi/env-example.orig laradock/env-example

    • to laradick/.env

Rebuild each Laradock-Multi service

cmd/rebuild.sh

Structure

  • .laradock-multi/ - custom services path for LaraDock
  • cmd/ - simple command for using with autocomplete
    • .jump_to_laradock.sh - cd to LaraDock path (for internal use)
    • bash.sh - connect to LaraDock-multi service
    • logs.sh - logs -f all LaraDock-multi service or cmd/logs.sh laravel nginx for listed
    • ps.sh - show info for LaraDock-multi service
    • rebuild.sh - remove, pull and rebuild each one LaraDock-multi services or cmd/rebuild.sh laravel nginx for listed
    • stop.sh - stop LaraDock-multi services or cmd/stop.sh laravel nginx for listed
    • up.sh - start all LaraDock-multi services or cmd/up.sh laravel nginx for listed
  • dumps/ - path for DB dumps. That will be mount inside DB-service
  • laradock/ - original laradock + laradock-multi
  • projects/ - custom projects
    • api/ - API project with PHP 5.6
    • dashboard/ - CoreUI project with NodeJS+React (after install)
    • default/ - Default localhost project for internal use or service list
    • laravel/ - Laravel project with PHP 7.4 (after install)
  • Readme.md - Readme file with instructions
You can’t perform that action at this time.