0% found this document useful (0 votes)
6 views11 pages

External Devops

The document outlines a series of experiments focused on web development and version control, including creating a user registration form using HTML and CSS, exploring Git and GitHub commands, and installing Jenkins for CI/CD. It provides step-by-step procedures for each experiment, detailing necessary commands and configurations. Additionally, it discusses Docker's role in content management and provides commands for managing Docker containers and images.

Uploaded by

22k91a0529
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views11 pages

External Devops

The document outlines a series of experiments focused on web development and version control, including creating a user registration form using HTML and CSS, exploring Git and GitHub commands, and installing Jenkins for CI/CD. It provides step-by-step procedures for each experiment, detailing necessary commands and configurations. Additionally, it discusses Docker's role in content management and provides commands for managing Docker containers and images.

Uploaded by

22k91a0529
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Experiment 1: Write code for a simple user registration form for an event

Aim: Write code for a simple user registration form for an event.

Objective:

To create a basic user registration form for an event using HTML and CSS.

Procedure:

1. Open a text editor like Visual Studio Code.

2. Create a new HTML file named registration_form.html.

3. Write the HTML code for the registration form including fields like name, email, phone

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>User Registration Form</title>

<link rel="stylesheet" href="styles.css">

</head>

<body>

<h2>User Registration Form</h2>

<form>

<label for="name">Name:</label>

<input type="text" id="name" name="name" required><br>

<label for="email">Email:</label>

<input type="email" id="email" name="email" required><br>

<label for="phone">Phone:</label>

<input type="tel" id="phone" name="phone" required><br>

<input type="submit" value="Submit">

</form>

</body>

</html>

4. Style the form using CSS for better presentation.

body {

font-family: Arial, sans-serif;

margin: 20px;

}
form {

border: 1px solid #ccc;

padding: 20px;

width: 300px;

input[type="text"],

input[type="email"],

input[type="tel"],

input[type="submit"] {

width: 100%;

padding: 10px;

margin: 5px 0;

box-sizing: border-box;

input[type="submit"] {

background-color: #4CAF50;

color: white;

border: none;

input[type="submit"]:hover {

background-color: #45a049;

Save the file as styles.css

5. Save the files and open registration_form.html in a web browser to test the form functionality.

EXPERIMENT NO: 2. Explore Git and GitHub commands

Aim: Explore Git and GitHub commands

Objective:

To understand the basic Git commands and how to use GitHub for version control.

the GIT full form is “Global Information Tracker,” a powerful version control system widely used for software
development and other collaborative projects. GIT allows multiple developers to work on a project simultaneously
while ensuring that their changes do not interfere with one another.

Procedure:

1.Create a GitHub account if you don't have one

Save your email id, user name, file name.

2.Install Git Bash on your system if not already installed.


For Linux: sudo apt-get installgit

For macOS: brew install git

For Windows: Download and install from Git website – 64 bit window exe setup.

3. These are some basic command of git/Linux before going into the git we need to know.

1)To check present working directory - pwd command

Write output-

2)To list the files and folders in the current directory – ls

Write output-

3)To change current directory to desktop - cd Desktop

Write output-

4)To check present working directory - pwd = c/user/rcp/desktop

Write output-

5)To create a directory- mkdir myproject

Write output-

6) Verify if the directory is created, list the files and folders in the current directory – ls

Write output-

7)To change directory to myproject - cd myproject

Write output-

8)To create a empty file in current directory - touch (filename)

Write output-

9)To edit file we will need editor – vi filename (which is similar to note pad)

Write output-

10)To get into the insert mode - type i ( you will see --Insert-- )

Write output-

11)To get out of insert mode - type ESC key

Write output-

12)To save the file - type :wq( where w is write and q is quit)

Write output-

13)To view the content of the file - cat filename.

Write output-

14)To configure your email id with git hub

git config --global user.email [email protected]

Write output-

15) To configure username with git hub


git config --global user.name "Your Name"

Write output-

16) To initialize current directory as a git local repository - git init

Write output-

17) To verify if local repository created or not - ls -a (you should see a directory called .git/)

Write output-

18) To check the status of git - git status( if the file are in red color then they are in working directory which change
can be made)

Write output-

19) To send file from working directory to stageing - git add <file name>

Write output-

