## 4 Proposed Migration Approach and Its Evaluation
### Migration Approach
#### 4.1.3 Microservice Development  
The main goals of step three are to set up the multi-model database and encapsulate it into the microservice. This allows us to implement the database as a service pattern, where a database is a microservice itself. The first sub-step is to install a multi-model polyglot database and set up technical peculiarities such as creating cluster, users, firewall rules, etc. The database setup can be different in many aspects such as the operating system, virtual machine or Docker, cluster or single instance, cluster type, etc. The decision on how to install and set up a database has to be determined based on the application of non-functional requirements, the capabilities of the existing company infrastructure, database capabilities, availability requirements, security requirements, scalability requirements, etc. During the next sub-step, the physical design of the data model created in the second step has to be implemented into the installed database. All models and data structures defined in step 2 have to be implemented and ready to be used. This sub-step could be skipped if the database supports a code-first approach where models and data structures are defined in an application. The purpose of the third sub-step is to create a microservice skeleton that has to be able to be deployed and run as a Docker container. At this stage, a microservice should only contain the code and settings needed to run it as a Docker container in the company's infrastructure. An infrastructure has to be created to run a Docker container, for example, it could be an OpenShift project in a private cloud. The number of active containers and scalability settings have to be determined based on the non-functional requirements, the capabilities of the existing company infrastructure, database capabilities, availability requirements, security requirements, scalability requirements, etc. A continuous integration and continuous deployment (CI/CS) pipeline has to be set up in order to automate build, test, and deploy activities and ensure security that only the entitled person can deploy a new version of the microservice. Microservice capabilities to log have to be ensured. A good practice for a microservice architecture is to use centralized logging solutions. An example of a good logging solution could be ELK Stack. The repository layer has to be built in order to provide microservice accessibility to the database in sub-step four. All actions needed to establish a connection between a database and a microservice have to be executed first, for example, firewall rules, service account access rights, connection string, etc. The next step is the implementation of a repository layer. The code able to communicate with a database and manipulate its data has to be written. For each data model defined in step 2 and implemented in the database, a repository has to be created and support four main operations: create, read, update, and delete. During sub-step five, the REST API has to be built and exposed with all of the necessary methods to support the interfaces for all identified functional requirements. For example, if the functional requirements consist of _creating customer_, _viewing customer_, _updating customer_, _deleting customer_. All four methods have to be created in the customer's controller. The  
Figure 3: The data model development. authentication and authorization functionality have to be implemented in order to fulfil the security requirements and manage the accessibility to different methods. The aim of the last sub-step is to implement the business logic layer, which has to connect the REST API layer and the repositories layer. Because the REST API layer operates with business domain data models and the repository layer operates with database specific data models, they cannot work directly. The business logic layer works as an intermediate layer that contains all of the logic needed to implement all of the functional requirements identified in step one and connects the REST API and repository layers.