2 ms·
You're making it way too complicated. You only need one flask app. Here's how you do it: 1) Build the app so it's able to generically handle any request by par
by chatmasta 12y ago
You're making it way too complicated. You only need one flask app. Here's how you do it:
1) Build the app so it's able to generically handle any request by parsing the subdomain from the URL (google "flask multiple subdomains" for plenty of solutions to this)
2) Install the app on one droplet at first, and more as you need to scale.
3) Create a wildcard A record in the site.com DNS (* .site.com), with round robin load balancing between the IP of each of your droplets. e.g. If you have one droplet at 1.1.1.1, one at 2.2.2.2, set "* .site.com" to round robin [1.1.1.1, 2.2.2.2].
This should take care of your scaling for a while. You're severely overestimating how rapidly you will need to scale. Start with one small droplet, add to its resources when your traffic grows, and then once it's maxed out, go to the DNS round robin method.
Further down the line, you can replace those app servers with something like HAProxy to load balance between them, or do more fine grained load balancing than DNS round robin.