20) To check status if it is in green color it is ready to commit - git status

Write output-

21) To commit the files (for which is to stageing to local repository) - git commit -m "this is the updated file"

Write output-

22) again check the status - git status(On branch master nothing to commit, working tree clean)

Write output-

23) To send file from working directory to stageing -git add .

Write output-

24) To check status if it is in green color it is ready to commit - git status

Write output-

25) To commit the files (for which is to stageing to local repository) - git commit -m "this is the updated file"

Write output-

26)To check the Log – git log

Write output-

-Branching - to maintain main branch integrity of the main branch.

will create a new branch (feature branch) or sub branch and will do changes in it and will request to merge.

git branch - * symbol - to verify if the current branch is switched to new branch

24) $ git branch == it shows what are the local branches in our local repository

$ git branch

* master

25) creates a new branch from the new branch. = git branch <newbranchname>

[note - the above command creates a new branch only, it does not switch to new branch and stays in old branch
only.]

26)git checkout <branchname> - to switch to new branch


27) ls - to see the content

28) $ git branch – to check where is the * and branch is

29) $ ls

30)touch <filename> to create a new file

31)git status

32)git add .

33) git commit -m “message”

34) $ git merge <submaster >– for merger you need to checkout to master first and merger the file of newbranch to
master branch.

Open your GitHub account and created a new Repository

Experiment 3:

Practice Source code management on GitHub. Experiment with the source code in exercise-1.

Aim: To practice source code management using Git and GitHub for the registration form created in Experiment 1.
Procedure:

To practice source code management on GitHub, you can follow these steps:

• Create a GitHub account (if you don't already have one.)

• Create a new repository on GitHub.

Create a New Repository

• Log In to GitHub: Go to GitHub and log in with your new credentials.

• Navigate to Repositories: Click on your profile picture in the top-right corner, then select "Your repositories."

• Create a New Repository: Click the "New" button or "Create a new repository."

• Repository name: Enter a name for your repository.

• Description: (Optional) Add a description of your repository.

• Public/Private: Choose whether you want the repository to be public or private.

• Initialize this repository with a README: Optionally, check this box if you want to include a README file.

• Click the "Create repository" button to finalize.

4 Fill Out Repository Details:

Link your local repository to a GitHub repository using git remote add origin command.

1) $ git remote add origin <url>

Eg - $ git remote add origin https://github.com/vaishu-hub/sindhu.git

2)$ git remote -v


Eg - Output:-

origin https://github.com/Kirangaggs/dharma-new.git (fetch)

origin https://github.com/Kirangaggs/dharma-new.git (push)

----------------------------------------------------------------------------------------------------------------

clone :-

When you create a repository on GitHub, it exists as a remote repository. You can clone your repository to create a
local copy on your computer and sync between the two locations.

Cloning a repository from GitHub:

Command - $ git clone <repository-url>

Write output-

Push :- The git push command is used to upload local repository content to a remote repository.

Pushing changes to a remote repository:

Command:- $ git push origin <branchname>

Write output-

==================================================================================

Pull:-

The git pull command is used to fetch and download content from a remote repository and immediately update the
local repository to match that content.

Command - $ git pull origin <branch name>

Write output-

EXPERIMENT NO: 4. Jenkins installation and setup, explore the environment

Aim: Jenkins installation and setup, explore the environment

Jenkins is an automation server that helps to automate the build, test, and deployment of software

Jenkins is a popular open-source tool for Continuous Integration and Continuous Deployment (CI/CD) in software
development. Here are the steps to install and set up Jenkins:

--------------------------------------------------------------------------------------

-Frist verify java is installed on machines or not

Open command prompt (cmd) - java --version

if version output given java is installed in machine -> Go for Jenkins installation

Jenkins support java 11,17,21 only so install these versions only

if not, error output is given -> Start with Java installation

- To install Jenkins on Windows 11, you can follow these

steps:

