Skip to content

Latest commit

 

History

History
645 lines (401 loc) · 17.4 KB

Slides.md

File metadata and controls

645 lines (401 loc) · 17.4 KB

class: center, middle

DevOps, Software Evolution and Software Maintenance

Helge Pfeiffer, Associate Professor,
Research Center for Government IT,
IT University of Copenhagen, Denmark
ropf@itu.dk


class: center, middle

About this course


Who are we?

  • Teachers: Helge, Mircea
  • TAs: David, Patrick, and Rasmus

--


How to contact us?


Helge

<iframe src="./map.html" width="50%" height=350 scrolling="auto"></iframe>
  • Dipl-Inf. in Software Engineering from Friedrich-Schiller Universität Jena
  • PhD in Software Engineering from ITU
  • Software engineer at DMI
  • Lecturer at Cphbusiness
  • Since January 2019 back to ITU in the Center for Government IT

Mircea

Currently: Associate Professor at ITU

Before:

  • U. Lugano (CH)
  • IBM TJ Watson (US)
  • U. Bern (CH)
  • U. Groningen (NL)

Research Interests:

  • Software Evolution
  • Tools for Software Maintenance
  • HCI & Tools for Personalized Learning

Who are you?


Who are you?

<iframe width="800" height="500" src="menti_results.pdf" frameborder="0" allowfullscreen ></iframe>

Our Expectations

  • Having fun with our work.
  • Hopefully, presenting relevant aspects of software engineering that are representative for your future professional tasks.

--

M2. Maintenance typically consumes about 40 to 80 percent (60 percent average) of software costs. Therefore, it is probably the most important life cycle phase.

...

M5. Most software development tasks and software maintenance tasks are the same—except for the additional maintenance task of "understanding the existing product." This task is the dominant maintenance activity, consuming roughly 30 percent of maintenance time. So, you could claim that maintenance is more difficult than development.

Robert L. Glass "Frequently Forgotten Fundamental Facts about Software Engineering"


Our Expectations, continued

  • That we learn from your experiences and knowledge. (We are not smarter than you are when it comes to the topics of this course, we only have a good idea on what we shall do together)
  • That you support each other when working in groups. The entire course and your projects are a team endeavor.
  • That you work continuously (as we do) on this course.
  • That you work for the about 10-12 hours per week on this course that you should have allocated for it according to ECTS.
  • That you work collaboratively in public repositories on GitHub.
  • That you read carefully our or other's documentation.

--

Note, be prepared for quite a bit of work and many moments of despair :(

This is unfortunately how learning works. At the moment it hurts but once you know how to solve your problems, solutions appear to be easy and straight forward.

  • Focus on your learning.

Do not get stressed by this course!

--

  • Mircea and I grade your exams according to the meaning of the grades, i.e., good means good!
  • This year: The exam is a pass/fail exam, i.e., no grades
    • We hope that that does not diminish your activity in this course

Schedule and Material

<iframe width="800" height="500" src="images/overview.pdf" frameborder="0" allowfullscreen ></iframe>

Course Book?

No book as such. We will link you to relevant material. In a few weeks, we will read parts of "The DevOps Handbook" on which this course is loosely based.


LearnIT

Find on LearnIT (BSc/MSc) the:

  • official course description,
  • intended learning outcomes, and
  • exam description

Getting Discounts

Check the GitHub student developers pack, https://education.github.com/pack.

You can get credits for some of the platforms we are going to use throughout this course.


How to work through this course?

For every week do from left to right what is specified in the course's schedule.

That is, prepare for the next session with the given material, join the respective session, and afterwards work on the project (see next slide).


Project work

You will run through this course in groups. All project groups have preferably five members (BSc./MSc. students respectively). These groups realize the projects together.

The project work forms the basis of this course. That is, you cannot expect to come to lectures listen and read a bit and then pass the exam. This is a hands-on course and you will have to perform "DevOps, software evolution and software maintenance activities [...] directly on [your] systems" (Course Description on LearnIT)


Lectures are not recorded


Lectures are not recorded, what can I do?


Why Linux?

--

You are a Software Developer

According to Stack Overflow's 2023 Developer Survey survey, more than 50% of the respondents use a *nix OS professionally.

--

Public servers on the Internet

Depending on the statistics, up to 98.3% of servers on the internet run some kind of Linux or Unix. Source: https://en.wikipedia.org/wiki/Usage_share_of_operating_systems#Public_servers_on_the_Internet


*nix on Supercomputers

Source: https://en.wikipedia.org/wiki/Usage_share_of_operating_systems#Supercomputers

Practical reasons

Since this is a hands-on course, we provide a lot of code and examples using various technologies.

Unfortunately, we do not have resources to do that consistently over various versions of Windows, Linux, and MacOS.


Groups

  • Each group should have five members.
  • We will form them today!
  • In this spreadsheet


Getting bored today?

Find and establish a communication channel for you and your group members and support them in downloading the code from the remote server (see slides below).

SCP the program flag_tool from the remote server, run it on your computer. What happens? Describe to your group mates after the session what you did and why running the program on your computer either works or does not work.

DO NOT disturb other people by doing smart stuff on the server!


class: center, middle

The Story Begins


The Story

This is fiction, but it is the story for this course :)

