In this blog I wrote a lot about automation and devops1 and now I am studying GitOps.
What is GitOps?
GitOps is an evolution of DevOps.
DevOps is a set of practices that combines software development and IT Operations. It aims to shorten the systems development life cycle and provide continuous delivery with high software quality
Usually this is done with script and automation (tools, code, ape with a keyboard…) and remove some human error.
DevOps is a deployment practices, in other way is a philosophy. In any way you have a concept without an implementation.
DevOps define a way of working and we need something more practical for the world.
With DevOps in mind we can make an implementation of this set of steps:
- Coding writing code
- Building code automatic build or similar application specific
- Testing code in automatic way and you don’t have bug on the deploy
- Approving with issue and merge requests
- Packaging code read for production
- Releasing the deploy of the software
- Configuring the software and all the other stuffs
- Monitoring check if the software crash, use all the rams, eat some people…
And write an microservice’s app or deploy your blog while sleeping become the new day to day life.
GitOps decide to create a Universal model for develop and maintain an It infrastructure. The main idea is Infrastructure as Code and put all is software and configs into a Git repo.
This Idea has an huge example into Kubernetes where all is a Yaml file and must be committed somewhere.
This is a new think?
In this blog there are some articles about dot-files and other gitops stuffs bifore there sere called GitOps.
You can make script, automations and configs into a file and make it deplora with the DevOps’s technique.
You must also have testing and deploy within a git repo. So you must use stuff like GitHub Action or TravisCI for testing and automations.
Do I need to have Kubernetes?
No, you don’t. You can use all sort of automations. You can write your own tools or you can use something like Kubernetes, Ansible, etc…
The main focus is to have a good Git server (GitHub, GitLab,GitTea,…) for hosting your repo and automation for apply the code and the config into your infrastructure.
Why do I gain from using it?
First of all you gain time. If you have an history of all your change in the infrastructure you can roll back in an easy way (revert a commit) and you can add test for the config and other stuff like router configurations.
Second you have a way to approve the changes before something crash in a bad way.
Third this is a really easy way to replicate a server or a configuration or edit it in a cluster of machine without logging inside all the machine or launch command after command. You only need to change the config/code in the repos and push to the master/main/deploy branch.
Forth you can have one or more Manager/Supervisor watching and approving all the changes (with the pull requests and fixes) and approving or deny them before something become a problem or a huge problem.
My team is one or two dev/devops/sysadmin/ttech guy…
If you don’t have man power you need to use this technique for trying to have more work within the same time with the same check or even more.
I can use it for my little project?
Yes, you can. This blog is a GitOps example.
This site is made with all the necessary stuff and the configs inside repos.
All you need for run it is inside one of two repo:
- A repo with the source code of the blog (img, HTML, CSS, posts, etc…)
- The Hugo repo (the software for building my blog)
In this repos (the blog one) you have
Like the posts and the images used in this blog and all the info for the Search engine are store in plain files. Some of them are media file but a lot of them are text files (a lot of MarkDown files and some Json). Only the comments are outside of the repo.
An the config folder where is define some stuff for build the site like the menu or the meta needed for the compression or CoockieLaw. It also have some config for GitHub for the GitHub Action and the config for GitHub Pages.
I added some GitHub Action for building the site and test for 404 or similar error after the build. In this way I don’t need to check all the link manually.
I need this for dev and run it because I don’t remember all the commands. In my case an easy to use makefile with some command for building, cleaning and testing the site before deploy it on the world wild web.3
Working in a little team GitOps is an essential tool for our teamwork. Good luck for your implementation of GitOps
If you liked this article,
please share it on