1. Download the Jenkins Installer: Visit the official Jenkins website (https://www.jenkins.io) and navigate to the
Downloads page. Download the Windows installer package (usually an .msi file) compatible with your system.
2. Run the Installer: Locate the downloaded .msi file and double-click on it to run the Jenkins installer. You may be
prompted to grant administrative permissions.

3. Select Installation Directory: In the installer window, select the installation directory for Jenkins. The default
location is typically in the "Program Files" directory. You can choose a different directory if desired.

4. Choose Installation Options: On the next screen, you can select additional installation options, such as creating
shortcuts or configuring Jenkins to run as a Windows service. Make the desired selections and proceed.

5. Customize Jenkins URL: In the subsequent screen, you can choose the Jenkins URL, which is the address you'll use
to access the Jenkins web interface. By default, it will be http://localhost:8080. You can keep the default or specify a
different URL if needed.

6. Complete the Installation: After configuring the installation options, click on the "Install" button to start the
installation process. Wait for the installer to complete the installation of Jenkins on your Windows 11 system.

7. Launch Jenkins: Once the installation is finished, you can choose to launch Jenkins automatically by keeping the
corresponding checkbox selected. Otherwise, you can manually launch Jenkins later from the Start menu or desktop
shortcut

8. Access Jenkins Web Interface: Open a web browser and enter the Jenkins URL (e.g., http://localhost:8080) in the
address bar. The Jenkins web interface should load, and you'll be prompted to unlock Jenkins page by entering the
initial administrative password.

9. Retrieve Initial Admin Password: To retrieve the initial administrative password, navigate to the Jenkins installation
directory on your computer.

(i.e: c/programData/Jenkins/.jenkins/secrets/initialAdminPassword.

Look for a file called "initialAdminPassword" and open it using a text editor(like Notepad). Copy the password and
paste it into the Jenkins web interface to proceed.

10. Follow Setup Wizard: The Jenkins setup wizard will guide you through the remaining configuration steps,
including installing recommended plugins and creating the first administrative user. Follow the instructions on the
screen to complete the setup. By following these steps, you can install Jenkins on Windows

Give your username and password in Jenkins as admin and admin.

11 and start using it for your continuous integration and continuous delivery (CI/CD) workflows. Note: Make sure
your system meets the minimum requirements for running Jenkins, such as having Java Development Kit (JDK)
installed.

EXPERIMENT NO.: 6. Explore Docker commands for content management.

AIM: Explore Docker commands for content management.

DESCRIPTION

Before diving into Docker commands, it's important to understand how Docker fits into content management.

• Docker is a platform that enables you to package applications into containers. These containers are isolated,
lightweight environments that ensure consistency across different environments.

• In the context of content management, Docker can be used to containerize CMS applications (like WordPress,
Joomla, etc.), media processing tools, file servers, or static website generators.

• Docker helps ensure that these systems are portable, easy to deploy, and scalable, enabling efficient content
management workflows.

• Container: A lightweight, standalone, and executable package that includes everything needed to run a piece
of software (code, runtime, system tools, libraries).
• Image: A read-only template used to create containers. You can think of it as a snapshot of a filesystem and
applications.

• Docker Hub: A cloud-based repository where Docker images are stored and shared.

2. Install Docker

If Docker desktop is not installed on your system yet, follow these steps:

• Windows/Mac: Download and install Docker Desktop from Docker's official site.

Steps to install docker in windows:

Step-1: Verify if wsl is installed in windows or Not

------

Open CMD

$ wsl --version

Case-1:

If version is displayed wsl is installed.

Note:

We need wsl version 2 in order to install docker

To verify Default version of wsl use the following command

$ wsl --status

Sample Output:

Default Distribution: docker-desktop

Default Version: 2

If wsl version is not 2 but 1 use the following command

$ wsl --set-default-version 2

Case-2:

If wsl is not installed:

-> Open "turn windows feature on or off" from start menu

-> Click on Check box next to "Windows Subsystem for Linux"

-> Click OK

-> Wait for the process to complete

-> Then click on Restart Now Button to restart the system

After System Restarts:

----------------------

Perform steps in case-1


Or

Wsl --status

Wsl --update

wsl --install –d Ubuntu

Step-2: Download docker desktop

-------

To Install Docker Desktop:

-> In chrome browser: https://docs.docker.com/desktop/install/windows-install/

-> Click on "Docker Desktop for Windows - x86_64"

-> Download Begins.

-> After the Docker desktop Installer download completes.

-> Double-click Docker Desktop Installer.exe to run the installer. By default, Docker Desktop is installed at C:\Program
Files\Docker\Docker.

-> When prompted, ensure the Use WSL 2 instead of Hyper-V option on the Configuration page is selected or not
depending on your choice of backend.

-> Follow the instructions on the installation wizard to authorize the installer and proceed with the install.

-> When the installation is successful, select Close to complete the installation process.

-> Restart the system if required

Step-3: Account in Docker Hub

------

-> In Chrome Browser: hub.docker.com

-> Signup using any of the given options

Step-4 : Use Docker hub Account to login to Docker Desktop

Docker is a containerization technology that is widely used for managing application containers. Here are some
commonly used Docker commands for content management:

Docker commands

1)docker pull: - To pull the image from docker hub

steps: -

(i)login to docker hub

(ii) Search nginx

(iii) docker pull nginx:latest(repo to local)

docker pull <image-name>:<tag-name>

2) docker image ls: To list the docker images in our system

3) docker run: To run the images available in our system

