Nowadays the web development landscape is so large and complex, it’s impossible to expect new developers to know the full scope of web development from end to end.
That’s in part why we have differentiated roles now, such as Backend, Frontend and DevOps or IT. But at some point, even with modern stacks and managed services, I think it’s worth for all developers to know a little bit more about the stack, and deploy a web app to a server “from scratch”.
A Blank Canvas
I think every senior web developer should know, at some point, how a vanilla UNIX server works. Not so much because it will be your main way of deploying apps, maybe it will, maybe it won’t, but because of the great amount of knowledge you’ll gain along the way.
You’ll learn things such as:
- How to SSH into a remote UNIX instance
- Basic UNIX commands (
cd,ls,grep, etc) - Basic UNIX concepts, such as users, permissions, directories (where to look for logs or configuration files)
- Reverse Proxying through Nginx or Apache
- Why SSL is needed and how to configure it
- Firewalls, what ports are and how to expose them
- Services (a.k.a Daemons)
- Cronjobs
- Etc
It might not seem that relevant for new devs. It’s a common trend on social media that when I see new developers talking about servers they only talk about the managed services or frameworks they use. But they have no idea of what’s going on underneath.
As such, if something breaks, or they have to migrate, they have no idea how to even start. Knowing the fundamental concepts will allow you to better understand your code, and how it interacts with the outside world. Which will make you a better developer.
The Barebones Setup
Web apps can be complex and require coordination between different servers, for example, your web server could be in a different server than your database, maybe you also need a caching server, and maybe you have multiple web servers, all managed by a load balancer.
In this post I’d like to share the absolute basics a web developer can try and do by themselves, to get web app up and running in a single server, the simplest possible way.
It won’t be a step-by-step tutorial, you can find those on DigitalOcean docs or just googling around. But in my experience, these are the absolute basics you’ll need for a simple deployment:
- A Virtual Private Server (VPS) running Linux. You can play around with local Virtual Machines if you don’t want to spend money on a real server.
- Your app, in any language, together with the runtime needed for your app. For example, if it’s a Node.js app, you’ll need to install Node on your server
- A reverse proxy. Depending on your app you might have a more robust web server that can handle traffic directly, but the standard solution is to have Nginx or Apache redirect traffic to your app
- A service for your app. So your app will try to restart itself if it fails and start automatically when the server is restarted
- A database. For simplicity it can just be in the same server. Of course, if your app doesn’t actually need a database then you can skip this step.
- A deploy script. A script that lives in your app that will do a deployment.