Question

Help hosting multiple containerized applications on low-cost infrastructure.

Posted November 14, 2018 735 views
Nginx CentOS PHP WordPress Docker Load Balancing Kubernetes Ubuntu 18.04

Hey friends,

I’m running into an infrastructure problem, and I though you might have some fun ideas for it.

Context

Recently, I started a consulting agency which specializes in digital presence. We offer web development services for WordPress and Ghost.

Because this business took off faster than expected, I failed to do what any reasonable system architect would have done by implementing reliable and scalable infrastructure.

The current deployment workflow is as follows:

  1. Use a LEMP or Ghost one-click app to deploy a droplet for the client.
  2. Configure NGINX.
  3. Develop the website.
  4. Optimize and Secure NGINX & PHP.
  5. Configure the DNS on the clients domain to point to the droplet.

This is an awful solution for many reasons, the most important of those being:

  • There is no High Availability or Resiliency built in.
  • It scales poorly.
  • Consumes too much time.
  • Way more expensive than it needs to be.

How can the infrastructure be designed in a way that solves the problems listed above?

I’ll start by suggesting that there doesn’t need to be a separate MySQL database for each client. The database infrastructure can be separated and load-balanced to serve all of the clients.

I would also suggest that NGINX, PHP-FPM, and Wordpress/Ghost could be containerized so that instead of deploying a new droplet for each client, a new container is launched on a much larger droplet.

I’m interested in seeing what practical and fun ideas you come up with to solve these problems!

Cheers,
Curtis

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

1 answer

Hello,

That is a great question!

What I would do personally in this case is:

  • Have 1 dedicated Droplet for my databases, or even better get a Managed MySQL cluster, then I would have my website connection strings set to that 1 cluster, that way I would separate the web server and the database server
  • I would Dockerize my applications and I would host the smaller ones on one Droplet, actually I recently posted an answer on how to do host multiple Docker containers on one Droplet with Nginx reverse proxy:

https://www.digitalocean.com/community/questions/how-to-host-multiple-docker-containers-on-a-single-droplet-with-nginx-reverse-proxy

  • Any websites that require more resources I would migrate to separate Droplets so that they don’t affect the other small sites

Regards,
Bobby

Submit an Answer