Environment Separation Theory
Dev (e.g. local)
What is it
- It can be a piece of an environment (e.g., 1 or more services) with some dependencies.
- Should be disposable and very easy to setup.
Why it's needed
- Dev environments are needed to ensure the fastest feedback loop possible.
- We usually cannot run an entire environment on a single machine.
Staging
What is it
- Staging is ideally a production mirror, with the only difference being a small handful of configuration details.
Why it's needed
- Needed when high availability of the production service is required. It gives not just our code but our configurations (excluding the small amount of configs that determine which environment is which) a test-drive so we do not accidentally bring down production when introducing changes.
- Internal tooling that is stateful as rolling back to a previous version may not be possible.
When is it not needed
- If the service is internal tooling (i.e. not customer facing) and high availability down to the hour or minute is not a big deal, then it is excessive to put that service or tooling in the staging environment because a duplicate version of that tool now need to be maintained for each environment where it exists. A good example of such tooling is a CICD pipeline. The CICD pipeline is an internal tool so if it stops working due to an experimental change, that change can be rolled back when desired to unblock anyone that needs to use the pipeline.
Production
- Needed to deliver customer-facing services to the consumer.