← Tất cả bài viết

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

CommandDescription
ansible all -m pingPing all hosts to test connectivity
ansible all --list-hostsList all hosts in the inventory
ansible all -m ansible.builtin.gather_factsGather facts (system info) from all hosts

Default Locations:

  • Inventory file: /etc/ansible/hosts
  • Config file: /etc/ansible/ansible.cfg

Most Used Ansible Flags

FlagMeaningExample
-iSpecify the inventory fileansible-playbook -i hosts site.yml
-lLimit the playbook to specific hostsansible-playbook site.yml -l webservers
-ePass extra variablesansible-playbook site.yml -e "version=1.2.3"
-uSSH user to connect asansible-playbook site.yml -u ubuntu
--ask-passPrompt for SSH passwordansible-playbook site.yml --ask-pass
--ask-become-passPrompt for sudo passwordansible-playbook site.yml --ask-become-pass
-bBecome (sudo) on remote machinesansible-playbook site.yml -b
-v, -vv, -vvvIncrease verbosity (more v = more detail)ansible-playbook site.yml -vvv
--checkDry-run mode (show what would change)ansible-playbook site.yml --check
--diffShow differences when files changeansible-playbook site.yml --diff
--tagsRun only specific tagged tasksansible-playbook site.yml --tags "install,setup"
--skip-tagsSkip specific tagged tasksansible-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 configure

Jenkins

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/

Prometheus

Grafana

1860: Node Exporter Full

14282: Cadvisor Exporter

11199: NGINX Exporter

6239: MySQL Prometheus