楚阿旗

博客园 首页 新随笔 联系 订阅 管理

Modern software development

  • Delivery as a service 
  • Centrally hosted and accessed through the internet
  • Web apps, software-as-a-service
  • Twelve-factor app methodology is suited for web apps

Code -> Deploy -> Operate

 

Factor 1: Codebase: Code factor

Track in a version control system(VCS)

  • Maintain one-to-one relationship between codebase and app
  • Deploy multiple instances of the app
  • Develop differnetversions of the codebase in each deploy

Factor 2: Dependencies:Code factor.

  • Assume an app is only as reliable as its least reliable dependency
  • Explicitly declare any dependencies

Factor 3: Config: Deploy factors

  • Keep everythng that varies between deploys such as credentials and backend service locations in config
  • Keep separate from the code
  • Store config in environment variables

Factor 4: Backend services: Deploy factor.

  • Do not distinguish between local and third-part services
  • Access all services by a URL and credentials so that they can be swapped without changing the code

Factor 5: Build, release , run: Code factor

  • Build: Transform a code base into an executable unit called a build
  • Release: Combine build with configuration so that it;s ready for execution
  • Run: Run the application

Factor 6: Processes: Deploy factor.

  • Should be stateless and share nothing
  • Do not share memory and filesystmes so persistent data stored in backend service
  • Store data centally

Factor 7: Port binding:Deploy factor.

  • Export services by port binding.
  • Export HTTP and other services.
  • Declare a web server library dependency
  • Become backend services for other apps

Factor 8: Concurrency: Operate factors.

  • Scale an application
  • Stateless processes can be spun up without createing dependencies on other processes

Factor 9: Disposability: Operate factors.

  • Require minimal process start time and graceful termination
  • Quickly deply code or config changes
  • Easily scale apps

Factor 10: Dev/prod parity: Code factor.

  • Minimize differences between development and production environments
  • Use same backend services across environments

Factor 11: Logs: Operate factors.

  • App should not concern itself with storing logs
  • Threat logs as an event stream
  • Execution environment captures, aggregates, and routes logs to their destination

Factor 12: Admin processes

  • Enable one-off app management processes
  • Run against a release, using same codebase and config
  • Part of application code
posted on 2024-04-03 18:00  楚阿旗  阅读(26)  评论(0)    收藏  举报