DevOps part 5, Reflection

For me, DevOps was just a concept. I thought that it was just a title for a developer, but it’s not just that. This research helped me to understand what really DevOps is. Not just the understanding of the concept, but also it helped me to understand how does it works thanks to all the activities that we did on each part. Some of the activities were long and sometimes tedious, but they were accurate to the topic. 

I searched tools that can be used to implement DevOps and with a quick search I found  this link: https://raygun.com/blog/best-devops-tools/. In this link we can find the top 10 tools for DevOps. I just know two of them from those 10, Git and Docker. In my opinion, I didn’t like Docker when I used it because it was a little bit difficult to implement, but I do like Git. Git has a lot of advantages and some disadvantages.

Advantages:

  1. It’s a distributed model
  2. Branching and merging is easy
  3. Flexible workflow
  4. Assured data integrity

Disadvantages

  1. Steep learning curve
  2. Slow for binary files (non-text files)
1*QoR3rxWIbnf5wmF_IuAHqQ
Image taken from: https://cdn-images-1.medium.com/max/1600/1*QoR3rxWIbnf5wmF_IuAHqQ.png

These tools can be very helpful for the development of a project. There are so many tools for DevOps but it might take a while to know which one fits better for the team. It can take also time to configure and implement it into the project, but at the end these tools may boost the development of the project.

All of these exercise tasks during the semester are better than just writing a blogpost about a topic. Exercises help us to understand better the concepts because we need to work more in order to do them. We need to research about the topics in order to be able to apply them in the activity. So, if we research about it and then we apply it into an activity, we can gain more knowledge at the end.

DevOps part 3

In this blog post, I’ll show you how to configure our Github account with two-factor authentication, we’ll clone a repository in our virtual machine (the one that we downloaded in the previous post “DevOps part 2”) using SSH, we’ll try to commit new changes using SSH, and we’ll try to automate these updates using Crontab.

First, we are going to activate 2FA (two-factor authentication) on GitHub, it’s really simple. We need to login in our account in order to follow the next steps:

  1. Click the settings icon located in the top right corner.
  2. Click ‘Security’ in the in the user settings sidebar.
  3. Click ’Setup two-factor authentication’.
  4. Select ‘Setup using SMS’ and add your phone number.
  5. You’ll receive an activation code, type in in the field and click on ‘Enable’.

Once we activate 2FA, we can proceed with the connection of GitHub with SSH. For this, we need to check if we have existing SSH keys. If we don’t have a SSH key, we need to generate one. Generating a SSH key can be a little tricky, here’s a tutorial provided by GitHub that shows you how to generate a SSH key: https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent. Once we have our key, we need to add it to our GitHub account. To activate the key, we need to follow these steps:

  1. Click on your profile photo, then click on ‘Settings’.
  2. In the user settings sidebar, click SSH and GPG keys.
  3. Click New SSH key or Add SSH key.
  4. Add a descriptive title and paste the SSH key.
  5. Click Add SSH key and confirm the action entering your password.

We can find some steps to connect Github with SSH in this link: https://help.github.com/en/articles/connecting-to-github-with-ssh.

Now it’s time to clone. I have a web repository, but it’s private. I’ll try to explain the steps that I followed to achieve a live web site at the moment of the updates. That is, to see the changes automatically when we push a new update.

I followed this tutorial, I think that it explains the way we should do it better: https://gist.github.com/Nilpo/8ed5e44be00d6cf21f22. In my opinion, it’s too complicated to configure a GitHub repository with SSH, but it’s really useful if we want to automate the live production of our site. Once we have finished the tutorial, we can test our changes. I tried to modify my webpage and the updates are being reflected in the moment.

In my opinion, it’s difficult to decide the time of our automations using Crontab because it all depends on how are we going to work on one specific project. I think that it’s uncertain how often we can update project with new features.

DevOps part 2, Linux Server Setup

For this post, I’ll be explaining how to install Ubuntu in a new virtual machine from MacOS, how to install a programming language support environment in the VM and a web development to run a server, and how to setup a test use of Cron on the server. For this, I’ll be following some tutorials. I’ll link them later.

