How do I decouple CTFd architecture

I have read various documentations but I cannot be sure as I can’t bring up the environment yet. I have experience previously in deploying CTFd using Docker container which means it is self-contained and everything resides in a VM.

However I want to increase redundancy which means in the event a container goes down the data will not be lost. Hence I want to decouple the database and run it separately from the application layer. It will also help with scaling if I deploy 2 VMs for the application and use a load balancer, and these 2 VMs will be referencing the same database. From my research is it correct that I modify the config.py file and docker build the CTFd directory? Thanks