If you are curious as to what a server environment is, then you are probably already familiar with what a server is. However, for those who are reading this because you're just my fan and you like reading my blogs (obviously so many of you...hopefully), then we'll need to understand the foundation for a server environment, which is a server itself.
What is a Server?
At its core, a server is simply hardware or software that provides a service to another program. The program that is providing the service itself is called the server. The program that receives the service is called the client.
Right now, you're probably thinking of a server warehouse, dim rooms filled from top to bottom with computer hardware. The hardware that you see, is an example of a physical server, or a computer that is used to run server software. There can also be a virtual server, which performs the same role as a physical server, but doesn't necessarily have to be a discrete physical unit. For example, you might have one physical hardware server that runs multiple virtual servers on it.
To give a real-world example, let's imagine you have an e-commerce website where you sell your handmade products. You have a modest but loyal customer base. You might purchase something called shared hosting with a site like Shopify. As the store manager, you don't need to see what happens in terms of the physical hardware that Shopify is using to host your shop, you just need it to run and be available to your customers. Behind the scenes, Shopify likely installs your site on one of its many physical servers around the world. But it would be extremely cost-ineffective to use an entire server for your relatively lower-traffic shop. So, Shopify installs your shop on a virtual server on their physical servers, one of many virtual servers on a single physical piece of hardware, allowing multiple other sites to exist in parallel without impacting the other tenants.
The above example is just one type of server that provides shared web hosting. Read more in-depth on servers here, and hosting here.
What are Environments?
An environment is the unique set of variables, conditions, and paths within an operating system that an application runs in. Environments are quite broad terms and can vary greatly for different applications, but at a basic level they provide context to the application so it can properly run.
If this sounds complicated here's an analogy. You're having guests over for breakfast, lunch, and dinner. For each meal, there will be a drink, the main course, and sometimes dessert. During breakfast, you might serve your guests orange juice or coffee for the drink, pancakes with bacon & eggs for the main course, and no dessert. At lunch, you might offer an afternoon tea or a carbonated beverage for the drink, a ham sandwich for the main course, and maybe a cookie for dessert. During dinner, you might serve wine for the drink, a steak for the main course, and an ice cream sundae for dessert.
The meal at your house is the "application," and the time of day is the "context." Why do you know not to serve wine at breakfast, or pancakes at dinner? That's because you have context of what you should serve at each meal, even though you're eating all three meals at the same dining table. The type of meal and time of day are the "environment" that provide you with context to know what to serve to your guests. So even though it's one single application (meal at your house), the environment (type of meal and time of day) provides you with the context (what drink, food, and dessert should you serve?) to present the appropriate version of your application.
There are many different types of environments out there. In software projects, you'll commonly hear about Development, Staging, and Production Environments.
A development (dev) environment is a bit atypical when it comes to server environments, since it oftentimes doesn't use a server. A development environment is local to your own computer, meaning only the client side is represented.
A dev environment is used as a programmer's rough draft space, their own personal workspace. If you lose your computer, then you lose your work, as anything you do is local to only your computer.
When you are messing around, or are still working through some problems and just need a clean space to start working, then the dev environment is a great spot to look. Development environments have the benefit of not having to depend on an external server, making it easier to track down issues and eliminate confounding variables. If you want others to see what you're up to, then you'll need an environment that involves the server side too.
A staging environment is a form of server environment. In software, people tend to use the term staging to reflect a testing ground. You can think of this as your final rough draft, ready for a peer review, or a Google doc shared between multiple contributors. So, if you want people to see your work from their own computer, or need to collaborate with others, then you will probably use a staging environment.
Staging server environments are a critical part of the development experience. It is important that developers have a chance to work together and test their code before going live.
And you've made it, you're ready for the light to turn green. Another form of server environment, a production environment runs the live, user-accessible application. Production servers are commonly much larger than staging servers, but at the end of the day, the serve the same function in facilitating communication between a client (a user's computer) and a server (wherever you're hosting).
If you still have any questions about environments, shoot us a note! [email protected] 🙂