Dev And Ops
琳琅满目,前程似景!
1. DevOps as Cultural Movement
DevOps is a recognition that Development and Operations needs to stop working alone in their "siloed" towers and start working together. To do this we need:
- A culture of collaboration valuing openness, trust, and transparency
- An application design that does not require entire systems to be redeployed just to add a single function
- Automation that accelerates and improves the consistency of application delivery so that we can develop and deliver software with speed and stability
- A dynamic software-defined, programmable platform to continuously deploy onto
2. Agile Manifesto
我们通过实践并帮助他人开发软件,从而发现更好的软件开发方法。通过这项工作,我们认识到:
-
个人和互动 胜过流程和工具
-
Working software over comprehensive documentation
-
客户协作 胜过合同谈判
-
应对变化 胜过遵守计划
3. Tenets of DevOps
- Social Coding
- Behavior and Test Driven Development
- Working in small batches
- Build Minimum Viable Products for gaining insights
- Failure leads to understanding
4. Waterfall Development
特点
- No provisions for changing requirements
- No idea if it works until the end
- Each step ended when the next begins
- Mistakes found in the later stages are more expensive to fix
问题
- 软件发布之间通常有很长的时间
- 由于所有的团队都是分开工作的,开发团队并不总是知道可能会妨碍项目按预期运行的操作障碍
- 离代码最远、对其了解最少的人正在将其部署到生产中
5. Agile Development
- Requirements and solutions evolve through the collaborative effort of self-organizing and cross-functional teams and their customers
- It advocates adaptive planning, evolutionary development, early delivery, and continual improvement
- It encourages rapid and flexible response to change
6. How DevOps differs from Waterfall ?
- Methodology: Waterfall follows a sequential and linear approach, while DevOps emphasizes collaboration and integration throughout the software development lifecycle.
- Team Structure: Waterfall promotes silos between development and operations teams, while DevOps encourages cross-functional teams for better collaboration.
- Release Cycle: Waterfall often has longer release cycles with major updates, while DevOps focuses on shorter, frequent releases to enable faster time-to-market.
- Automation: Waterfall relies on manual processes, whereas DevOps emphasizes automation to streamline and accelerate development tasks.
- Flexibility and Adaptability: Waterfall is less flexible in handling changing requirements, while DevOps embraces flexibility and iterative improvements.
Social Coding
1. Git Command Workflow
2. Git Feature Branch Workflow
3. Uses for GitHub issues
Use GitHub Issues to track ideas, feedback, tasks, or bugs for work on GitHub.
4. Procedure to handle merge conflicts
Agile Planning
1. The roles Scrum team
- Product Owner
- Development Team
- Scrum Master
2. The 5 Scrum Meetings
3. What is Sprint?
A Sprint is one iteration through the design, code, test, deploy cycle
4. Why use Acceptance Criteria?
Product Owner determines if done based on Acceptance Criteria and those stories are Closed
5. What is an Epic?
Epics are Stories that are so big, they need to be broken up into smaller Stories
6. What are Story Points and Velocity
Velocity:
- The number of Story Points a team can complete in a single Sprint
- This will change over time as the team gets better at estimating and better at executing
- The Velocity is unique to the team because the story point assignment is unique to the team
Story Points:
- Story Points acknowledge the fact that sizing using absolute time-to-complete is highly inaccurate so it uses an estimate of complexity
- It is measurement of a feature’s size relative to other features usually expressed in T-Shirt sized (S, M, L, X) or Fibonacci numbers (1, 2, 3, 5, 8, 13, 21)
- It is measurement of a feature’s size relative to other features usually expressed in T-Shirt sized (S, M, L, X) or Fibonacci numbers (1, 2, 3, 5, 8, 13, 21)
7. Why use Burndown charts?
A burndown chart is a tool used by Agile teams to gather information about work completed on a project and work to be done in a given time period.
RESTful APIs
1. Why use VS Code and Docker for development?
笨办法
Manually creating local environments for developers to work in is:
- Time consuming
- Error prone
- Inconsistent at best
- Unreproducible at worst!
我们的方案
Use Docker as a development environment and to handle middleware without any installation
Use Visual Studio Code to create portable containerized development environments automatically
2. RESTful API Guidelines
3. REST API 中的 HTTP 动词 POST、PUT、GET 和 DELETE 有何用途?
- GET: Requests a representation of the specified resource. Requests using GET should only retrieve data
- POST: Submits an entity to the specified resource, often causing a change in state or side effects on the server
- PUT: Replaces all current representations of the target resource with the request payload
- PATCH: Applies partial modifications to a resource
- DELETE: Deletes the specified resource
4. Idempotence
PUT and DELETE operations are idempotent
Cloud Native and Microservices
1. What makes a good microservice?
- Microservices should have minimal outside dependancies
- Business Domains usually have well established boundaries
- Microservices should be broken up by Business Domains
- With well defined interface
- Limiting dependancies as much as possible
2. How does a microservice differ from a monolith
Monolith: All services combined into one build, written in the same language and application framework.
Microservices: A microservice is a granular, decoupled component within a broader application
3. Attributes of Cloud-Native Computing?
- Applications are designed as a collection of stateless microservices
- State is maintained in separate databases and persistent object stores
- Resilience and horizontal scaling is achieved through deploying multiple instances
- Failing instances are killed and re-spawned, not debugged and patched
- DevOps pipelines help manage continuous delivery of services
4. What is Stateless Service ?
- Server maintains no client state
- Each request contains enough context to process the message
- Any application state must be held on the client side
- Allows easy horizontal scaling of application services
5. Twelve因素应用的配置指南
6. The difference between Vertical and Horizontal Scaling
Vertical Scaling: Get bigger servers
Horizontal Scaling: Add more servers
Test Driven Development
1. Red, Green, Refactor workflow
2. Why Automated Testing is important
- First and foremost it saves time when developing!
- It allows you to run faster because you are more confident
- It insures that your code is working as you expected
- It insures that future changes don’t break your code
- In order to use a DevOps Pipeline, all testing must be automated
3. Why is code coverage an important metric
- Test coverage measures the percentage of lines of code that were executed during all of the tests
- High test coverage gives some confidence that the code that has been written is covered by the test cases
- Test coverage reports can tell us which lines of code were not tested so that we can write more test cases that execute those lines
Continouse Integration (CI) and Continouse Delivery (CD)
CI: 在一组测试通过后,将每个开发者的修改持续集成到主干分支,从而产生可能的可部署代码的过程。
CD: 一系列的实践,旨在确保代码可以快速安全地部署到生产中,将每一个变化交付给类似生产的环境。
- Short feature branches makes merging easy
好处是什么?
- 对变化的反应时间更快
- 减少代码集成风险
- 更高的代码质量
- 版本控制中的代码是有效的
- 更少的部署时间
1. Why use CI tools like GitHub Actions
- Automated Testing is CRITICAL to Continuous Integration
- GitHub Actions can work with any language and any test suite
- Lots of languages and test suite support is built-in
2. How we use services like databases in GitHub Actions
3. Why do we add Badges from GitHub Actions to our repo README.md
- Badges give you a way of letting developers know the status of your code
- Build badges will show if the build or test cases are failing
- Coverage badges show your test coverage
- It is a good idea to add badges to your repo whenever possible
Github Actions
它使用 .github/workflows/ 文件夹将工作流定义存储为 .yaml 文件
1. 什么是 workflow?
工作流是一系列类似于管道的自动化过程
2. Components:
- Event: like a user pushing code to the repo (pull_request, push, and release)
- Jobs: 由步骤组成, jobs 并行运行,除非存在使用 need: 关键字的依赖项
- A runner
- Services (optional)
- Steps
- Runner: 在特定的平台或操作系统上执行工作的服务器
- Steps: 包含一个或多个 shell 命令或操作
- Actions: 可以在一个step中执行的程序
We don't do DevOps. We become DevOps!