Python Microservices Development_ Build efficient and lightweight microservices using the Python tooling e.pdf
- 文档编号:23121073
- 上传时间:2023-05-08
- 格式:PDF
- 页数:311
- 大小:4.15MB
Python Microservices Development_ Build efficient and lightweight microservices using the Python tooling e.pdf
《Python Microservices Development_ Build efficient and lightweight microservices using the Python tooling e.pdf》由会员分享,可在线阅读,更多相关《Python Microservices Development_ Build efficient and lightweight microservices using the Python tooling e.pdf(311页珍藏版)》请在冰豆网上搜索。
PythonMicroservicesDevelopmentSecondEditionBuildefficientandlightweightmicroservicesusingthePythontoolingecosystemSimonFraserTarekZiadBIRMINGHAMMUMBAIPythonMicroservicesDevelopmentSecondEditionCopyright2021PacktPublishingAllrightsreserved.Nopartofthisbookmaybereproduced,storedinaretrievalsystem,ortransmittedinanyformorbyanymeans,withoutthepriorwrittenpermissionofthepublisher,exceptinthecaseofbriefquotationsembeddedincriticalarticlesorreviews.Everyefforthasbeenmadeinthepreparationofthisbooktoensuretheaccuracyoftheinformationpresented.However,theinformationcontainedinthisbookissoldwithoutwarranty,eitherexpressorimplied.Neithertheauthor(s),norPacktPublishingoritsdealersanddistributors,willbeheldliableforanydamagescausedorallegedtohavebeencauseddirectlyorindirectlybythisbook.PacktPublishinghasendeavoredtoprovidetrademarkinformationaboutallofthecompaniesandproductsmentionedinthisbookbytheappropriateuseofcapitals.However,PacktPublishingcannotguaranteetheaccuracyofthisinformation.Producer:
ShaileshJainAcquisitionEditorPeerReviews:
SabyDSilvaProjectEditor:
RiannaRodriguesContentDevelopmentEditor:
AlexPattersonCopyEditor:
SafisEditingTechnicalEditor:
KaranSonawaneProofreader:
SafisEditingIndexer:
RekhaNairPresentationDesigner:
PranitPadwalFirstpublished:
July2017Secondedition:
September2021Productionreference:
1280921PublishedbyPacktPublishingLtd.LiveryPlace35LiveryStreetBirminghamB32PB,UK.ISBN978-1-80107-630-ContributorsAbouttheauthorsSimonFraserisaSiteReliabilityEngineerforCiscoMeraki.Hehasovertwentyyearsofexperienceincomputing,bothdevelopingandrunningsystems.HehasworkedasaSystemsAdministratorforaninternetserviceprovider;aninfrastructureandhigh-performancecomputingengineerattheWelcomeSangerInstitute,andasaFirefoxReleaseEngineeratMozilla.HestudiedCyberneticsandComputerScienceattheUniversityofReadingandhasalsotaughtacademiccoursesinprogrammingforscientists.IwouldliketothankEmmaAptedandHelenCookfortheirfrequentsupportandencouragement,rangingfromproofreadingtomimingabookopeningwhenImclearlynotworking.MyfatherGeorgeFraserpassedonhisimmeasurableskillatfinishingaprojectjustbeforethedeadline,andmymotherElizabethFrasershowedmehowtoexplainconceptsandinformpeoplethroughyearsofteaching.ThisbookwouldalsonotbepossiblewithoutTarekZiadsworkonthe1steditionandthesolidbaseonwhichtobuild,aswellastheworkofDevelopmentEditorAlexPatterson,ReviewerWilliamKahn-Greene,andProjectEditorRiannaRodrigues.Wemightstandontheshouldersofgiants,butwealsobuildonahugestructuremadebyeveryoneofus,soIwouldalsoliketothankeveryoneIveworkedwithovertheyearsinallmydifferentteams.Yes,evenyou.TarekZiadisaSoftwareEngineer,locatedinBurgundy,France.HeworksatElastic,buildingtoolsfordevelopers.BeforeElastic,heworkedatMozillafor10years,andhefoundedaFrenchPythonusergroup,calledAFPy.TarekhasalsowrittenseveralarticlesaboutPythonforvariousmagazines,andafewbooksinFrenchandEnglish.IwouldliketothankFreya,Suki,Milo,andAminaforbeingsosupportiveofallmybookprojects.AboutthereviewerWillKahn-GreenehasbeenbuildingthingsinPythonandotherlanguagessincethelate90s.HemanagesthecrashingestionpipelineatMozillaandmaintainsseveralPythonlibraries.WhenheswaitingforCItoruntests,hebuildsthingswithwood,tendshistomatoplants,andcooksforfour.vTableofContentsPrefacexiChapter1:
UnderstandingMicroservices1Theoriginsofservice-orientedarchitecture2Themonolithicapproach3Themicroserviceapproach8Microservicebenefits10Separationofconcerns10Smallerprojects10Scalinganddeployment11Pitfallsofmicroservices12Illogicalsplitting12Morenetworkinteractions13Datastoringandsharing13Compatibilityissues14Testing14ImplementingmicroserviceswithPython15Howwebserviceswork16TheWSGIstandard16Workers,threads,andsynchronicity17Aworkerpoolapproach17Beingasynchronous18Twisted,Tornado,Greenlets,andGevent19AsynchronousPython19Languageperformance21Summary24TableofContentsviChapter2:
DiscoveringQuart25MakingsurewehavePython27HowQuarthandlesrequests28Routing32Variablesandconverters33Theurl_forfunction37Request37Response38Quartsbuilt-infeatures40Thesessionobject40Globals41Signals42Extensionsandmiddleware44Templates46Configuration48Blueprints50Errorhandling52Customerrorhandler52Amicroserviceskeleton54Summary57Chapter3:
Coding,Testing,andDocumentation:
theVirtuousCycle59Differentkindsoftests62Unittests63Functionaltests67Integrationtests70Loadtests71End-to-endtests75Usingpytestandtox76Developerdocumentation80Toolsfordocumentation81Versioncontrol85ContinuousIntegrationandContinuousDeployment86GitHubActions87Documentation88Coveralls89Badges89Summary90TableofContentsviiChapter4:
DesigningJeeves91TheJeevesbot92Userstories92Monolithicdesign93Model94Viewandtemplate97Ahuman-readableview100Slackworkspaces103Takingactions107OAuthtokens108Authenticationandauthorization109Backgroundtasks113Puttingtogetherthemonolithicdesign116Summary118Chapter5:
SplittingtheMonolith119Identifyingpotentialmicroservices119Codecomplexityandmaintenance121MetricsandMonitoring122Logging128SplittingaMonolith131FeatureFlags135RefactoringJeeves137Workflow139Summary140Chapter6:
InteractingwithOtherServices141Callingotherwebresources142Findingoutwheretogo145Environmentvariables145Servicediscovery145Transferringdata146HTTPcacheheaders147GZIPcompression149ProtocolBuffers152MessagePack153Puttingittogether155Asynchronousmessages155Messagequeuereliability156Basicqueues156TableofContentsviiiTopicexchangesandqueues157Publish/subscribe161Puttingittogether162Testing162UsingOpenAPI164Summary165Chapter7:
SecuringYourServices167TheOAuth2protocol168X.509certificate-basedauthentication170Token-basedauthentication173TheJWTstandard174PyJWT176UsingacertificatewithJWT177TheTokenDealermicroservice179TheOAuthimplementation180UsingTokenDealer184Securingyourcode186Limitingyourapplicationscope187Untrustedincomingdata189Redirectingandtrustingqueries192Sanitizinginputdata193UsingBanditlinter194Dependencies195Webapplicationfirewall195OpenResty:
Luaandnginx196Rateandconcurrencylimiting199OtherOpenRestyfeatures201Summary202Chapter8:
MakingaDashboard203BuildingaReactJSdashboard205TheJSXsyntax205Reactcomponents206Pre-processingJSX211ReactJSandQuart212Cross-originresourcesharing213Authenticationandauthorization215AnoteaboutMicroFrontends216GettingtheSlacktoken218JavaScriptauthentication220Summary221TableofContentsixChapter9:
PackagingandRunningPython223Thepackagingtoolchain224Afewdefinitions225Packaging226Thesetup.pyfile226Therequirements.txtfile231TheMANIFEST.infile234Versioning235Releasing238Distributing239Runningallmicroservices242Processmanagement243Summary245Chapter10:
DeployingonAWS247WhatisDocker?
248IntroductiontoDocker251RunningQuartinDocker255Docker-baseddeployments257Terraform259Servicediscovery261DockerCompose263DockerSwarm265Kubernetes267Summary272Chapter11:
WhatsNext?
275Automation275Scaling276ContentDeliveryNetworks277Multi-clouddeployments277LambdaFunctions277Expandingmonitoring278Makingpromises278Summary280OtherBooksYouMayEnjoy283Index287xiPrefacePythonMicroservicesDevelopmentintroducesthedesignandcreationofamicroservice-basedapplicationusingthepopularPythonprogramminglanguage,andtheQuartwebframework.Inthisbook,youwilllearnaboutmicroservicearchitectureandhowitdiffersfromthetraditionalmonolithicapproach,whatthebenefitsare,aswellaspotentialtroublethatneedsovercoming.WhothisbookisforThisbookisforpeoplefamiliarwiththefundamentalsofthePythonprogramminglanguagewhowanttostartwritingwebservices,orwhohaveinheritedawebservicetheywanttomodernize.ItisexpectedthatthereaderwillbefamiliarwithsimplePythonstructuressuchasfunctionsandloops,aswellassomemoreadvancedfeaturessuchasdecorators.Somefamiliaritywithusingwebapplicationswouldbehelpful,althoughthefundamentalsofapplicationdesignarecovered.WhatthisbookcoversChapter1,UnderstandingMicroservices,introducestheconceptsbehindmicroservices,thedifferencesbetweenmonolithicapplicationsandmicroservices,commonbenefitsandpitfalls,aswellastestingandscaling.Chapter2,DiscoveringQuart,coverstheQuartwebframeworkandthewaysinwhichitcanrespondtorequests,createtemplateddocuments,actasmiddleware,handleerrors,andreadconfiguration.PrefacexiiChapter3,Coding,Testing,andDocumentation:
theVirtuousCycle,teachesyouaboutthedifferenttypesoftestingthatarepossible,whatbenefitseachtypehas,andhowtosetupautomatictesting,aswellasgeneratingdocumentationinCIpipelines.Chapter4,DesigningJeeves,looksatJeeves,whichisthesampleapplicationweuseinthisbooktoexplainthevariousconceptsbehindmicroservices.WeintroducewhatweneedJeevestodoanddescribeamonolithicapproachtoapplicationdesign,coveringthewebAPIinterface,databaseuse,andworkerpools.Chapter5,SplittingtheMonolith,buildsonthemonolithicJeevesdescribedinpreviouschapter.Thischapteroffersguidanceonhowtoidentifycomponentsthatmaybegoodmicroservices,measuringtheeffectsofchangesonthesoftwarearchitecture,andhowtocleanlymigratefeaturestonewmicroservices.Chapter6,InteractingwithOtherSer
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- Python Microservices Development_ Build efficient and lightweight using the tooling
链接地址:https://www.bdocx.com/doc/23121073.html