II Sem. M.
Tech(Software Engineering)
DevOps and automation
Assignment
Report Submitted By
Name : Sandeep M
Registration Number : 220928012
Name : Uma D
Registration Number : 220928007
MAY-2023
Internal
We have developer application as per the requirement. SESLCMDashboard
Git links :
Front end : https://github.com/MTech2022/dev-ops-SESLCM-dashboard.git
Backend : https://github.com/MTech2022/dev-ops-backend-api.git
Below are the table and data used for backend – mysql
Internal
CREATE TABLE login (
id BIGINT PRIMARY KEY,
uname VARCHAR(16) NOT NULL,
passwd VARCHAR(16) NOT NULL,
login_role VARCHAR(10) NOT NULL
);
insert into login values
(1, 'sandeep','password', 'STUDENT'),
(2, 'mahesh','password', 'STUDENT'),
(3, 'devops','password', 'HOD'),
(4, 'uma','password', 'PROFESSOR');
insert into login
values(5, 'sesha','password', 'PROFESSOR');
CREATE TABLE subjects (
id BIGINT PRIMARY KEY,
subjectname VARCHAR(255) NOT NULL
);
insert into subjects values
(101, 'Machine Learning'),
(102, 'Software testing'),
(103, 'Cyber Security'),
(104, 'DevOps'),
(105, 'Full Stack Development'),
(106, 'Internet of Things');
CREATE TABLE hods (
id BIGINT PRIMARY KEY,
hname VARCHAR(25) NOT NULL,
login_id BIGINT,
FOREIGN KEY (login_id) REFERENCES login (id)
);
insert into hods
values(1, 'Raghavendar Achar', 3);
CREATE TABLE students (
id BIGINT PRIMARY KEY,
sname VARCHAR(25) NOT NULL,
login_id BIGINT,
FOREIGN KEY (login_id) REFERENCES login (id)
);
insert into students values
(1111, 'Sandeep M', 1),
(1112, 'Mahesh C', 2);
CREATE TABLE professors (
id BIGINT PRIMARY KEY,
pname VARCHAR(25) NOT NULL,
subject_id BIGINT,
login_id BIGINT,
FOREIGN KEY (login_id) REFERENCES login (id),
FOREIGN KEY (subject_id) REFERENCES subjects (id)
);
insert into professors values
(2001, 'Dr.Ajeeth S', 101, 4),
Internal
(2002, 'Dr.Kaliraj', 102, 4),
(2003, 'Dr.Renuka', 103, 4),
(2004, 'Dr.Raghavendra A', 104, 4),
(2005, 'Dr.Roshan D', 105, 4),
(2006, 'Dr.Manohar Pai', 106, 4);
CREATE TABLE marks (
student_id BIGINT,
subject_id BIGINT,
marks BIGINT,
FOREIGN KEY (student_id) REFERENCES students (id),
FOREIGN KEY (subject_id) REFERENCES subjects (id)
);
insert int marks values
(1111, 101, 89),
(1111, 102, 90),
(1111, 103, 77),
(1111, 104, 67),
(1111, 105, 89),
(1111, 106, 80),
(1112, 101, 89),
(1112, 102, 90),
(1112, 103, 77),
(1112, 104, 67),
(1112, 105, 89),
(1112, 106, 80);
-- HOD
select * from marks m join students s join subjects ss where m.student_id=s.id and ss.id=m.subject_id;
-- professor
select * from marks m join professors p where m.subject_id = p.subject_id and p.login_id=4;
-- student
select * from marks m join students s join subjects ss where m.student_id=s.id and ss.id=m.subject_id and s.login_id=2;
1 Demonstrate with suitable example, how version control system is used to manage source
code. What are the issues faced while merging the code and how it is resolved
What is version control?
Version control, also known as source control, is the practice of tracking and managing changes to software
code. Version control systems are software tools that help software teams manage changes to source code over
time. As development environments have accelerated, version control systems help software teams work faster
and smarter. They are especially useful for DevOps teams since they help them to reduce development time and
increase successful deployments.
Version control software keeps track of every modification to the code in a special kind of database. If a
mistake is made, developers can turn back the clock and compare earlier versions of the code to help fix the
mistake while minimizing disruption to all team members.
Internal
Benefits of version control systems
Using version control software is a best practice for high performing software and DevOps teams. Version
control also helps developers move faster and allows software teams to preserve efficiency and agility as the
team scales to include more developers.
Git is one of the best version control tools that is available in the present market.
Features
• Provides strong support for non-linear development.
• Distributed repository model.
• Compatible with existing systems and protocols like HTTP, FTP, ssh.
• Capable of efficiently handling small to large sized projects.
• Cryptographic authentication of history.
• Pluggable merge strategies.
• Toolkit-based design.
• Periodic explicit object packing.
• Garbage accumulates until collected.
Pros
• Super-fast and efficient performance.
• Cross-platform
• Code changes can be very easily and clearly tracked.
• Easily maintainable and robust.
• Offers an amazing command line utility known as git bash.
• Also offers GIT GUI where you can very quickly re-scan, state change, sign off, commit & push the
code quickly with just a few clicks.
A merge conflict is an event that takes place when Git is unable to automatically resolve differences in code between
two commits. Git can merge the changes automatically only if the commits are on different lines or branches
Below are the screenshots for the git push, git merge and git pull conflicts and resolving. I have attached some
screenshots of the intellij idea.
1. Conflicts on git push. We have remote changes not merged to local.
Internal
2. Pull when we have local changes not committed or stashed
3. Git merge options.
4.
Internal
5.
2. Articulate with suitable example, how Jenkins CI/CD pipeline is used to create an artifact
(using appropriate build tool like maven). Also mention which build trigger option used in
this scenario
Internal
Below is an example of how the mvn deploy pushes to artifactory server. Other maven commands
1. mvn clean install
2. mvn site
3. mvn sonar:sonar
4. mvn deploy
Below screenshot shows the flow of
artifact creation using Jenkins job.
Below screenshot show the build trigger options
3 Demonstrate how docker container is created and the artifact is deployed with suitable
code snippet
A Docker container image is a lightweight, standalone, executable package of software that includes everything
needed to run an application: code, runtime, system tools, system libraries and settings.
Docker image artifacts are used as references to images in registries , such as GCR , or Docker Hub . The artifacts can be
deployed to Kubernetes or App Engine, and generally trigger pipelines from notifications sent by their registry
Internal
Example of Docker application and architecture.
Below are the commands for docker image, container, and registry push.
docker create [OPTIONS] IMAGE [COMMAND] [ARG...]
example1
docker container create -i -t --name sandeep_container alpine
docker container start --attach -i sandeep_container
example 2
Internal
docker run -it --name sandee_container2 mysql
Execute a command in a running container
docker exec [OPTIONS] CONTAINER COMMAND [ARG...]
Example
docker run --name sandeep_container -d -i -t alpine /bin/sh
docker exec -d sandeep_container touch /tmp/execWorks
or
docker exec -it sandeep_container sh
Create a new image from a container’s changes
docker commit [OPTIONS] CONTAINER [REPOSITORY[:TAG]]
docker commit c3f279d17e0a sandeep_image/java_image:v20
create container from the new image
docker run -d sandeep_image/java_image:v20
Upload an image to a registry
docker push [OPTIONS] NAME[:TAG]
example :
docker image push --all-tags sandeep.registry.host.com:sandeep_image/java_image
Internal