Report this

What is the reason for this report?

Setting up server to be scalable

Posted on June 14, 2014

Hi, im setting up a website that will initially start out small but parts of it will need upgrading sooner then others. For example my forums will most likely remain small, my shop will hopefully grow to be a decent site and my video sharing section will prob be medium sized.

My thoughts were to set it up with the following $5 droplets and upgrade them as they become to small.

  1. db server droplet
  2. shop
  3. video
  4. forums/main portal

I would also like an email server on there somewhere.

I was hoping to have this set up so that it will all be www.example.com, www.example.com/forums /videos /store so i can use 1 ssl cert for them all.

My main question is, is this overkill? would i be better off putting 1,2,4 on the 1 droplet and the videos on another? And on a technical points would i just use a .htaccess redirect on 4 to have the others as subfolders? Would the ssl cert work over multiple servers like this?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

That sounds like a reasonable set up. You could probably condense things a bit it you wanted to. If you go that route, I’d argue for keeping the database server on a separate droplet. Check out this article for a good starting off point on thinking about different setups:

https://www.digitalocean.com/community/tutorials/5-common-server-setups-for-your-web-application

SSL certificates are bound to a hostname, not the server. So it’s fine to use one on multiple servers. As for using .htaccess redirects, I’m personally a fan of subdomains for this sort of thing, eg: store.example.com and videos.example.com Than you can just use ServerName directives in your VirtualHosts.

Hey,

A quick update to this thread in case anyone comes across this in the future.

It’s always a good idea to plan ahead for scalability. The approach of starting with smaller Droplets and upgrading as needed is a good strategy. Here are a few more suggestions:

Suggested Setup:

  1. DB Server Droplet:
    • Host your database on a separate droplet to ensure data integrity and easier management.
    • Consider using a managed database cluster from DigitalOcean for automatic backups, scaling, and maintenance:

https://www.digitalocean.com/products/managed-databases-mysql

  1. Shop, Video, Forums/Main Portal:
    • Initially, you can host all these services on a single Droplet and then scale out as traffic increases.
    • Alternatively, you can separate the shop and video services early on if you anticipate significant growth.
    • You could consider using the DigitalOcean Spaces S3 storage as well:

https://www.digitalocean.com/products/spaces

  1. Email Server:
    • Setting up and managing an email server can be complex. Consider using a third-party email service (like SendGrid, Mailgun, or DigitalOcean’s managed email service) for reliability and ease of use.

Using DigitalOcean App Platform:

Consider using the DigitalOcean App Platform, which offers auto-scaling, managed services, and easier deployments. The App Platform platform can handle scaling for you and ensure that your applications are resilient and you will not have to do any server maintenance

Domain and SSL:

To have everything under www.example.com with subdirectories (/forums, /videos, /store):

  1. Single SSL Certificate:

    • You can use a single SSL certificate for all subdomains and subdirectories, which simplifies management.
  2. Using DigitalOcean App Platform:

    • The DigitalOcean App Platform simplifies the process of setting up your domain and managing SSL certificates. It provides built-in support for custom domains and automatic SSL management.
    • With the App Platform, you can easily configure routing to different components of your application (e.g., forums, videos, store) under one domain with different backend services:

https://docs.digitalocean.com/products/app-platform/how-to/manage-components/

  1. Reverse Proxy Setup:

    • If you prefer to manage it yourself, set up a reverse proxy using Nginx or Apache on your main portal Droplet. The reverse proxy can direct traffic to the appropriate service (e.g., forums, videos, store).
    • Example Nginx configuration for reverse proxy:
      server {
          listen 80;
          server_name www.example.com;
      
          location /forums {
              proxy_pass http://forums_backend;
          }
      
          location /videos {
              proxy_pass http://videos_backend;
          }
      
          location /store {
              proxy_pass http://store_backend;
          }
      
          # Other configurations...
      }
      
  2. SSL Termination:

    • SSL can be terminated at the reverse proxy, and the proxy can handle secure communication with backend servers.
    • Use Let’s Encrypt for free SSL certificates, and tools like Certbot to automate the renewal process:

https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-20-04

Scalability and Load Balancing:

  • As your services grow, consider load balancing and horizontal scaling (adding more droplets) for each service.
  • Use DigitalOcean Load Balancers to distribute traffic and enhance availability.

Your initial setup of using $5 Droplets is a good start. As you scale, separating services onto different Droplets or using managed services will provide better performance and reliability. Using the DigitalOcean App Platform can further simplify scaling and management.

- Bobby

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.