DevOps useful stuffs
Các đoạn hay từ quyển The DevOps Handbook: How to Create World-Class Agility, Reliability, and Security in Technology Organizations.
Leader and Worker
Worker
We explicitly state the problem we are seeking to solve, our hypothesis of how our proposed countermeasure will solve it, our methods for testing that hypothesis, our interpretation of the results, and our use of learnings to inform the next iteration.
Leader
The leader helps coach the person conducting the experiment with questions that may include:
- What was your last step and what happened?
- What did you learn?
- What is your condition now?
- What is your next target condition?
- What obstacle are you working on now?
- What is your next step?
- What is your expected outcome?
- When can we check?
Invite Ops to our dev standups
One of the Dev rituals popularized by Scrum is the daily standup (although physically standing up have become distinctly optional in remote teams), a quick meeting where everyone on the team gets together and presents to each other three things: what was done yesterday, what is going to be done today, and what is preventing you from getting your work done.
The purpose of this ceremony is to radiate information throughout the team and to understand the work that is being done and is going to be done. By having team members present this information to each other, we learn about any tasks that are experiencing roadblocks and discover ways to help each other move our work toward completion. Furthermore, by having managers present, we can quickly resolve prioritization and resource conflicts.
Development process
at the end of each development interval, we must have integrated, tested, working, and potentially shippable code, demonstrated in a production-like environment, created from trunk using a one-click process, and validated with automated tests.
Docker
Docker can containerize everything, from webserver, web app, to database. It is really easy to clean. Although microservices seem to take lots of space and memory -> Help deliver and set up an app between dev using 1 click, making it independent from programming language and database selections.
Docker helps not to separate between prod env and dev env. This helps dev stay as close to the prod environment as possible.
- Same path
- Same config
- Same package information
Ansible
| Command | Description |
|---|---|
ansible all -m ping | Ping all hosts to test connectivity |
ansible all --list-hosts | List all hosts in the inventory |
ansible all -m ansible.builtin.gather_facts | Gather facts (system info) from all hosts |
Default Locations:
- Inventory file:
/etc/ansible/hosts - Config file:
/etc/ansible/ansible.cfg
Most Used Ansible Flags
| Flag | Meaning | Example |
|---|---|---|
-i | Specify the inventory file | ansible-playbook -i hosts site.yml |
-l | Limit the playbook to specific hosts | ansible-playbook site.yml -l webservers |
-e | Pass extra variables | ansible-playbook site.yml -e "version=1.2.3" |
-u | SSH user to connect as | ansible-playbook site.yml -u ubuntu |
--ask-pass | Prompt for SSH password | ansible-playbook site.yml --ask-pass |
--ask-become-pass | Prompt for sudo password | ansible-playbook site.yml --ask-become-pass |
-b | Become (sudo) on remote machines | ansible-playbook site.yml -b |
-v, -vv, -vvv | Increase verbosity (more v = more detail) | ansible-playbook site.yml -vvv |
--check | Dry-run mode (show what would change) | ansible-playbook site.yml --check |
--diff | Show differences when files change | ansible-playbook site.yml --diff |
--tags | Run only specific tagged tasks | ansible-playbook site.yml --tags "install,setup" |
--skip-tags | Skip specific tagged tasks | ansible-playbook site.yml --skip-tags "tests" |
Terraform
terraform -chdir=<path> init
terraform -chdir=<path> plan
terraform -chdir=<path> apply
terraform -chdir=<path> destroy
terraform -chdir=<path> output
brew install awscli
aws configureJenkins
https://www.jenkins.io/doc/pipeline/steps/workflow-basic-steps/
fileExists: Verify if file exists in workspace
Plugin: https://plugins.jenkins.io/sonar/
Plugin: https://plugins.jenkins.io/http\_request/
Plugin: https://plugins.jenkins.io/pipeline-utility-steps/
Plugin: https://plugins.jenkins.io/config-file-provider/
Plugin: https://plugins.jenkins.io/credentials-binding/