Enhancing Efficiency and Security: Streamlining Cloud Deployment with Docker Containers

One of our esteemed clients approached us with the need to align their current project with best practices. Their setup involved four cloud instances, each designated for different components:

  1. Nginx – as a very efficient web server;
  2. FormBuilder – a custom Node.js solution to create and process forms;
  3. JSReport – an external service used for PDF creation;
  4. MongoDB – running a database for FormBuilder.

Initially, the client had opted for this spread-out structure to isolate each component and ensure security while operating personal client’s data. However, it proved to be cost-inefficient. That’s where our expertise came into play.
Using Docker containers, it’s possible to achieve the same isolation but reducing costs significantly. By leveraging a custom docker-compose setup, Profi.Dev team efficiently managed to run all components within a single cloud instance.
As data being processed has been very important and sensitive to lose, during the implementation of this solution there were decisions to create an additional MongoDB instance that would act as a secondary database replica, placed in a separate data center.

One of the weak places of the replica is that if you drop the database on the primary instance – it will be dropped also on the replica. Therefore, to have a bullet-proof solution in terms of data resistance, as an additional level, we’ve added daily backups. With this approach, even if the database will be destroyed by a mistake (which should not happen, but just in case) – there would be backups that could be easily restored.

For better maintainability, the docker-compose setup has been made based on profiles, so a single configuration file can be applied to primary and secondary setups.

This approach not only optimized costs but also made the system more maintainable and future-ready for creating staging or development environments if needed. Additionally, the resulting setup allows seamless integration with auto CI/CD pipelines in the future, ensuring smooth and efficient development workflows.

The task was both small and interesting, requiring custom configuration and fine-tuning, which we successfully executed. Our client is now more cost-efficient, without compromising on security or scalability, and equipped with the tools for future advancements.