Skip to main content
  1. Posts/

Best practices for microservices

·181 words·1 min·0 views
Table of Contents

Best practices #

There are 12 practices that can be considered as the best

  • Use one codebase with strong revision control
  • Explicitly declared dependencies (libraries), using package managers like pip.
  • The enviroment should be stored in a config file
  • Have resilient backing services, attached to each service and should be easily swapable.
  • Deployment should be separated in build, release and run stages. Where build is creating the deployment package, putting the configuration in a runtime enviroment and executing the app.
  • The app should be executed as one or more stateless processes
  • Each service is binded to a specific port
  • Since services run independently, they run in separated processes, which scale easily by adding new instances for the process.
  • Apps should be written in a robust and reliable way with fast startup, because they need to deploy and scale quickly.
  • The development enviroment should be paired to keep the stages similar, using docker is useful
  • We should treat logs as event streams
  • Admin tasks should be run as a repeatable and automated on-off process but shouldn’t be a part of the app