DEEEV OOOPS -3rd parts where never good…

Okay, this is the 3rd part of DevOps series. In this chapter we will continue with the setup of the tools that will help us improve our development pipeline and habilities.

This weeks activity is focused on setup of GitHub and connecting it to our server.

  1. Ensure that you have a repository created for testing. I recommend some form of web content, but you can choose your content for the testing. You should put this in the root of your web server that you created in DevOps part 2, Linux Server Setup (Individual)
  2. Setup your GitHub two-factor authentication.
  3. Setup your SSH keys (Enlaces a un sitio externo.)Enlaces a un sitio externo. so that you are able to connect to GitHub repositories using ssh (Enlaces a un sitio externo.)Enlaces a un sitio externo..
  4. Ensure that you can do a git clone (use ssh) to your server from your repository. You should do this.
  5. Make changes to your repository (you can do this any method including via the GitHub site).
  6. Ensure that you can update your server copy with a simple «git pull origin master» at the command line from the directory where you have pulled your data.
  7. Does the webpage update if you reload that this code sits in?
  8. Automate those updates using what you learned about cron in DevOps part 2, Linux Server Setup (Individual). How often should you update? How do you ensure (and you should do this) that you do not end up with two copies of your update script running at the same time?

At this point I hope we all have a github (or other source control tool) account for our now 4 years of engineering. If not, well, you don’t need to be a genius to create it. Just remember to see a few tutorials on how to use git.

https://i.kym-cdn.com/photos/images/original/000/540/816/41d.png

For this activity testing, I will use one of my engineering classes repository (compilers lecture). I recommend you to use one you already have but if you are new to this, just create a new one with some readme file on it.

We need to set the 2factor authentication on our github account. It is as easy as going to github.com, then to settings, then to security and click to enable. You might need to choose an app to handle the authentication, or use your mobile by sms. I chose an app called authenticator.

For generating an SSH key you can follow the instructions in the next link: https://help.github.com/en/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent After you generate your SSH key, you will need to add it to your SSH-Agent. The how to? is in the same link.

What goes next is to add your key to github. For copying the key just use the next commands. You shouldn’t have problems y you followed the tutorial I gave you.

$ sudo apt-get install xclip
# Downloads and installs xclip. If you don't have `apt-get`, you might need to use another installer (like `yum`)

$ xclip -sel clip < ~/.ssh/id_rsa.pub
# Copies the contents of the id_rsa.pub file to your clipboard

Then on github, got to settings

Settings icon in the user bar

then to SSH and GPG keys and click to add key.

Authentication keys

Then click to NEW SSH key. And paste the key. Remember to put a reference of your current device on the title so you know from where you are allowing the SSH communication.

The key fieldThen click on add key, and you will need to input your github password. Then you are done. To make sure that you did it all right, you will need to clone a repo you have. Then make a change, anything you want, from github.com and then from your server (computer with the SSH key) use the command git pull origin master. A message like this will appear.

SSHsuccess

En ese caso, sabemos que nuestra comunicación segura por SSH ha sido exitosa. Lo unico que queda restante es programar en cron los intervalos para realizar la actualización local de nuestro repositorio.

For that, I will let you a tutorial of the basics, and if you need, a crontab generator.

https://crontab-generator.org/

In the process of doing these activities I have met and figure out different really cool ways of augmenting my productivity and automatize  task which is really amazing because I have never done this before. Yeah, now I feel ignorant, but hey, you gotta start somewhere right?

Deja un comentario