DevOps is a very simple approach from a theory point of view. Just a set of practices that combine software development (Dev) and information-technology operations (Ops) to shorten system development life cycle and provide continuous delivery with high software quality.
However, practically implementing DevOps is easier said than done. The practice requires a shift in mindset, a lot of patience, and effective management. The process of implementing DevOps is long and consists of the following steps:
1. Creating the DevOps Infrastructure
The first step to DevOps implementation is to create the DevOps infrastructure on which the application will run. But doing so is not easy. There is a lack of co-operation between the development and the operations team. Both work in two different groups and silos. Developers want to deliver changes as soon as possible and the operations team, on the other hand, aims for stability.
Nothing can better describe the whole scenario than this picture:
Now, we must bring them both together but also ensure they work towards the common goal of our stakeholders, i.e. releasing valuable software as soon as possible with minimum risk involved.
For this, we will have to create a continuous delivery pipeline so that both the development and the operation team can work together without any kind of confusion – thus releasing software sprints faster without much risk. We should make the following small yet crucial changes to realize this goal:
- We should audit even the smallest changes made to the deployment environment so that if anything goes wrong, we can easily track what caused the problem.
- We need to set strong monitoring systems to alert the development and operations team on time if any abnormal event occurs. This will minimize the downtime if anything goes wrong.
- We should ensure the application logs a WARNING every time a connection is unexpectedly closed or timed out, INFO or DEBUG every time a connection is closed.
- We should make sure our operation team can test the scenario if anything goes wrong so that the same thing can be prevented from happening again in the future.
- We must involve the operations team in the organizational IT service continuity plan right from the start.
- For creating the DevOps infrastructure, we should use technology with which the operations team is well-familiar – so that they can easily own and manage the environment.
2. Modeling & Managing the DevOps Infrastructure
The next thing we need after creating the DevOps Infrastructure is to model and manage it. Even if we don’t have complete control over the selection of Infrastructure – we must fully automate the build, integration, testing, and deployment process. These are the question we must ask at this stage:
- How will we provision the DevOps infrastructure?
- How are we going to deploy & configure various bits of software that forms our infrastructure?
- How can we manage our infrastructure once the provisioning and configuration?
Everything we need to create and maintain the infrastructure, such as operating system install definitions, configuration for data centre automation tools like Puppet, general infrastructure configurations like DNS files & SMTP settings, and the scripts for managing the infrastructure will be kept under the version control.
All these files in version control will provide inputs to the deployment pipeline – whose job in case of infrastructural changes is to:
- Verify that the infrastructural changes will be run on all the applications before they are pushed into the production environment. This will ensure that the new version of the infrastructure passes all functional and non-functional tests before it is live.
- Push changes to the production environment and the testing environment managed by the operations team.
- Perform tests for ensuring the successful deployment of the new infrastructure on the application.
For managing the DevOps infrastructure environment, we will need the following things:
A. For controlling the access to the DevOps Infrastructure
- Controlling the access so that no one can make changes without approval.
- Defining an automated process to make changes to the infrastructure.
- Monitoring the infrastructure to detect and fix issues on time.
B. For making changes to the DevOps Infrastructure
- Even the smallest change no matter if it’s about updating the firewall or deploying a new version of the software – should be run through the same change management process.
- The DevOps Infrastructure modification process should be managed through a single ticketing system everyone can log into.
- Changes should be logged as they are so that they can be easily audited.
- We should be able to view the history of changes to every environment.
- We need to test the changes in a production-like testing environment before pushing them live.
- Apply all the DevOps infrastructure changes to the version control first and then apply them through the automated process.
- Run tests to verify if the changes we made have worked or not.
3. Managing the Server Provisioning and Configuration
Server provisioning & server configuration management is often overlooked in small and medium-sized organizations. Yet, it’s a very important factor in DevOps infrastructure and environmental management. Let’s know about both in detail:
A. Server Provisioning
In server provisioning, we take a set of resources like appropriate systems and data and software to build a server and make it ready for network operation. Typical tasks during server provisioning are selecting a server from a pool of available servers, loading appropriate software, customizing and configuring the system, changing a boot image for the server, and finally changing its parameters. We can read more about server provisioning here.
Virtualization is the fundamental enable of the cloud which enables thousands of hosts virtually access servers over the internet. A virtual machine emulates a physical machine. Following will be benefits of virtualization:
- Fast response to the changing environment
- Hardware standardization
- Baselines can be easily maintained
C. Ongoing server management
After installing the operating system, we need to ensure full control over the configuration. They should not change in an uncontrolled manner. Nobody should be able to log into the deployment environment except the operations team and no change should be done without an automated system. We also need to apply OS service packages, upgrades, install new software, change necessary settings, and perform deployments.
D. Parallel testing with virtual environments
Next, we need to run parallel tests in the deployment pipeline to see if everything is running smoothly in the production environment or there are any issues.
4. Managing Data
We may also face a set of problems in Data management & organization while implementing the DevOps infrastructure, such as:
- There is a large volume of data involved which makes it impossible to keep track of each data involved in software development.
- The lifecycle of application data is different from other parts of the system.
One way to avoid this problem and effectively manage data is to delete the previous version or replace the old version with a new copy.
However, doing so is not possible in real-time scenarios. Every single bit of data is important. There can be scenarios when we might need to roll back to a previous state due to some issues. In that case, we will still need the older versions of data.
So, we will need some advanced approaches for data management like:
A. Database Scripting
One great way to manage data in DevOps Infrastructure is to capture all database initializations and migration as scripts and check into version control. Then, we can use these scripts to manage every database used in the delivery process.
However, we need to make sure all the database scripts are managed effectively so that there is no issue while retrieving data from the databases.
B. Deploying a database afresh
The most challenging yet crucial part of managing the DevOps infrastructure is to reproduce an environment after an issue occurs. We must ensure the application behaves the way it was behaving before the issue. And that’s where the process of deploying a database comes into play. This is what happens while we deploy a database afresh:
- The old version of data is erased
- The new database structure, instances, and schemas are created
- Finally, the data is loaded into the database
5. Incremental Change
Incremental change is another effective technique to manage DevOps infrastructure data. It ensures an application keeps working even after we are making changes into it – which is an important per-requisite of continuous integration (CI). Continuous delivery, on the other hand, demands the successful deployment of every software release, including the changes to the database into production. This means we must update the entire operational database while retaining the valuable data held in it. So, we need an efficient rollback strategy so that we can easily take back control of things if anything goes wrong.
For this, we follow the following data migration strategies:
A. Database Versioning
It is one of the most efficient mechanisms for data migration in an automated fashion. All we need is to create a table in the database which contains its version number. Now, every time we make a change to the database, we will have to create two scripts:
- A roll-forward script that takes the database from version x to version x+1.
- A roll-backward script that takes the database from version x+1 to version x.
Another thing we will need is an application configuration setting which specifies the version of the database with which it is designed to work.
Then during the deployment, we can use a tool which looks at the current version of the database and the database version required by the application version being deployed. Then this tool will use the roll-forward or roll-backward scripts to align both the application and the database version correctly. We can read about database scripting in detail here.
B. Managing Orchestrated Changes
This is another common practice for data migration. But we are not its favour because it’s better if applications can communicate directly – not through the database. Still, many companies are following this practice and integrating all applications through a single database.
If you are doing the same, be careful because even a small change in the database can have a knock-on effect on how other applications are working. We should test such changes in an orchestrated environment before implementing them in the production environment.
C. Rolling back the databases
With the help of roll-forward and roll-backward scripts, it’s easy to use an application at the deploy time to migrate the existing database to its correct version – that too without losing any data.
Another effective data migration strategy is to perform both the database migration process from the application deployment process independently. This will also make sure data migration is done without data loss or any change in the application behaviour.
6. Configuration Management
Configuration management is another crucial step in DevOps infrastructure management in which we ensure that all the files and software which we are expecting on the machine are available, configured correctly, and working as intended.
Managing configuration manually is simple for a single machine. However, when we are handling five or ten servers with which 100-200 computers are connected – configuration management becomes a nightmare. That’s why we need a better way to manage things:
A. Version Control
Version control is responsible for recording changes to a file or a set of files over time – so that we can easily remember specific versions later. It’s a wise thing to use because if we know the previous versions of files, we can easily roll back to the earlier versions of the project. Version control can also help us recover in case we make mistakes and screw up things.
Best practices for version control
- Use version control for everything (source code, tests, database scripts, builds & deployment scripts, documentation, libraries, and configuration files).
- Check-in regularly to see if all the versions are working properly.
- Use detailed multi-paragraph commit messages during check-in. This can save hours of debugging in case any error occurs later.
B. Managing components and dependencies
Managing external libraries
Since external libraries come in binary form, managing them can be a difficult task. Here are two ways we can get this done:
- Check the external libraries into the version control.
- Declare the external libraries and use a tool like Maven or Ivy to down them from the Internet repositories to our own artifact repository.
The best way is to split the application into smaller components. This will limit the scope of the changes to the application, reduce regression bugs, encourage reuse, and enable a much more efficient development process on large projects.
C. Managing Software Configuration
Another crucial part of configuration management. Software configuration should be managed carefully. We should subject it proper management & testing, and consider a few important software configuration principles, such as:
- Keep all the available application configuration options in the same repository as its source code.
- Manage the values of configurations separately.
- Perform configurations using an automated process with the help of values taken from the configuration repository.
- Use clear naming conventions to avoid confusion.
- Do not repeat any information.
- Keep the configuration information as simple as possible.
- Do not over-engineer or over-optimize the configuration system.
- Run all necessary configuration tests and keep a record of each.
That’s how we establish a DevOps infrastructure management and software deployment environment. Although, the process is not easy. It requires a lot of patience and guidance because there are a lot of chances we can go wrong.
At Softobiz, we have been responsible for building many successful projects like EasyWebinar using the DevOps approach. So, we can effectively guide you through the process of DevOps Infrastructure management and building the deployment pipeline environment.