Docker Swarm with central apps and distributed regional databases

This is a subtopic of the post Frappe Docker Single Server or Docker Swarm or Kubernetes? Need Expert guidance
All Cloud experts, below will be the most common use case. Need your expert advice on how to set this up using docker swarm and frappe docker

Requirement:

  • Need to have single admin ui(here it is portainer) to manage all our stacks.
  • For Data Security and compliance(Like GDPR), Databases should be served from their respective region.
  • Frappe Apps(Custom Images in our case) in a stack can have multiple sites - this is based on the industry of the customer or app requirement
  • Both Database and Apps should be scalable independently

Design consideration

  • It is possible a custom container can be deployed to multiple stacks and each stack can have their own database

Please advice on how to achieve the below setup in docker swarm, portainer, traefik and frappe docker.

The diagram is achievable.

  • Create a manager node with traefik and portainer which also acts as loadbalaner and admin ui.
  • Create Worker Nodes for frappe apps stack placement, use node labels and placement constraints in stack.
  • The “configure” stack or task will set db_host as DBaaS endpoint, if needed set rds_db to 1 (to use reduces privileges on database) check: Using Frappe with Amazon RDS (or any other DBaaS) · frappe/frappe Wiki · GitHub

For horizontal scale.

Thanks @revant_one .
Let me try with your suggestions.
Except for the below step all other steps are new to me :slight_smile:

Create a manager node with traefik and portainer which also acts as loadbalaner and admin ui.

As per the above diagram I must create three different mariadb stacks pointing to different hosts(db_host).
ERPNext stacks will now use the respective mariadb-network created in the above step

Is my understanding right?

no need for mariadb stack if you’re using managed database.

Understood. Below are my further

DBaaS are way too expensive when compared to VMs of same configuration
Keeping DB outside the docker swarm will put additional ops effort and UI for maintenance, provisioning and analysing the logs

Changed the architecture a bit. Please share your thoughts

  • One Primary VM for Docker Swarm Init and Portainer
docker swarm init --advertise-addr=X.X.X.X
  • Provision Regional VM and join the Swarm

  • Prepare regional Shared/Private MariaDB stacks from portainer and deploy - I have no idea on this on how to achieve. I think i have to play around with your below comment

  • Create Worker Nodes for frappe apps stack placement, use node labels and placement constraints in stack.
  • Prepare ERPNext stacks and connect to respective mariadb network.

things to consider

  • volumes will remain on node where they’re created
  • traefik certificates and portainer data is stored on manager, because both stacks are created on manager node
  • if you start Mariadb on one worker, it has to be labelled and scheduled on same worker.
  • same applies to sites volume
1 Like