PARTICULUMMOBILE:ZENDEXPRESSIVEMICROSERVICESIN
DOCKERSWARMJanBurkl
SolutionConsultingManager
,LasVegas,October25th2017
RogueWaveSoftware
ZendCon2017
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”
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)IMAGESself-contained
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