InfrastructureLesson 4 of 47 min

Environments, and why they differ

Local, preview, production: three copies of your app that are never quite identical.

An environment is a complete running copy of your app with its own configuration and, usually, its own data. Most teams run at least three, and understanding what differs between them explains a large fraction of confusing bugs.

  • Local: on your machine, fake data, everything visible, nobody else affected.
  • Preview: a temporary deployment per change, so a proposal can be clicked before it is accepted.
  • Production: real users, real data, real consequences.

The configuration that differs between environments is held in environment variables, values supplied from outside your code. That is why the same build can point at a test database in preview and the real one in production without changing a line.

What to remember

  • An environment is a full copy with its own config and data.
  • Preview deployments make changes reviewable and exercise the deploy path.
  • The dataset is the difference between environments that hurts most.

Terms in this lesson

Field notes

Loaded from a deliberately slow source. The lesson above was already readable while this was still travelling. That is streaming, and it is the same trick a chat interface uses.

The digest that stopped for five weeks

A weekly email job silently stopped running after an infrastructure change. Nobody noticed, because a job that does not run produces no error. It was discovered when a customer asked whether they had been unsubscribed.

Why you alert on missing success

Everyone retried at once

A service had a brief wobble. Every client retried immediately, then again, then again. The retries were far more traffic than the original load, and the service never got a quiet moment to recover. The outage lasted forty minutes longer than the fault did.

The thundering herd

resolved in 900ms · region iad1

Hide field notes toggles a search param the loader reads. With it off, the slow promise is never created, so nothing streams.