DevOps part III: Github, SSH and keys

 

  • Ensure that you have your GitHub account.

ensuringExistanceOfGithubAcc

https://github.com/OscarSierra24

 

  • 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)

repo

https://github.com/OscarSierra24/software-testing-hw

 

  • Setup your GitHub two-factor authentication.

two-factor-enabled

github-ssh-keysssh

ssh-test

  • Ensure that you can do a git clone (use ssh) to your server from your repository. You should do this.

clone-via-ssh

  • Make changes to your repository (you can do this any method including via the GitHub site).
  • 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.

git-pull

  • Does the webpage update if you reload that this code sits in?

YES.

  • 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?

Ideally, we should update our local master branch (git pull origin master) whenever there’s a push to the remote.

I have heard and read about jenkins and git hooks as the best way to do this, however, since the goal is to implement this with cron, I decided to create a cronjob that pulls every minute.

As we can see. It works, I added the file ignore-this-im-just-testing-cronjob.txt via the github site

Since cron is doing the pull request on the background, I didn’t have to pull to get the remote changes.

cronjob

 

 

Deja un comentario