(i) Syntax: docker run -d -p 8080:80 --name nameofcontainer imgename:latest


Docker run -d <to run container in the background> -p <portforwarding> <hostport:containerport> --name <name of
the container> <image-name>:tag

The container on which application is running cannot be directly connected to. To overcome this challenge docker
has introduced concept of port forwarding, where one of the port from the host-system (the machine on which the
docker is installed ) can be mapped to the port of container where the application in running in the container.

4. docker ps : to view all the running containers

5. docker ps -a : to view all the running and non running containers

6. docker rm <container id/container name>: to delete the container which is in stopped state or nor running state.

7.docker stop <container id/container name> : to stop the running container and then you can remove the docker
container.

8.docker rm -f nginx-2 : to force remove a running container

9.docker start <container id/container name> : to start the container which are in stopped state.

10.docker images: This command lists all images stored locally on the host.

11.docker tag: To Tag a existing image to a new name

docker tag nginx:latest kirangaggs1/kiran-dockerimage:1

docker tag <current-image:current-tag> <registry-url/reponame:tag-name>

12. docker login -u <docker hub username>: To login to docker account using CLI

Enter password:

13. docker push <registry-url>/<repo-name>:<tag>:1 - To push image into our docker repository

14. docker rmi <imageid/image-name>: To delete an image which is not in use with any container

To push an image from local to docker hub repo:

1. Create a private repo in hub.docker.com

2. Create a tag of the existing image using 11th command

3. Perform Docker login step (12th command)

4. Push the image using 13th command

These are some of the basic Docker commands for managing containers and images. There are many other Docker
commands and options that you can use for more advanced use cases, such as managing networks, volumes, and
configuration. However, these commands should give you a good starting point for using Docker for content
management.

EXPERIMENT NO.: 7. Develop a simple containerized application using Docker

AIM: Develop a simple containerized application using Docker

DESCRIPTION:

Here's an example of how you can develop a simple containerized application using Docker:

Prerequisite: The docker file and the index.html must be in the same location. Desktop preferably.
Steps:

1. Choose a simple application that you want to containerize.

Eg:- create index.html file on desktop

1. To create own docker image we need a dockerfile.

2. To create a Dockerfile open a editor of your choice.

3. Type the following in the editor like notepad

FROM nginx:latest [ a key word to set base image for the container]

RUN rm /usr/share/nginx/html/* [a key word to run a command inside the container]

COPY index.html /usr/share/nginx/html/index.html [ a keyword to copy file from local machine to container] Note:
The words in capital letters are referred to as key words.

1. Save the file with the name as “Dockerfile” and save the file without any extension on Desktop.

2. To rename the extension to Dockerfile :- mv .\Dockerfile.txt Dockerfile

3. Execute the following command in terminal to build a image out of the Dockerfile.

docker build -t <name-of-the-image> .

Note -1: .(dot) Means current directory

Note-2: as we are not mentioning any filename in the command, docker will search for a file named:Dokerfile and
build an image according to the instructions provided in that file.

1. Docker images

2. Now that the image is created, We can run the image to build a container out of it using the following
command: docker run -d -p 8081:80 --name <container-name> <image-name-built-in-last-step>

3. Now goto localhost:8081 - you need to get the updated index page.

This is a simple example of how you can use Docker to containerize an application. In a real-world scenario, you
would likely have more complex requirements, such as running multiple containers, managing network connections,
and persisting data. However, this example should give you a good starting point for using Docker to containerize
your applications

You might also like