Practical assignments

PA#1

        Create a bash script named dbtime that outputs system time. Make sure only a user database can run this script. Create a bash script named kname that outputs the name of the linux kernel. Make sure only a user serviceK can run this script. Both users database and serviceK are members of a group named dserver. Every member of dserver group can edit scripts dbtime and kname, while other users of the system can only view their contents. Demonstrate this setup in action in 2 minute video.

Submit your assignment through this form.

PA#2
Purpose: to demonstrate the skills of working with git branches.
  • The equation that you need to work upon is shown on the image below (take equation that equals to your number in the list of the group you study at).
  • Create a new repo in github, clone the repo to a local directory.
  • Create files suite with a source code in cpp language: a cpp/h file pair holding a class with a public function named FuncA calculating a trigonometric function returning value 0, and the file named main.cpp that instantiates the class and calls the function; Push the code to a branch named master;
  • Branch out from master, naming a new branch branchA. In branchA update the implementation of FuncA calculating function result value as the sum of the first n elements of an infinite sequence. Make n as a function argument. Stash your changes.
  • Branch out from master branch creating a new branch named hotfix; In hotfix update the implementation of FuncA returning its value as the sum of the first 3 elements of an infinite sequence. Commit the code and push to the repo.
  • Switch back to the branch branchA. Stash pop your intermediate result. Finish the implementations and add comments to the class and its function about its param meaning. Commit and try pushing your updates. Resolve the conflict in favor of branchA changes. Take a photo/screenshot of a 3way diffmerge vimdiff contents when merging. Commit and push.
Make a screenshot showing the log of branch history.
Submit a link to github repo, an image showing 3way merge contents of vimdiff, an image of a branch log final history.


Variants


Submit your assignment through this form.

 PA#3

  • Branch out from master branch and create branch named branchMake. Implement Makefile that builds your cpp project. Add continuous integration action to github reflecting the changes.
  • Branch out from branchMake branch and create branch named branchAutomake. Implement Makefile.am and configure.ac scripts building your cpp project. Add continuous integration action to github reflecting the changes.
  • Branch out from branchAutomake branch and create branch named branchAutoTest. Prepare a unit test checking the result of your function is within tolerance with "exact" value. Update Makefile.am and configure.ac scripts to build autotest. Add continuous integration action to github reflecting the changes.
  • Branch out from branchAutoTest branch and create branch named branchAutoPackage. Update Makefile.am and configure.ac scripts to build Debian package. Add continuous integration action to github reflecting the changes.
Submit your assignment through this form.

 PA#4

  • Branch out from branchAutoTest and create branch named branchHTTPserver. Implement an http server that handles GET request /compute. Use this code as a template. Reuse your class for calculating trigonometric function as a payload. Prepare an array of values calculated by your function and sort this array in ascending manner. The number of array elements should result in calculation time taking approximately 20 seconds on your CPU. Update the unit test to check that calculation time is within 10 to 30 seconds.
  • Prepare a Dockerfile that includes your http server.
  • Register an account at docker hub. Push your image to docker hub.
Submit your assignment through this form.

 PA#5

  • Switch to branchHTTPserver branch. Update continuous integration github action preparing docker images for two architectures arm64 and arm64. Create a manifest joining two images into single multiarchitecture image.
  • Branch out from branchHTTPserver branch creating branchHTTPservMutli. Modify your Dockerfile so it: pulls files from github instead of copying them from local Github actions folder; configures and makes the software inside a temporary image and then copies the executable to another Alpine based image.
Submit your assignment through this form.

Control assignment

Switch to branchHTTPservMutli branch

Prepare a bash script that:

  • launches a container named srv1 that holds the server prepared in PA#5.
  • if the container srv1 remains busy for 2 consecutive minutes launches a container named srv2. The same logic for srv2 and srv3 pair.
  • If the container srv3 is running and stays idle for 2 consecutive minutes signals the container to exit. The same logic for srv2.
  • If the new container is available then update three containers srv1, srv2 and srv3 if running. It is up to you to suggest when exactly to update. Make sure at least one container is available when updating the rest
  • Prepare a 2 minute video to demo the script operation
Submit your assignment through this form.



Comments

Popular posts from this blog