DevOps, from wikipedia:
DevOps (a portmanteau of “development” and “operations”) is a concept dealing with, among other things: software development, operations, and services. It emphasizes communication, collaboration, and integration between software developers and information technology (IT) operations personnel. DevOps is a response to the interdependence of software development and IT operations. It aims to help an organization rapidly produce software products and services.
I think everybody in IT world knows about DevOps concept. Or at least heard about it. Somebody might hire DevOps Engineers.
But if you ask yourself – what does DevOps mean precisely? What should DevOps Engineer do during the work day? – the answer probably is clear to you only if you’re DevOps Engineer (it should be!) or if you work very closely with them. For the other world it’s some kind of leprechaun that magically solves all the problems for the team (or application). Well, that’s usually true (not the leprechaun part), but it seems to me there are no any good common standards or rules for this job.
I’d like to share my thoughts about what day-to-day activities should have every DevOps Engineer. I wrote them in a form that every developer should understand, especially if you’re interested in doing more DevOps stuff in your team.
Two Simple Rules
So, let’s start from the two very simple rules that every DevOps person should adopt:
- Everything should be automated
- Everything should be automated in a way that other member of the team can use it
That’s it. You can apply it to anything – running tests, accessing logs, using monitoring, doing releases, … The whole point of having a DevOps Engineer is to glue your Product/Dev/Operations/QA teams together, eliminate any unnecessary communication and manual work. As a result you should see increased speed of development and decreased number of bugs (at least human errors).
Ok, that was very high level things. Let’s go deeper.
Development tools support
It’s important to increase development speed as much as you can – it affects budget, happiness and even business metrics. But sometimes you have to work with really complicated applications, especially if you use service-oriented architecture.
Having the same setup for all developers can be challenging. Luckily tools like Vagrant can reduce the struggle. For example, Vagrant + Docker is a really powerful combination to reproduce any complicated stack.
Also, make sure you use VCS for everything ;–)
Continuous Integration (CI)
Jenkins, TeamCity, Bamboo, CircleCI, Travis… – all these tools have very simple, but very powerful idea: run your builds or tests automatically, triggered by events (usually commits in VCS system) or time. It allows you, as a developer, sleep well, because all your changes are tested almost in realtime.
As a DevOps Engineer it’s important to make sure developers can see results and debug any issues, but at the same time they shouldn’t deal with CI system too much – use email/chat notifications. They will like it.
When a codebase is tested it’s time to deploy it. At least to a staging server. We’ll talk about deployments in the next section, but here let’s talk about environments. Usually every team has a local environment for local development, dev or staging environment for running tests / showing demos and, of course, production environment.
So, imagine you decided to update a version for some library. Or programming language. It means you have to go and update it for every environment! And in case of local environment you should do it for every team member! That’s a nightmare!
Fortunately we have really nice tools for configuration management. Check Tools section below.
Deployment / Continuous Delivery
Ok, codebase is ready, we also have a few environments that were configured automatically. It’s time to deploy our application!
Actually, sometimes you might think that it’s a trivial task. You can just write a small bash-script that takes the latest version from your VCS and restarts a service or something.
But it can be really complicated as well. Load balancers for rolling updates, feature flags, blue green deployments, RDBMS replicas and shards…
And again, even very complicated deployment can be automated. Check Tools section for more details.
Btw, you can combine CI and deployments! It’s called Continuous Delivery (or Continuous Deployment) and the idea behind is obvious: deploy your change right away if all tests are succeeded. That’s a huge win, you can deploy very often and you can get a feedback very fast.
When you prepare your application for production release it’s very important to understand who can access what. Things like ssh keys, VPNs, IP whitelisting should make you life easier.
So, application is running and it gets some traffic. Nice!
But production environment is always different. And someday you’ll see that one part of your app works really slow. Or just behave strange. Or traffic is too high. And you can’t reproduce it locally :(
That’s why you should use monitoring. And when I say monitoring I don’t mean have NewRelic integration (which is great, actually) and relax. Measure Anything, Measure Everything – that’s very good idea, especially for your future. You business folks will say thank you, you’ll see.
Monitoring itself usually is not enough. First of all, when something is not working you should know it first. Notifications and alerts that wake you up at 3am on Sunday are really helpful.
All kinds of logs help you investigate issues and if you can afford Splunk – just buy it.
You can design some systems to have self-healing procedures. That’s not easy, but can reduce a lot of pain.
Backup & Restore
You probably do some backups, don’t you? But have you ever tried to actually use them?
Backups can give you false confidence, you should only rely on restore procedure. Make sure you have backups for database, file storage, etc. and they can be quickly used. Otherwise you’re in trouble.
Hint: restore = [configuration management + ] deployment + backup data.
Chef, Puppet, Ansible, SaltStack – these are main DevOps tools and every DevOps person should be familiar with at least one of them. They all have important features like configuration management, multi-node deployments, task execution, etc.
Usually if you want to create a bash-script and put it on a remote machine one of those tools is a better solution.
Let me show you an example of using Ansible for Tomcat installation and configuration:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
As you can see, it’s very easy to read. Don’t be afraid. Just pick one of those tools and act (pick Ansible).
Constantly apply Two Simple Rules and you’ll see how much time you spend on actual development instead of struggling with configuration, environments or deployments. You can’t automate development process (yet), but you should automate everything else.