Developing with microservices for a full stack eCommerce solution
The Problem – or Why Not a Classic Architecture
Developing an entire application from scratch may look a lot less painful around a monolithic architecture. In fact, this is a recommended approach for lightweight applications for many reasons:
- The development environment is easier to setup
- Testing is straightforward – there is no need for integration tests
- Deployment & monitoring procedure is reduced to one main service
But what happens when the application evolves into a large, complex project? Such as when building a full-scale eCommerce application? In most cases, adopting a new framework is almost impossible. When that happens, the entire application needs to be rewritten and it cannot be easily parallelized. Also, there is a major risk that some components of the application might create a bottleneck, affecting the final product.
The solution is to scale the application by scaling only for a few complex parts.
The Solution: Microservices
The ambitious project of a full stack eCommerce solution for Carrefour, one of the largest retailers in Europe, determined us to come with a reliable, scalable and decoupled solution. The process of automatically managing hundreds of orders per day implies high availability, redundancy and fault tolerance. The particular nature of the business model and the technical requirements drove us to build this solution around a microservices based architecture.
The Development Advantages of Microservices for eCommerce
This microservices architecture chosen for this project generated several undeniable, positive results:
- A final list of over 20 services that are independently running and capable of self-monitoring
- Each microservice could be developed with any technology (PHP, Java, NodeJS, just to name a few), as long as it would expose a common REStful interface
- The development process was parallelized – dedicated teams were allocated for separate services
- The possibility of scaling CPU intensive services in a production environment, in our front-end services, helped us to make a good use of the servers resources.
The containerization technology we used was based on Docker alongside Rancher as a container manager and orchestration tool. Docker proved to be a reliable solution due to it’s lightweight structure and its cacheable file system layers. By sharing the same OS kernel, Docker securely isolates processes between containers. Therefore the testing process through a continuous integration system is done in a production like environment.
Above this container-based structure, we used Rancher as layer of container abstractisation and an orchestration tool. Balancing containers between separate physical machines and the support for scalability and health monitoring are just some of the tasks that Rancher proved to be able to complete seamlessly.
Given the scale and complexity of the eCommerce project, separating services into different repositories was the best way to approach this architecture. This way were able to fully track Git commits and trigger build plans accordingly. As part of this approach, each service must contain a Docker recipe file so that the developers and the CI platform can easily build containers remotely. There is no more room for “works on my machine” excuse, as the Docker containers run in the same context everywhere at anytime.
The Testing Process
The continuous integration platform, Bamboo in our case, triggered a build plan every time a new commit was pushed by the developers. At that point, an image with the latest changes was built and the tests ran directly on a Docker container. When everything worked right, the Docker image was versioned and pushed into a central repository.
The Deployment Process
In order to reduce the downtime period to a minimum (just a few seconds), a blue-green deployment procedure was used. That meant creating a completely new stack of updated services in Rancher and after that manually checking if everything was alright. Afterwards, the gateway was switched to point to the new stack and the old one is deleted.
Tremend has been a trusted technical partner for Carrefour, working on Carrefour’s eCommerce solutions, In-store Agents Automation System and Warehouse solutions.
Tremend delivers full solutions ranging from mobile applications, online stores or complex banking software to embedded software for the automotive sector. For over 11 years we have developed Internet of Things solutions, e-commerce platforms, enterprise solutions, embedded software, CRM, CMS, ERP integration and custom software. Over two million users benefit from solutions developed by our team of software engineers.
Contact us at firstname.lastname@example.org for support in developing your own software projects.