## Task 31 The Nautilus application development team was working on a git repository /usr/src/kodekloudrepos/media present on Storage server in Stratos DC. One of the developers stashed some in-progress changes in this repository, but now they want to restore some of the stashed changes. Find below more details to accomplish this task: Look for the stashed changes under /usr/src/kodekloudrepos/media git repository, and restore the stash with stash@{1} identifier. Further, commit and push your changes to the origin. ```bash ssh natasha@ststor01 sudo su - cd /usr/src/kodekloudrepos/media git stash list # git stash apply stash@{1} git stash pop stash@{1} sudo git add -A sudo git commit -m "Restore stashed changes from stash@{1}" sudo git push origin master ``` ## Task 32 The Nautilus application development team has been working on a project repository /opt/demo.git. This repo is cloned at /usr/src/kodekloudrepos on storage server in Stratos DC. They recently shared the following requirements with DevOps team: One of the developers is working on feature branch and their work is still in progress, however there are some changes which have been pushed into the master branch, the developer now wants to rebase the feature branch with the master branch without loosing any data from the feature branch, also they don't want to add any merge commit by simply merging the master branch into the feature branch. Accomplish this task as per requirements mentioned. Also remember to push your changes once done. ```bash ssh natasha@ststor01 sudo su - cd /usr/src/kodekloudrepos/demo/ git checkout feature git rebase master # replay feature on top of master, linear git push origin feature --force # force-push rewritten feature git log --oneline --graph --all ``` ## Task 33 Sarah and Max were working on writting some stories which they have pushed to the repository. Max has recently added some new changes and is trying to push them to the repository but he is facing some issues. Below you can find more details: SSH into storage server using user max and password Max_pass123. Under /home/max you will find the story-blog repository. Try to push the changes to the origin repo and fix the issues. The story-index.txt must have titles for all 4 stories. Additionally, there is a typo in The Lion and the Mooose line where Mooose should be Mouse. Click on the Gitea UI button on the top bar. You should be able to access the Gitea page. You can login to Gitea server from UI using username sarah and password Sarah_pass123 or username max and password Max_pass123. Note: For these kind of scenarios requiring changes to be done in a web UI, please take screenshots so that you can share it with us for review in case your task is marked incomplete. You may also consider using a screen recording software such as loom.com to record and share your work. ```bash ssh max@ststor01 # password: Max_pass123 cd /home/max/story-blog git status git log --oneline -5 git push origin master ``` ## Task 34 The Nautilus application development team was working on a git repository /opt/cluster.git which is cloned under /usr/src/kodekloudrepos directory present on Storage server in Stratos DC. The team want to setup a hook on this repository, please find below more details: Merge the feature branch into the master branch, but before pushing your changes complete below point. Create a post-update hook in this git repository so that whenever any changes are pushed to the master branch, it creates a release tag with name release-2023-06-15, where 2023-06-15 is supposed to be the current date. For example if today is 20th June, 2023 then the release tag must be release-2023-06-20. Make sure you test the hook at least once and create a release tag for today's release. Finally remember to push your changes. Note: Perform this task using the natasha user, and ensure the repository or existing directory permissions are not altered. ```bash ssh natasha@ststor01 sudo su - cd /usr/src/kodekloudrepos/cluster git checkout master git merge feature sudo tee /opt/cluster.git/hooks/post-update > /dev/null <<'EOF' #!/bin/bash # post-update hook: tag a dated release when master is pushed release_date=$(date +%F) # YYYY-MM-DD tag="release-${release_date}" git tag -f "$tag" master EOF sudo chmod +x /opt/cluster.git/hooks/post-update # now post-update hook should be alive git push origin master # Verify # tag should now exist in the bare repo sudo git --git-dir=/opt/cluster.git tag -l # or from the working clone after fetching sudo git fetch origin --tags sudo git tag -l ``` ## Task 35 The Nautilus DevOps team aims to containerize various applications following a recent meeting with the application development team. They intend to conduct testing with the following steps: Install docker-ce and docker compose packages on App Server 3. Initiate the docker service. ```bash ssh banner@stapp03 # add prerequisites + Docker's official repo sudo yum install -y yum-utils sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo # install docker-ce, CLI, containerd, and compose sudo yum install -y docker-ce docker-ce-cli containerd.io docker-compose-plugin # start + enable the service sudo systemctl enable --now docker ``` ## Task 36 The Nautilus DevOps team is conducting application deployment tests on selected application servers. They require a nginx container deployment on Application Server 1. Complete the task with the following instructions: On Application Server 1 create a container named nginx_1 using the nginx image with the alpine tag. Ensure container is in a running state. ```bash ssh tony@stapp01 sudo docker run -d --name nginx_1 nginx:alpine # verify sudo docker ps ## Task 37 The Nautilus DevOps team possesses confidential data on App Server 1 in the Stratos Datacenter. A container named ubuntu_latest is running on the same server. Copy an encrypted file /tmp/nautilus.txt.gpg from the docker host to the ubuntu_latest container located at /opt/. Ensure the file is not modified during this operation. ```bash ssh tony@stapp01 docker cp /tmp/nautilus.txt.gpg ubuntu_latest:/opt/ # confirm it's in the container sudo docker exec ubuntu_latest ls -l /opt/nautilus.txt.gpg # integrity check — compare checksums host vs container md5sum /tmp/nautilus.txt.gpg sudo docker exec ubuntu_latest md5sum /opt/nautilus.txt.gpg ``` ## Task 38 Nautilus project developers are planning to start testing on a new project. As per their meeting with the DevOps team, they want to test containerized environment application features. As per details shared with DevOps team, we need to accomplish the following task: a. Pull busybox:musl image on App Server 1 in Stratos DC and re-tag (create new tag) this image as busybox:blog. ```bash ssh tony@stapp01 # a. pull the source image docker pull busybox:musl # re-tag it as busybox:blog docker tag busybox:musl busybox:blog ``` ## Task 39 One of the Nautilus developer was working to test new changes on a container. He wants to keep a backup of his changes to the container. A new request has been raised for the DevOps team to create a new image from this container. Below are more details about it: a. Create an image news:xfusion on Application Server 1 from a container ubuntu_latest that is running on same server. ```bash ssh tony@stapp01 sudo docker commit ubuntu_latest news:xfusion sudo docker images news # news:xfusion present ``` ## Task 40 One of the Nautilus DevOps team members was working to configure services on a kkloud container that is running on App Server 3 in Stratos Datacenter. Due to some personal work he is on PTO for the rest of the week, but we need to finish his pending work ASAP. Please complete the remaining work as per details given below: a. Install apache2 in kkloud container using apt that is running on App Server 3 in Stratos Datacenter. b. Configure Apache to listen on port 6300 instead of default http port. Do not bind it to listen on specific IP or hostname only, i.e it should listen on localhost, 127.0.0.1, container ip, etc. c. Make sure Apache service is up and running inside the container. Keep the container in running state at the end. ```bash ssh banner@stapp03 # BigGr33n docker exec -it kkloud bash # in running container apt update apt install -y apache2 sed -i 's/^Listen 80$/Listen 6300/' /etc/apache2/ports.conf sed -i 's///' /etc/apache2/sites-enabled/000-default.conf service apache2 start # verify inside container # is it listening on 6300 on all interfaces? apt install -y net-tools 2>/dev/null netstat -tlnp | grep 6300 # or ss -tlnp | grep 6300 # functional check curl http://localhost:6300