At the early stages of a tech startup, the amount of DevOps work required is very limited. This makes it unfeasible to get an expert to handle your server and application setup.
A more likely scenario is that you, as tech lead, will need to handle this yourself.
Here’s the strategy I’ve used for many projects over the years. It’s kept the Mindbeat platform running since 2018 with 100% uptime (it’s easier than you think).
Simple application server setup
- Use managed services so that your only point of failure is your application server.
Since we use AWS – I used Amazon SQS and Amazon RDS as our managed queue and database.
- Use a server management tool in a way that allows you to reproduce your application servers. I use Laravel Forge.
- Use a zero-downtime deployment tool in a way that allows you to deploy your latest release at the click of a button. I use Laravel Envoyer.
- Set up 2 (identical) application servers to host your application. 2 is infinitely better than 1, and slightly worse than 3. Setting up 2 servers from day 1 means you’ll be ready to horizontally scale to any amount of servers.
- Set up load balancing using Cloudflare.
When to use this strategy
- When you’re bootstrapped, and don’t have a DevOps resource
- When your application is monolithic, or is close to that.
- When you can anticipate increased usage and can plan ahead to add more servers to handle the load. (I’ve never had to do this!)
When not to use this strategy
- When your application is spread across many services
- When your application needs to handle huge spikes in traffic
- When your architecture can’t be arranged to only have a single-point of failure that is unmanaged.
- Grant at least one other developer on your team full access to your application servers. You’ll have an amount of team coverage in case you’re ever unreachable and something is breaking.
- Spend some time to ensure that Cloudflare’s load balancing features can gauge the health of you application server.
- Configure Cloudflare to automatically route traffic away from an unhealthy application server.
- Ensure that “Session affinity” is set to “on” in Cloudflare – so that logged in users are routed to the same application server every time.
- Don’t bother upgrading your servers. Provision fresh servers and keep your old servers running until you can do a safe changeover.
This setup has some hard requirements when it comes to using managed services, and requires your application to be monolithic.
In return you get a hassle-free, developer-friendly setup that you can rely on.
I lead the tech team at Mindbeat, follow me on Twitter as I continue to document lessons learned on this journey.