particulum mobile: zend expressive microservices in … · zend expressive microservices in docker...

41
PARTICULUM MOBILE: ZEND EXPRESSIVE MICROSERVICES IN DOCKER SWARM Jan Burkl Solution Consulting Manager , Dortmund, November 9th 2017 Rogue Wave Software php.ruhr 2017

Upload: others

Post on 20-May-2020

31 views

Category:

Documents


0 download

TRANSCRIPT

PARTICULUMMOBILE:ZENDEXPRESSIVEMICROSERVICESIN

DOCKERSWARMJanBurkl

SolutionConsultingManager

,Dortmund,November9th2017

RogueWaveSoftware

php.ruhr2017

ZENDEXPRESSIVE

EXPRESSIVE2.0ThePHPframeworkforMiddlewareapplications

PSR-7HTTPMessagesupport(using)

Supportoflambdamiddleware(PSR-15)anddoublepass($request,$response,$next)Pipingworkflow(using )Features:routing,dependencyinjection,templating,errorhandlingLastrelease2.0.3,28thMarch2017

zend-diactoros

zend-stratigility

MIDDLEWAREAfunctionthatgetsarequestandgeneratesa

response

usePsr\Http\Message\ServerRequestInterfaceasRequest;useInterop\Http\ServerMiddleware\DelegateInterface;

function(Request$request,DelegateInterface$next){//doingsomethingwith$request...//forinstancecallingthedelegatemiddleware$next$response=$next->process($request);//manipulatethe$responsereturn$response;}

INSTALLATIONYoucaninstallExpressive2.0using :

Choosethedefaultoptionsduringtheinstallation

composer

composercreate-projectzendframework/zend-expressive-skeletonapi

PARTICULUMMOBILE

PERPETUUMMOBILE/FREEENERGY

Yourbrowserdoesnotcurrentlyrecognizeanyofthevideoformatsavailable.

ClickheretovisitourfrequentlyaskedquestionsaboutHTML5video.

PerpetualMotion-FreeEnergy

0:21/1:38

bitbucket.org/5square-rw/particulum-mobile-backend

bitbucket.org/5square-rw/particulum-mobile-master

MICROSERVICES

NoStandardDefinitionNoSpecificationNotspecifictoanyTechnology

“[...]acollectionoflooselycoupledservices.”

en.wikipedia.org/wiki/Microservices

DOCKERMICROSERVICEARCHITECTURAL

STYLE“[...]asuiteofsmallservices,eachrunninginitsownprocessandcommunicatingwithlightweight

mechanisms,oftenanHTTPresourceAPI”

martinfowler.com/articles/microservices.html

DOCKERCOMPOSE

DOCKERSWARM(MODE)“CurrentversionsofDockerincludeswarmmodefornativelymanagingaclusterofDockerEnginescalleda

swarm.UsetheDockerCLItocreateaswarm,deployapplicationservicesto

aswarm,andmanageswarmbehavior.”

MYLOCALSETUPVirtualBoxVagrant3NodesUbuntu16

INIT/MANAGER

$dockerswarminit--advertise-addr192.168.99.121

Swarminitialized:currentnode(bvz81updecsj6wjz393c09vti)isnow

Toaddaworkertothisswarm,runthefollowingcommand:

dockerswarmjoin\--tokenSWMTKN-1-3pu6hszjas19xyp7ghgosyx9k8atbfcr8p2is99znpy26u2lkl-1awxwuwd3z9j1z3puu7rcgdbx\172.17.0.2:2377

Toaddamanagertothisswarm,run'dockerswarmjoin-tokenmanager'

ROUTINGMESH“Theroutingmeshenableseachnodeintheswarmtoacceptconnectionsonpublishedportsforanyservicerunningintheswarm,evenifthere’s

notaskrunningonthenode.”

INGRESSNETWORK

https://docs.docker.com/engine/swarm/ingress/

DEPLOYMENT

DOCKERCOMPOSEV3

DEV

PROD

InstallandUpdate

$dockerstackdeploy--compose-filestack.ymlpm

BUILDING(ANDPUSHING)IMAGES

BUILD

$dockerbuild-tparticulum-mobile/backend.

DOCKER-COMPOSEbuildsimageson-the-fly

MAKEFILE

CIAAS(TravisCI)CodehipWerckerCodefreshetc...

DEMOParticulumMobile,Portainer,Visualizer

SCALABLEMICROSERVICESessionHandling?

ONESTEPBEYOND

WHATDOWEHAVE?

WHATDOWEWANT?

WHY?

PRIORIZATIONBrowserrequestlimitRequestqueueingonserverside

JustaDockerComposefilemodification

BENEFITS1/2DockerSwarm(&Compose)Seeabove⬆SystemSetupConfiginVCSModularConsistentStack

BENEFITS2/2Expressive

LightweightNoFrameworkSiloModularBacktotheRoots

DANKESCHÖNContactme:jan.burkl[at]roguewave.com

Followme:

Slides:

@janatzend

5square.de/talks