More than ten years ago in 2012 some unknown young developers at ITU decided to build a small micro-blogging platform ITU-MiniTwit to take over the market from Twitter, which was only six years old at that point.


ITU-MiniTwit


They programed in a mix of hot technologies of the time directly on a server with Ubuntu 12.04 (released 26 Apr. 2012, EOL 28 April 2017.).

--

Now some years later, we decide to resurrect their work and we will continue development from where they left.


class: center, middle

Your Turn!


Where is ITU-MiniTwit running?

During the time of this lecture it is running on the machine with the IP 104.248.24.1.

  • Play around with the system
    • Sign-up
    • Thereafter, create some tweets

Getting ITU-MiniTwit from the remote machine

The developers back in 2012 did not have a repository on GitHub with all the artifacts of their application. GitHub was first launched in 2008 and our developers did not hear about it yet...

So you have to do what really many people still do today. You copy the files over from the remote machine.

  • How do you do this?

Using scp to copy files/directories from a remote machine

$ scp -r student@104.248.24.1:/home/student/itu-minitwit ~/Desktop/

To secure copy from the remote machine, you need the password uiuiui.


What kind of files did you download?

$ cd ~/Desktop/itu-minitwit
$ ls -la
total 68
drwxr-xr-x 4 ropf ropf  4096 Jan 31 12:42 .
drwxr-xr-x 3 ropf ropf  4096 Jan 31 12:42 ..
-rwxr-xr-x 1 ropf ropf   590 Jan 31 12:42 control.sh
-rwxr-xr-x 1 ropf ropf 13032 Jan 31 12:42 flag_tool
-rw-r--r-- 1 ropf ropf  1895 Jan 31 12:42 flag_tool.c
-rw-r--r-- 1 ropf ropf   129 Jan 31 12:42 Makefile
-rwxr-xr-x 1 ropf ropf  8575 Jan 31 12:42 minitwit.py
-rwxr-xr-x 1 ropf ropf  5078 Jan 31 12:42 minitwit_tests.py
-rw-r--r-- 1 ropf ropf   466 Jan 31 12:42 schema.sql
drwxr-xr-x 2 ropf ropf  4096 Jan 31 12:42 static
drwxr-xr-x 2 ropf ropf  4096 Jan 31 12:42 templates

What are the files minitwit.py, flag_tool, control.sh?

You can check that with the file command:

$ file minitwit.py
minitwit.py: Python script text executable, ASCII text
$ file flag_tool
flag_tool: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.24, BuildID[sha1]=ac3ffde74553ce2d7d0551bfa4bd684f14978e43, not stripped
$ file control.sh
control.sh: ASCII text

Use the less command to inspect the files minitwit.py, flag_tool, and control.sh.

  • What do you see?

What happens when you run the minitwit.py application on your computer?

$ python minitwit.py
$ python minitwit.py
  File "/home/ropf/Desktop/itu-minitwit/minitwit.py", line 97
    print "We got a visitor from: " + str(request.remote_addr)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(...)?

