← All bricks

Docker · Intermediate

Docker Compose Production-like Stack

Assemble a realistic local environment — Postgres, Redis, RabbitMQ and an app — with health checks, dependency ordering and env config, one service at a time.

Real systems are never one process. Here we build a production-like local stack with docker-compose — Postgres, Redis, RabbitMQ and an app — adding one service or one piece of wiring per step. The focus is the unglamorous glue that makes a stack reliable: health checks, dependency ordering that waits for readiness, centralized config and restart policy. By the end one command brings the whole environment up in the right order.

What you'll build

  • Compose Postgres, Redis, RabbitMQ and an app together
  • Add health checks so readiness is observable
  • Order startup with dependency conditions
  • Centralize configuration in an env file
  • Make services restart on failure

Contents

  1. What we're assembling
  2. The database
  3. Is Postgres actually ready?
  4. The cache
  5. The message broker
  6. Pull config out into a file
  7. Use the config
  8. The app
  9. Start in the right order
  10. Recover from a crash
  11. A readiness gate for scripts
  12. Bring the stack up