First, we need to install Ubuntu. For this, I decided to use Parallels because it’s really easy to manage a new virtual machine. We just need to download Parallels Desktop for Mac and open it. In the menu section, we need to select “Download Ubuntu Linux” and that’s it. Ubuntu will open when the download finishes. Once we download Ubuntu, drivers will be installed. We need to restart the VM before we start working on the following tasks.

Screen Shot 2019-03-19 at 10.23.19 PM.png

Once the VM has restarted, we can proceed to install our development environment. For this tutorial, I decided to create a virtual environment for python. If we run the command python -V, we can see that the default version is Python 2.7.12.We need to run the following commands to create an environment, then we’ll proceed to activate it.

apt-get update
apt-get install python-virtualenv
virtualenv -p /usr/bin/python3 virtualenvironment/PROJECT_NAME

Once these commands have finished to process, we need to activate our new environment. To do it, we need to run these commands:

cd virtualenvironment/PROJECT_NAME/bin

source activate

Now we are inside our new environment. Note, in order to get out of the environment, we just need to run

deactivate

The next step is to setup our web development. For this, I’ll be using LAMP. We just need to run:

sudo apt-get install lamp-server^

In order to test that LAMP is working, we just need to go to Firefox and open http://localhost. If the installation was correct, we are going to see a landing page like this one:

Screen Shot 2019-03-19 at 11.09.16 PM.png

If we want to add new stuff, We just need to add the new files to a folder. The folder is located in the files system, inside var/www/html/. There is a file named index.html, it’s the one that we are looking in the previous picture.

Finally, we can schedule tasks with the help of Crontab. With it, we can specify a command and it’ll be executed at the time it was assigned. For example, if we want to run an specific command every x minutes, we just need to open the crontab file with the command

crontab -e

Then, we need to select an editor, select anyone. Finally, we just need to add our instructions. To do it, we need to write the intervals to execute our command. The format to add one is “minute(0-59) hour(0-23) day(1-31) month(1-12) weekday(0-6) command”. So, if we want to run the command /usr/bin/example at 12:30 a.m. every day, we’ll type:

29 0 * * * /usr/bin/example

There are different ways to set a time, check the documentation first. It’s not that hard to set new tasks. Save the changes and your tasks will be activated.

A more descriptive tutorial can be found at https://www.howtogeek.com/101288/how-to-schedule-tasks-on-linux-an-introduction-to-crontab-files/

What is DevOps?

Software companies have more than one team to create their products. Those teams are divided into specific areas in order to have a better organization and to simplify the way to work together, but sometimes these divisions cause more problems at the end. It’s common to get in trouble while merging all the work at the end of each iteration or while pushing it to the deployment area. Sometimes, it’s because one team works with a different environment and the other teams with another. Maybe the communication between the temas is good, but it’s not necessarily sufficient to remove all possible compatibility problems. DevOps emerged in order to try to avoid these problems, or at least to reduce them. The following video explains in an easy way what DevOps is:

 

According to the video, DevOps is an integration between developers and operation teams in order to improve the collaboration and productivity. This goal is achieved by working together in all the lifecycle of the project, from the design process through the development process to the production delivery. With this practice, developers and operation teams (DevOps) can work together to automate workflows or to measure the application performance.

DevOps focus on automation. They can automate code for testing, workflows, or the infrastructure of the project. Also, the development of the project is divided in small pieces instead of having all the code or the complete feature. This practice is used because in this way it’s easier to fix bugs or to integrate the new implementation to all the work. This way of working makes a better communication between the operations and the developers. Both of them work with the same environment. DevOps is useful if we compare the speed of employment with the time it takes to deploy an implementation without DevOps. Usually, the frequency of deployments increase when DevOps is implemented in a company.

1*EBXc9eJ1YRFLtkNI_djaAw
Image taken from: https://medium.com/@neonrocket/devops-is-a-culture-not-a-role-be1bed149b0

In other words, DevOps can help the company reduce the time that it takes to deploy a new product, automate processes to analyse the performance of the software and its behavior, and to increase the productivity of the company. DevOps can be difficult to implement, a good communication in needed between the developers and the operation teams. Also, the right tools are important to put DevOps in practice. These tools help the whole team to implement DevOps in an easier way.

View at Medium.com