What happens when you run the flag_tool on your computer?

$ ./flag_tool -h

--

Depending on your host operating system it may either run (you are on a corresponding Linux):

ITU-Minitwit Tweet Flagging Tool

Usage:
  flag_tool <tweet_id>...
  flag_tool -i
  flag_tool -h
Options:
-h            Show this screen.
-i            Dump all tweets and authors to STDOUT.

--

or it may look like in the following (in case you are on a MacOS):

$ ./flag_tool -h
-bash: ./flag_tool: cannot execute binary file
  • What does that mean?
  • Where does the error come from?

What happens when you run the flag_tool on your computer?

$ ./flag_tool 42
SQL error: no such table: message
  • What does that mean?

How does ITU-MiniTwit work?

A client-server application


A high-level overview over ITU-MiniTwit


Connecting to the server and inspecting ITU-MiniTwit (Bash basics)

Note, in the listings $ denotes the prompt on your local machine, which might look different in your case. student@webserver:~$ is the prompt on the server machine.

To SSH to the remote machine, you need the password uiuiui.

$ ssh student@104.248.24.1
student@webserver:~$ cd itu-minitwit/
student@webserver:~/itu-minitwit$ ls
Makefile  control.sh  flag_tool  flag_tool.c  minitwit.py  minitwit_tests.py  schema.sql  static  templates

Inspecting the database as admin

student@webserver:~$ ./control.sh inspectdb
  • What do you see?
  • How can you navigate through the database?
  • How can you search for a string?
  • How do you find its next/previous occurrence?

How does inspecting the database work?

Look into the control script. For example with the less command:

student@webserver:~$ less -N ./control.sh
  • What do lines 15 and 16 do?
  • What is the meaning of | on line 16?
  • What are -N and ./control.sh in the above command?
  • What is the meaning of ./ in it?

Bash Weirdness...

if [ $1 = "init" ]; then

    if [ -f "/tmp/minitwit.db" ]; then
        echo "Database already exists."
        exit 1
    fi
    echo "Putting a database to /tmp/minitwit.db..."
    python -c"from minitwit import init_db;init_db()"
  • What is the [ $1 = "init" ] in the above code?
  • What does type test tell you?
  • What does man [ tell you?

https://www.linuxjournal.com/content/understanding-bash-elements-programming


How can I run the flag_tool program manually?

student@webserver:~$ ./flag_tool

It will not do anything. So try to read its help text

student@webserver:~$ ./flag_tool -h

Afterwards run:

student@webserver:~$ ./flag_tool -i

What happens?


Another way of searching for strings in text

You may want to use the grep command:

student@webserver:~$ ./flag_tool -i | grep "idiot"
student@webserver:~$ ./flag_tool -i | grep "dumb"
  • What does again the | do?
  • What does grep do?
  • What are "idiot" and "dumb" in the above command?

Flagging a tweet

student@webserver:~$ ./flag_tool <tweet_id>
  • How does that flagging functionality look like in the control script control.sh?

Getting help for a command

In case you are in doubt, usually a command's manual is quite conclusive:

student@webserver:~$ man grep

How do I know that ITU-MiniTwit is running?

Since the knowledge of the previous developers is likely lost, you could inspect the list of all running processes and grep for the name of the command:

student@webserver:~/itu-minitwit$ ps aux | grep minitwit
student   6081  0.0  4.2  55448 21364 ?        S    10:40   0:00 /usr/bin/python minitwit.py
student   6083  0.3  4.9 131776 24556 ?        Sl   10:40   0:03 /usr/bin/python minitwit.py
student   6199  0.0  0.1  12912   936 pts/0    S+   10:54   0:00 grep --color=auto minitwit

Whenever you run ./control.sh stop all processes with corresponding names are pkilled and thereby the application is shutdown.


Do you have everything?

  • Which files/artifacts are missing in what you have?

Getting the Database

And just to also collect all of your tweets, let's copy the most current database:

$ scp student@104.248.24.1:/tmp/minitwit.db ~/Desktop/itu-minitwit

--

Now, you have everything that you need for your task until next week.


What to do now?