Member-only story

12 factor best practice

Nik Stehr
3 min readApr 26, 2021

--

Follow 12 factor and you can’t go wrong when rolling out your microservices, here are some practical tips on how to engineer them for real (a more in depth look can be found 12 Factor Apps in Practice).

Codebase

  • Use feature branches to support different versions of an app in the same repo
  • Refactor out shared code into a new repo and reference it in original repo as a library dependency using a dependency management framework
  • Application topology (deployments, config etc) can be version controlled to avoid environment creep

Dependencies

  • Use a dependency management framework like maven to explicitly declare dependencies
  • Use Docker containers to add any runtime application dependencies not included during build step (e.g. ‘provided’ scoped dependencies).
  • Container images are fully self-contained deployment units, they make no assumptions about the underlying hosts the containers will run on — use them to ensure all required types of dependency are available at runtime, including system libraries like the Java runtime (JDK)
  • An orchestration framework like Kubernetes lets you define runtime dependencies to other services (containers). For example, if service A is dependent on service B, this can be defined in config and Kubernetes will ensure the services are spun up and connected to each other as necessary (the assumption here is you’re responsible for the…

--

--

Nik Stehr
Nik Stehr

Written by Nik Stehr

A software engineer who works hard to create simple solutions.

No responses yet

Write a response