Microservices for a Carrying Hailing Service System
Total Page:16
File Type:pdf, Size:1020Kb
Universidad Politécnica de Madrid Escuela Técnica Superior de Ingenieros Informáticos Máster Universitario en Ingeniería de Software – European Master’s in Software Engineering Master Thesis Microservices for a Carrying Hailing Service System Management of Users and their Economic Transactions, Generation of Reports, and Interaction with External Suppliers Author: Washington Daniel Quinapallo Vallejo Supervisor: Jaime Ramírez Rodríguez Madrid, June 2020 This Master's Thesis has been submitted to the ETSI Informáticos at Universidad Politécnica de Madrid for its defense. Master Thesis European master’s in software engineering Title: Microservices for a Carrying Hailing Service System: Management of Users and their Economic Transactions, Generation of Reports, and Interaction with External Suppliers Thesis: EMSE-2020-8 June 2020 Author: Washington Daniel Quinapallo Vallejo Supervisor: Jaime Ramírez Rodríguez Departamento de Lenguajes y Sistemas Informáticos e Ingeniería de Software ETSI Informáticos Universidad Politécnica de Madrid Acknowledgements To God for allowing me the possibility of completing my studies, with health and life to complete them, and being my source of inspiration and wisdom, in addition to his infinite love. "God does not play dice with the universe" - Albert Einstein To all my family for their valuable support in this milestone in my life since they have been the fundamental pillar to always move towards new achievements. To my partners from the company "DGC Llevar", who have been an excellent work team with whom you can share this valuable project. As thesis director, Jaime Ramírez for giving me his support at every step in the development of this document. To the friends that somehow had with me, giving me their support and motivation to successfully complete my studies. To the Polytechnic University of Madrid, for allowing me to be part of such a prestigious educational institution. 1 Abstract In the transport sector of Ecuador, there is no technological platform for requesting through mobile devices trips or rides that perform the cargo transport service of different natures. DGC Llevar, as an association of carriers nationwide, carries out the execution of their services in a traditional way. For this reason, this project aims to create a communication channel between transport drivers and customers who require this service. The realization of this platform aims to: x Create a mobile application for drivers who can receive requests for transport service. x Create a mobile application for customers that require cargo transport service. x Create a server application that serves as intermediary between driver and customer mobile apps. In turn, the server application will consist of two back-ends, Realtime management and Administration. The back-end for the Realtime management of the application will be responsible for the geolocation of the drivers, supporting the communication between the two mobile devices, as well as the calculation of fares for the performed rides. In addition, the back-end for Administration will allow for the storage of the information of the customers, drivers, current and performed rides, economic transactions carried out by the service as well as the configuration of the system, payment management and reporting. Currently, digital platforms that provide transportation services, such as Uber or Cabify, which are globally recognized, operate with specific architectures that can scale and grow on demand. In this way, they have the possibility to response a huge number of trips, not only in one country, but also around the world. In order to provide quality services to all its users, it is necessary to define an architecture that allows responding from low to very high demand situations. So, we aim to develop a platform that can respond to an enormous volume of requests, which can even border millions of users working simultaneously. Hence, it was determined that the microservices pattern may support a future growth of users and trips if necessary. In the application design, adopting microservices is a good practice for applications that need to scale. Moreover, the elasticity of cloud services will allow us to optimize resources based on the increase or decrease of demand. The development of this document will consist of the investigation, design, development, implementation and testing of microservices related to the Administration back-end as well as the reporting necessary for decision-making 2 through Business Intelligence and Data Warehouse. We will use the Microsoft Azure platform to carry out the deployment of the microservices in the cloud through Kubernetes and Docker and SQL Azure as Database. Key Words Microservices, containers, Azure, Kubernetes, Docker,.Net Core, Data Warehouse. 3 Table of contents 1 Introduction .................................................................................... 18 2 Background ..................................................................................... 21 2.1 Microservices .................................................................................... 21 2.1.1 Microservice architectural pattern .............................................. 21 2.1.1.1 Context ................................................................................... 21 2.1.1.2 Problem .................................................................................. 21 2.1.2 Microservice pattern. Solution .................................................... 21 2.1.2.1 Saga Pattern ........................................................................... 21 2.1.2.2 Choreography-based coordination using events ...................... 22 2.1.2.3 Create Order Saga orchestrator .............................................. 22 2.1.3 Advantages ................................................................................ 23 2.1.3.1 Continuous delivery and deployment ...................................... 23 2.1.3.2 Moderately small ..................................................................... 23 2.1.3.3 Improved fault isolation .......................................................... 23 2.1.3.4 Eliminates any long-term commitment to a technology stack .. 24 2.1.4 Issues ........................................................................................ 24 2.1.4.1 Use of microservice architecture ............................................. 24 2.1.4.2 Decompose the application into services ................................. 24 2.1.4.3 Maintain data consistency ...................................................... 24 2.1.5 Drawbacks of the Microservice pattern ....................................... 24 2.2 Azure ................................................................................................ 25 2.2.1 Context ...................................................................................... 25 2.2.1.1 Definition ................................................................................ 25 Disadvantages ..................................................................................... 25 of Azure ............................................................................................... 25 2.2.2 Application hosting .................................................................... 25 2.2.3 Types of Azure Clouds ................................................................ 26 2.3 Azure SQL Database ......................................................................... 27 2.3.1 Definition ................................................................................... 27 2.3.2 Features ..................................................................................... 27 2.3.2.1 Deployment models................................................................. 27 2.3.2.2 Scalable performance and pools .............................................. 28 2.3.2.3 Extensive monitoring and alerting capabilities ........................ 28 2.3.2.4 Availability capabilities ........................................................... 29 2.3.3 Database Sharding..................................................................... 30 2.3.4 Azure Synapse Analytics (formerly SQL DW) .............................. 31 2.3.5 Power BI .................................................................................... 31 4 2.4 Docker ............................................................................................. 32 2.4.1 Containers and Docker .............................................................. 32 2.4.2 Virtual machines vs Docker containers ...................................... 32 Virtual Machines ................................................................................. 32 2.4.3 Registries, images, and Docker containers ................................. 33 2.4.4 Microsoft Frameworks for Docker Containers ............................. 33 2.4.5 Design containers with different architectures ........................... 34 2.4.6 Docker file .................................................................................. 35 2.5 Kubernetes ....................................................................................... 37 2.5.1 Context ...................................................................................... 37 2.5.1.1 Definition ................................................................................ 37 2.5.1.2 Background ............................................................................ 37 2.5.2 YAML Structure ........................................................................