CodingBlocks
Episode 36 – The Twelve Factor App: Dev/Prod Parity, Logs, and Admin Processes
Welcome back to the dramatic conclusion of our discussion on the 12 factor app. This time we’re talking dev/prod parity, logs, and admin processes. Oh, and Call of Duty!
Which is the most important to study?
- Design Patterns
- Language features
- Algorithm Complexity
- Unit Testing
News
- Thanks for the reviews! arathustra, lu S, Seb (from London), S Willowood, TheDarkKnight15, FreeAppsHunter
- Where do transforms go? UI or Middleware?
- Joe had surgery!
- Oopsy correction: Macbooks use a variant of Mini PCI Express & mSATA:
We have a winner, Wade is the champion!
Dev/Prod Parity
- Keep development, staging, and production as similar as possible
- 3 kinds of gaps:
- Tools: Sometimes prod uses different
- Time: Sometimes there can be long gaps between deployments
- Personnel: The programmers may not be the people deploying/testing
Importance Rating: Medium
Logs
- Treat logs as event streams
- Nice definition of logging: Logs are the stream of aggregated, time-ordered events collected from the output streams of all running processes and backing services.
- Your app shouldn’t concern itself with routing or storage of its output stream
- Only write to stdout and stderr, let another tool route the logging to where it needs to go, file management doesn’t need to clutter up your app
- Files are inconvenient once you have multiple stateless servers, you’re really going to want something like Splunk or Logstash
- In addition to aggregating your logs, they also have nice alerting, graphing and search capabilities
- How much logging is too much logging?
Importance Rating: Low
Admin processes
- Run admin/management tasks as one-off processes
- Examples: db tasks, arbitrary code,scripts
- Keep tasks with code, don’t let it diverge!
- Interesting: Twelve-factor strongly favors languages which provide a REPL shell out of the box
Importance Rating: High
Resources we like
Tips & Tricks
- Git checkout specific branch: git clone [clone-url] –branch [branch-name] –single-branch
- Use npm to setup your packages for other devs: npm install –save or npm install –save-dev
- SQL Sentry Plan Explorer – thanks Jeff Belina!
- Finding/Replacing text in WebStorm
- Having problems with similar routes in multiple controllers in WebAPI?
Attribute routing to the rescue!
For example:
[Route(“api/customers/getName”)] in CustomerController.cs and [Route(“api/employees/getName”)] in EmployeeController.cs - Don’t forget to add swagger to your WebAPI projects with Swashbuckle!