25
First Steps on the research of Web Hosting
One of the more daunting thing of developing, is to get to know how to deploy, as it's almost guaranteed that you will incur in some kind of cost, so before doing the big jump to trying a VPS (as a service), I decided to make a local Virtual Server to do some testing in setting up server environments.
Well, to give a little explanation of what I was doing, I need to explain how to web works.
Now and then I have been mentioning about Front-end and Back-end, in some way, you can rename both to Client-Side and Server-Side. The Client is often you, the end-user, whoever visits the web app or webpage, technically the client-side code is executed by the browser and do whatever needs to be done. Typically, it means to fetch, display, and update data.
Think of Facebook, for example, the posts, user info, comments, pages are the data, clients can see it, interact with it, update the info, and all kind of different tasks. This data is stored in wherever Facebook servers are, The Servers are a crucial part in web apps development, as it allows the client to not receive all the data on start, brings authentication and security in place, and allows for interaction between users in an efficient and secure way.
Personally, I have seen a lot the analogy of a restaurant, The customers are clients, that in a way, do something with the resources of the restaurant, but they have to be manipulated (in a no-negative way) before they are consumed by the end users. Ingredients could be understood as the raw data, either from a database, public API, or collected on the go, while these are cooked (prepared) by the chefs (the server), then the waiters deliver whatever gets out of the kitchen to the customers (the client).
Obviously, I think this is a great oversimplification for a lot of parts, but you get the idea. Whenever I develop something, I usually feel pretty comfortable setting my local development environment, one port of my laptop to get the server code running, connecting to a local database on another port, and a client server on another (usually liveserver or webpack). But, I started asking the questions, when I get to deploy full web apps, how I should go around hosting?, so far in my journey, I only needed to host static (front end) sites, so I got to get away with netlify, github pages, etc, with only one exception, a Wordpress page I needed to get done, however, to this day, I don't know where is hosted, so I don't worry too much about it.
There are quite a lot options you can go around with hosting, which, If I am completely honest, it gets really overwhelming. In a simple way, your application NEEDS to be running in a computer somewhere in the internet, so hosting is mostly about deciding how and where your application will live.
You could use a Shared Hosting, which basically means that there are a bunch of applications living within the same computer, the number can't be determined as it varies with the amount of resources that the host has, there are clearly downsides of this, such as the CPU and memory never being guaranteed for you, and lack of configuration options, since the machine HAS to support multiple apps. On upsides, it can get REALLY cheap.
You could instead prefer a Virtual Machine, which basically is an emulator of another computer within a Host machine (a real computer), this reduces a lot of the downsides of shared hosting, as you basically rent a computer with dedicated resources, ability to configure it however you like. HOWEVER, it has downsides too, as it becomes a little pricier (and can get expensive pretty fast), and the most daunting part, unless you are willing to pay extra for someone to setup, maintain, secure and deploy, you will have to do it yourself, and if you haven't touched a Linux OS (while technically Windows CLI works too, it's not a popular choice), it gets pretty weird.
Another option would be to rent a physical server for yourself, but to be honest, unless I find myself working in a very big company, I don't see me setting something like that anytime soon (although, a dream of mine is to set my own server in my house), it has expanded benefits over virtual machines, but it also gets VERY expensive, which I find understandable, but I have no way/interest of exploring it further to say much else.
Sure, I am getting over some other options, like Heroku and other PaaS (Platform as a Service), but, they are quite straightforward to set up and for the most part, you are limited to paying for more things in the setup (like the database, or other services), so they are most likely not the most cost-effective solution.
So, after thinking a while, that If I wanted to give confidence, and not raise expenses of projects just in ¿irresponsible? hosting, I decided that I wanted to learn how to setup a VPS (virtual private server), however, to be really honest, I am generally scared of things that could incur in a cost, which it gets worse with the generally non-transparent pricing on cloud services (like Amazon Web Services, for example), so I searched for an alternative to ¿locally test? a production server environment.
Just like that, along with getting to know and develop some projects, I added a tiny bit of DevOps to my to-learn list. This week has been pretty fun learning to set up Node Apps on Ubuntu-Server plus Nginx, I still have a lot to learn (like Docker, Vagrant and other tools), but, I think I will get there, pretty sure that it's not going to be soon, but someday I'll be able to be more confident on it.
To be honest, I wanted to write a little about the setup process, but this post has already become too long to my taste. So, If you want to keep up, you should definitely follow me here, or on twitter or visit my site: fangoh.dev
25