diff --git a/README.md b/README.md index cc532c3..9dc416c 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ :information_source:  This repo contains questions and exercises on various technical topics, sometimes related to DevOps and SRE :) -:bar_chart:  There are currently **1600** questions +:bar_chart:  There are currently **1571** questions :books:  To learn more about DevOps and SRE, check the resources in [devops-resources](https://github.com/bregman-arie/devops-resources) repository @@ -26,7 +26,7 @@ ansible
Ansible
Network
Network
Linux
Linux
- Terraform
Terraform
+ programming
Programming
@@ -35,7 +35,6 @@ Bash
Scripts
kubernetes
Kubernetes
Prometheus
Prometheus
- Mongo
Mongo
Cloud
Cloud
@@ -44,16 +43,14 @@ Google Cloud Platform
Google Cloud Platform
openstack
OpenStack
security
Security
- puppet
Puppet
+ Operating System
Operating System
Monitoring
Monitoring
Elastic
Elastic
Virtualization
Virtualization
DNS
DNS
- Operating System
Operating System
- Distributed
Distributed
- General
General
+ Misc
Misc
Testing
Testing
@@ -62,7 +59,6 @@ Design
System Design
Hardware
Hardware
Big Data
Big Data
- you
Questions you ask
Certificates
Certificates
@@ -71,7 +67,13 @@ OpenShift
OpenShift
Storage
Storage
HR
HR
- Exercises
Exercises
+ + + Terraform
Terraform
+ Mongo
Mongo
+ puppet
Puppet
+ Distributed
Distributed
+ you
Questions you can ask
@@ -81,6 +83,14 @@ ## DevOps +### DevOps Exercises + +|Name|Topic|Objective & Instructions|Solution|Comments| +|--------|--------|------|----|----| +| Set up a CI pipeline | CI | [Exercise](exercises/devops/ci_for_open_source_project.md) | | | + +### DevOps Self Assessment +
What is DevOps?
@@ -581,6 +591,15 @@ Read more about it [here](https://sre.google/sre-book/introduction) ## Jenkins +### Jenkins Exercises + +|Name|Topic|Objective & Instructions|Solution|Comments| +|--------|--------|------|----|----| +| Remove Jobs | Scripts - Jobs | [Exercise](exercises/jenkins/remove_jobs.md) | [Solution](exercises/jenkins/solutions/remove_jobs_solution.groovy) | | +| Remove Builds | Scripts - Builds | [Exercise](exercises/jenkins/remove_builds.md) | [Solution](exercises/jenkins/solutions/remove_builds_solution.groovy) | | + +### Jenkins Self Assessment +
What is Jenkins? What have you used it for?
@@ -876,8 +895,8 @@ There can be several reasons for that. One of them is lack of policy. To solve t
What should you use to: - * Grant access between two services/resources? - * Grant user access to resources/services?
+ - Grant access between two services/resources? + - Grant user access to resources/services?
* Role * Policy @@ -994,7 +1013,8 @@ False. Charges are being made when the code is executed. - R, Swift, Rust, Kotlin - Python, Ruby, Go -- Python, Ruby, PHP
+- Python, Ruby, PHP +
- Python, Ruby, Go
@@ -1058,9 +1078,9 @@ True
Explain the following: - * Object Lifecycles - * Object Sharing - * Object Versioning
+ - Object Lifecycles + - Object Sharing + - Object Versioning
* Object Lifecycles - Transfer objects between storage classes based on defined rules of time periods * Object Sharing - Share objects via a URL link @@ -1799,9 +1819,9 @@ Read more about it [here](https://aws.amazon.com/sns)
Explain the following in regards to SNS: - * Topics - * Subscribers - * Publishers
+ - Topics + - Subscribers + - Publishers
* Topics - used for grouping multiple endpoints * Subscribers - the endpoints where topics send messages to @@ -1878,12 +1898,13 @@ Learn more [here](https://aws.amazon.com/partners/consulting)
Which of the following are AWS accounts types (and are sorted by order)? - * Basic, Developer, Business, Enterprise - * Newbie, Intermediate, Pro, Enterprise - * Developer, Basic, Business, Enterprise - * Beginner, Pro, Intermediate Enterprise
+ - Basic, Developer, Business, Enterprise + - Newbie, Intermediate, Pro, Enterprise + - Developer, Basic, Business, Enterprise + - Beginner, Pro, Intermediate Enterprise +
- * Basic, Developer, Business, Enterprise + - Basic, Developer, Business, Enterprise
@@ -2489,6 +2510,14 @@ Read more [here](https://www.globalsign.com/en/blog/what-is-hsts-and-how-do-i-us ## Linux +#### Linux Master Application + +A completely free application for testing your knowledge on Linux + + + +### Linux Self Assessment +
What is your experience with Linux?
@@ -2741,9 +2770,9 @@ Its a bit that only allows the owner or the root user to delete or modify the fi
What the following commands do? - * chmod - * chown - * chgrp
+ - chmod + - chown + - chgrp
* chmod - changes access permissions to files system objects * chown - changes the owner of file system files and directories @@ -3085,8 +3114,8 @@ It means that the key of the remote host was changed and doesn't match the one t
What each of the following matches - * ? - * *
+ - ? + - *
* The ? matches any single character * The * matches zero or more characters @@ -4175,12 +4204,6 @@ MemAvailable - The amount of available memory for new workloads (without pushing GPL v2
-#### Linux Master Application - -A completely free application for testing your knowledge on Linux - - - ## Operating System
@@ -4943,6 +4966,15 @@ The Terraform Registry provides a centralized location for official and communit ## Containers +### Containers Exercises + +|Name|Topic|Objective & Instructions|Solution|Comments| +|--------|--------|------|----|----| +|My First Dockerfile|Dockerfile|[Link](exercises/write_dockerfile_run_container.md)|[Link](exercises/write_dockerfile_run_container.md) + + +### Containers Self Assesment +
What is a Container? What is it used for?
@@ -5182,6 +5214,16 @@ Because each container has its own writable container layer, and all changes are +### Kubernetes Exercises + +#### Developer & Regular User Path + +|Name|Topic|Objective & Instructions|Solution|Comments| +|--------|--------|------|----|----| +|My First Pod|Dockerfile|WIP|WIP + +### Kubernetes Self Assesment +
What is Kubernetes? Why organizations are using it?
@@ -5204,6 +5246,10 @@ At a minimum, a cluster contains a worker node and a master node." Read more [here](https://www.redhat.com/en/topics/containers/what-is-a-kubernetes-cluster)
+
+When or why NOT to use Kubernetes?
+
+ #### Kubernetes Nodes
@@ -6865,6 +6911,8 @@ class MyClass(object): ```
+#### Python - Exceptions +
What is an error? What is an exception? What types of exceptions are you familiar with?
@@ -6954,6 +7002,20 @@ For more details about errors and exceptions follow this [https://docs.python.or
+
+What is the result of running the following function? + +``` +def true_or_false(): + try: + return True + finally: + return False +``` +
+False +
+ #### Python Built-in functions
@@ -8429,6 +8491,11 @@ Alert manager is responsible for alerts ;) ## Git +|Name|Topic|Objective & Instructions|Solution|Comments| +|--------|--------|------|----|----| +| My first Commit | Commit | [Exercise](exercises/git/commit_01.md) | [Solution](exercises/git/solutions/commit_01_solution.md) | | +| Time to Branch | Branch | [Exercise](exercises/git/branch_01.md) | [Solution](exercises/git/solutions/branch_01_solution.md) | | +
How do you know if a certain directory is a git repository?
@@ -10908,10 +10975,10 @@ It's an architecture in which data is and retrieved from a single, non-shared, s Explain the Sidecar Pattern (Or sidecar proxy)
-## General +## Misc
-What is a server?
+What is a server? What is a client?
A computer which serves data from itself to the client.
@@ -10924,6 +10991,13 @@ I like this definition from [here](https://blog.christianposta.com/microservices "An explicitly and purposefully defined interface designed to be invoked over a network that enables software developers to get programmatic access to data and functionality within an organization in a controlled and comfortable way."
+
+What is Automation? How it's related or different from Orchestration?
+ +Automation is the act of automating tasks to reduce human intervention or interaction in regards to IT technology and systems.
+While automation focuses on a task level, Orchestration is the process of automating processes and/or workflows which consists of multiple tasks that usually across multiple systems. +
+
Tell me about interesting bugs you've found and also fixed
@@ -11557,6 +11631,13 @@ Sharding is a horizontal partitioning. Are you able to explain what is it good for?
+
+You find out your database became a bottleneck and users experience issues accessing data. How can you deal with such situation?
+ +Not much information provided as to why it became a bottleneck and what is current architecture, so one general approach could be
+to reduce the load on your database by moving frequently-accessed data to in-memory structure. +
+
What is a connection pool?
@@ -12073,47 +12154,6 @@ If you are looking for a way to prepare for a certain exam this is the section f * [Certified Kubernetes Administrator (CKA)](certificates/cka.md) (Latest update: 2020) -## Exercises - -Exercises are all about: - - * Setting up environments - * Writing scripts - * Designing and/or developing infrastructure apps - * Fixing existing applications - -Below you can find several exercises - -#### Containers -* [Writing a Dockerfile and running a container](exercises/write_dockerfile_run_container.md) - -#### Jenkins - -* [Jenkins: writing scripts](exercises/jenkins_scripts.md) -* [Jenkins: writing pipelines](exercises/jenkins_pipelines.md) - -#### CI/CD - -* [CI for open source project](exercises/ci_for_open_source_project.md) -* [Write a pipeline - Docker image and K8](exercises/pipeline_deploy_image_to_k8.md) - -#### Programming - -* [grep before and after](exercises/programming/grep_berfore_and_after.md) -* [web scrapper](exercises/programming/web_scraper.md) - -#### Mixed - -* [Flask, Containers and CI](exercises/flask_container_ci/README.md) -* [Flask, Containers and CI 2](exercises/flask_container_ci2/README.md) - -#### Misc - -* [Elasticsearch & Kibana on AWS](exercises/misc/elk_kibana_aws.md) -* [ELK & Filebeat](exercises/eflk.md) -* [Ansible, Minikube and Docker](exercises/ansible_minikube_docker.md) -* [Cloud Slack bot](exercises/cloud_slack_bot.md) - ## Other DevOps Projects

diff --git a/coding/python/binary_search.py b/coding/python/binary_search.py index cb4fefb..c8186ae 100644 --- a/coding/python/binary_search.py +++ b/coding/python/binary_search.py @@ -2,9 +2,10 @@ import random + def binary_search(arr, lb, ub, target): """ - A Binary Search Example which has O(log n) time complexity. + A Binary Search Example which has O(log n) time complexity. """ if lb <= ub: mid = ub + lb // 2 @@ -17,6 +18,7 @@ def binary_search(arr, lb, ub, target): else: return -1 + if __name__ == '__main__': rand_num_li = sorted([random.randint(1, 50) for _ in range(10)]) target = random.randint(1, 50) diff --git a/exercises/ci_for_open_source_project.md b/exercises/devops/ci_for_open_source_project.md similarity index 94% rename from exercises/ci_for_open_source_project.md rename to exercises/devops/ci_for_open_source_project.md index 84a79a2..2012224 100644 --- a/exercises/ci_for_open_source_project.md +++ b/exercises/devops/ci_for_open_source_project.md @@ -9,4 +9,4 @@ ### Bonus -Containerize the app of the project you forked using any containerization technology you want. +Containerize the app of the project you forked using any containerization technology you would like. diff --git a/exercises/git/branch_01.md b/exercises/git/branch_01.md new file mode 100644 index 0000000..65b78af --- /dev/null +++ b/exercises/git/branch_01.md @@ -0,0 +1,19 @@ +## Git Commit 01 + +### Objective + +Learn how to work with Git Branches + +### Instructions + +1. Pick up a Git repository (or create a new one) with at least one commit +2. Create a new branch called "dev" +3. Modify one of the files in the repository +4. Create a new commit +5. Verify the commit you created is only in "dev" branch + +### After you complete the exercise + +Answer the following: + +1. Why branches are useful? Give an example of one real-world scenario for using branches diff --git a/exercises/git/commit_01.md b/exercises/git/commit_01.md new file mode 100644 index 0000000..83a9c3c --- /dev/null +++ b/exercises/git/commit_01.md @@ -0,0 +1,20 @@ +## Git Commit 01 + +### Objective + +Learn how to commit changes in Git repositories + +### Instructions + +1. Create a new directory +2. Make it a git repository +3. Create a new file called `file` with the content "hello commit" +4. Commit your new file +5. Run a git command to verify your commit was recorded + +### After you complete the exercise + +Answer the following: + +* What are the benefits of commits? +* Is there another way to verify a commit was created? diff --git a/exercises/git/solutions/branch_01_solution.md b/exercises/git/solutions/branch_01_solution.md new file mode 100644 index 0000000..d697ab7 --- /dev/null +++ b/exercises/git/solutions/branch_01_solution.md @@ -0,0 +1,20 @@ +## Branch 01 - Solution + +``` +cd some_repository +echo "master branch" > file1 +git add file1 +git commit -a -m "added file1" +git checkout -b dev +echo "dev branch" > file2 +git add file2 +git commit -a -m "added file2" +``` + +Verify: + +``` +git log (you should see two commits) +git checkout master +git log (you should see one commit) +``` diff --git a/exercises/git/solutions/commit_01_solution.md b/exercises/git/solutions/commit_01_solution.md new file mode 100644 index 0000000..21cdf3d --- /dev/null +++ b/exercises/git/solutions/commit_01_solution.md @@ -0,0 +1,10 @@ +## Git Commit 01 - Solution + +``` +mkdir my_repo && cd my_repo +git init +echo "hello_commit" > file +git add file +git commit -a -m "It's my first commit. Exciting!" +git log +``` diff --git a/exercises/jenkins/remove_builds.md b/exercises/jenkins/remove_builds.md new file mode 100644 index 0000000..d96edca --- /dev/null +++ b/exercises/jenkins/remove_builds.md @@ -0,0 +1,14 @@ +### Jenkins - Remove Jobs + +#### Objective + +Learn how to write a Jenkins script that interacts with builds by removing builds older than X days. + +#### Instructions + +1. Pick up (or create) a job which has builds older than X days +2. Write a script to remove only the builds that are older than X days + +#### Hints + +X can be anything. For example, remove builds that are older than 3 days. Just make sure that you don't simply remove all the builds (since that's different from the objective). diff --git a/exercises/jenkins/remove_jobs.md b/exercises/jenkins/remove_jobs.md new file mode 100644 index 0000000..7a4926c --- /dev/null +++ b/exercises/jenkins/remove_jobs.md @@ -0,0 +1,10 @@ +### Jenkins - Remove Jobs + +#### Objective + +Learn how to write a Jenkins script to remove Jenkins jobs + +#### Instructions + +1. Create three jobs called: test-job, test2-job and prod-job +2. Write a script to remove all the jobs that include the string "test" diff --git a/exercises/jenkins/scripts/old_builds.groovy b/exercises/jenkins/solutions/remove_builds_solution.groovy similarity index 100% rename from exercises/jenkins/scripts/old_builds.groovy rename to exercises/jenkins/solutions/remove_builds_solution.groovy diff --git a/exercises/jenkins/scripts/jobs_with_string.groovy b/exercises/jenkins/solutions/remove_jobs_solution.groovy similarity index 89% rename from exercises/jenkins/scripts/jobs_with_string.groovy rename to exercises/jenkins/solutions/remove_jobs_solution.groovy index f0bf21f..35839e6 100644 --- a/exercises/jenkins/scripts/jobs_with_string.groovy +++ b/exercises/jenkins/solutions/remove_jobs_solution.groovy @@ -1,4 +1,4 @@ -def jobs = Jenkins.instance.items.findAll { job -> job.name =~ /"REMOVE_ME"/ } +def jobs = Jenkins.instance.items.findAll { job -> job.name =~ /"test"/ } jobs.each { job -> println job.name diff --git a/scripts/count_questions.sh b/scripts/count_questions.sh index d47cc33..c627b89 100755 --- a/scripts/count_questions.sh +++ b/scripts/count_questions.sh @@ -2,4 +2,4 @@ # We dont care about non alphanumerics filenames so we just ls | grep to shorten the script. -echo $(( $(ls -R ./exercises/ | grep ".*md" -c) + $(grep \ -c README.md) )) +echo $(( $(grep \ -c README.md) + $(grep -i Solution README.md | grep \.md -c) ))