Wednesday, March 15, 2023

Tomcat

Tomcat is an Open Source, Java based, Web Application Server.
We can deploy only the WAR files.
In the Tomcat Server we are not able to deploy EAR Files.
In Jboss / Wildfly we can be able to deploy WAR & EAR files.


Application Servers
Tomcat ---------------------------------> Apache
Jboss / Wildfly   ----------------------->RedHat---------> IBM

Webspere Application Server ----------------------------> IBM
Weblogic  -------------------------------> BEA------------> Oracle


Directory Structure
  • bin   
    • startup.sh
    • startup.bat
    • .
    • shutdown.sh
    • shutdown.bat
    • .
    • catalina.sh
    • catalina.bat
    • .
    • Version.sh
    • Version.bat
  • conf
    • Servers.xml
    • Tomcat-Users.xml
  • lib
    • jar files

  • webapps
    • What ever we are goint to store web application.
    • That application are stored in here.

  • work
    • After deploying out application.
    • Application it may generate some files those files are stored in here.

  • logs
    • Catalina.out

  • temp




ln -s /opt/apache-tomcat-10.1.7/bin/startup.sh /usr/bin/startTomcat
ln -s /opt/apache-tomcat-10.1.7/bin/shutdown.sh /usr/bin/stopTomcat






Maven

Maven is an Open Source, Java based build tool.
With help of this we can create packages /  build artifacts.

Maven is not a executable Software.
Maven is a Archive file.

  • Java ------------> Ant , Maven & Gradle
  • .Net -------------> Nant & MS Build
  • Python --------->  PyBuild
  • Ruby -------------> Rake
  • JS, Node JS, Angular -----------> Grunt, gulp
Types of application using Java:
  1. Java Standalone applicatoin 
    • Jar (Java Archive)
    • Java code ( .classfiles )
  2. Java Web application
    • War (Web Archive)
    • Java code  + Web content ( html , css , js , xml , images)
  3. Java Enterprise  application
    • Ear  ( Enterprice  Archive )
    • Java code  + Web content ( html , css , js , xml , images)  more then web content called.
Default build scritpt file:
  • Ant     --------> build.xml
  • Maven --------> pom.xml  (Package Object Model)------->3.6.3 Version
  • Gradle  - ------> build.gradle
Deirectory Structure:
  • bin --------> binaries  --------> mvn
  • conf -------> Settings.xml
  • lib ---------> liberaries --------> Jar files 
  • boot ------->
Read more »

Labels:

Friday, March 3, 2023

Shell_Scripting

Class:01

What is Shell ?
         Shell is a programm,
         It will take the commands and it will gives to the OS to perform the Commands.

         Shell is an interface b/w User and OS.

Types of Shells:
  • sh
  • bash
  • ksh
  • zsh
  • csh
How to know which shell is installed in our OS?
        /etc/shells
        cat /etc/shells
        
        By default Sh & Bash shells are installed in our OS.
        sh
        Bash

Which Shell we are using on our OS?
        echo $SHELL
        ps -p $$
        echo $0

How to change the Shell type?
        /bin/csh
        /bin/ksh
        /bin/sh
        /bin/bash

What is the default Shell Type in latest OS?
        bash

Bash Shell Scripting:
        A Shell is a file containing a series of commands.
        The Shell reads the file and carries out the commands as through  they have been entered directly                    on the command line.
        Normally the Shell Script has the file extension is (.sh).

Bash Shell Scripting--------Linux
PowerShell Scripting--------Windows   (DOS Commands).

Why we need to learn the Shell Scripting?
  • Automate the regular jobs.
  • Taking database backups.
  • Monotering Several Server resources like...
    • CPU Utilization 
    • Memory Utilization
  • Portable (It can be executed in any Unix-like OS without any modifications)
Server_Resource_Monitering.sh
Dbback.sh
Cleanup.sh
Deploy.sh

#!/bin/bash ---------->Shebang line
--
|
|
------->.Abslute path of  shell type

How to run the Shell Script?
  • ./hello.sh
  • . hello.sh
  • sh hello.sh
  • bash hello.sh
#!/bin/bash

echo "Welcome to the world.."
echo "Today date is:"
date

How to run the Shell Script in debug mode?
        sh  -x hello.sh              -------------------->-x ------>dubug mode

How to run the specfic debug in Shell Scripting?
set -x
echo "Welcome to the India.."
echo "Welcome to the USA.."
set +x

cat -n hello.sh
sh -x hello.sh

Class:02

Fine Naming Conventions:

Comments:
        Single Line Comment:  #
        Multi Line Comment:  <<Keyword


                                                                    Keyword
Variable:
        Variable is one storage location.
        where we can store the values.

Types of Variables
  1. System Defined Variables
    • How to see the System Defined variables?
      • env
      • printenv
      • printenv | cut -d "=" -f 1,2
        • SHELL
        • USER
        • PWD
        • HISTSIZE
      • echo $SHELL
      • echo ${SHELL}
  2. User Defined Variables

Class:03

Command Line Arguments:
      While executing the ShellScript, passing the values to the Shell Scripts is called Command line Arg.

echo $0 --------> Script file name

echo $1 --------> 1st arg value
echo $2 --------> 2nd arg value
echo $3 --------> 3rd arg value
echo $4 --------> 4th arg value
echo $5 --------> 5th arg value
echo $6 -------->
echo $7 -------->
echo $8 -------->
echo $9 -------->
echo ${10} ----->10th arg value

echo $* --------> Display all the arg Value --------> all arg into a one String
echo $@  -------> Display all the arg Value --------> each arg as a one string

echo $# --------> No.of Arguments.

echo $$ --------> Process ID.

echo $? --------> Previous command execution status.
                           0 = Sucellfull
                apart from 0 = failure

#!/bin/bash
echo "Commnad Line Argument demo..."
if [ $# -eq 2 ];
  then
    echo $0

    echo $1
    echo $2

    echo $$
    echo $?
    echo $#
  else
  echo "Please pass minume 2 Arguments."
  echo "Usage: sh $0 arg1 arg2 "
fi

String:

        String is a group of charactors  enclosed in a singe or double quotes. 
string_value="Hi Team My Name is ReddySekhar, I am working in IBM in Mumbai Location..."

Sub-String:

      Some poration of value in the  original String.

substring = 
echo ${string_value:20} ---> ReddySekhar, I am working in IBM in Mumbai Location...

echo ${string_value:20:11} ----------> ReddySekhar

echo ${string_value: -10} ------------> Location..
echo ${string_value: (-10)} ------------> Location..

Arithmetic Operations:

  • expr 2 + 3
  • expr 2 - 3
  • expr 2 * 3 -------------------expr 2 \ * 3
  • expr 10 / 2
  • expr 30 % 3
Write a ShellScript, accept the 2 numbers from the user, and perform the arthmetic Operations?

Class:04

Read Command:

echo "Please enter your name"
read UserName

echo "The User name is:"$UserName

What is an Array?
        
Inputs and Outputs Redirections Symbols:

>    ------>  Redirect Standard O/P
>>  ------>  Appending the Standard O/P
<    ------>  Redirect Standard I/P

How to store Std I/P & Std O/P?

sh filename.sh 1 2 >  filename.log ------------>it's redirect Std O/P only
sh filename.sh 1 2 >  filename.log 2>&1

File Descriptors:

Class:05

Class:06


Labels:

Friday, February 24, 2023

Terraform By Udemy

Labels:

Wednesday, February 8, 2023

Shell_Script


Class:001

10.1.0.0/16

10.1.1.0/24
10.1.2.0/24
10.1.3.0/24

 Shell Scripting :-

    **  Relative Path :    cat ../../../root/file1   (or)  ~/file1
          Absolute Path :   cat /root/file1

Class:002

nano myscript.sh && chmod 700 myscript.sh--------It will create a file with permissions.
                    cat myscript.sh | bash
                    ./myscript.sh
crul www.goolge.com
Check URL

curl get.docker.com | bash && docker version

ls-al
ls-al | grep -i snap
cat /etc/passwd | cut -d ":" -f 1 -----------------it will display only name

Variables:-

A=10
B=20
C=30

echo $A
echo ${B}
"echo ${C}"

name = 'Reddy Sekhar'              (Strings)
                         Reddy Sekhar

How to display multiple line in one cotaction ?






Class:013


Class:001


Class:001


Class:001

Class:001

Class:001

Class:001

Class:001

Class:001

Class:001


Class:001



Class:001


Class:001

Class:001

Class:001


Class:001

Class:001






Labels:

Monday, November 28, 2022

Maven

 

  • Maven is an OS, Java Based, Build tool.
  • Maven is going to support only "Java Projects".
  • To create Packages/ Build Artifacts we will use Maven.
    • Java--------->  Ant, Maven, Gradle
    • .Net ---------> Nant, MS-Build
    • Python------> PYBuilder
    • Puby--------> Rake
    • JS, Node JS, Angular-------> Grunt, Gulp 
1. How to know which version we are using?

        cat /etc/release                     (Latest version is ---11)

Types of Applications in Java:
  • Java Standalone apps
      • Jar------Java Archive
      • Java Code
      • .Class-files
  • Java Web apps
      • War------Web Archive
      • War = Jar + Web content ------(Html,CSS,js,XML,HTMLImage)
  • Java Enterprise Apps
      • Ear------Enterprise Archive
      • Ear =  Jar + 1 War
Default Build Script File Name

        Pom.xml -------------------- Package Object Model

<project>

<groupId>         com.Company_Name      </groupId>
<artifactId>       Project_Name                 </artifactId>
<packaging>     jar                                   </packaging>
<version>         0.0.1-SNAPSHOT        </version>
</project>

        
2. Is it possible to change the Pom.xml file name?
    Yes 
    Maybe didn't we can give it. I didn't try it
  • Along with the Source Code Developer will prepare Build Script also.
Directory Structure:
  • Bin:      binaries--mvn   
  • Conf:    Settings.xml
  • Lib:       libraries---java files
  • Boot:
Installation:
  • Java 8 -----Java 1.8
  • java -version
  • mvn -version
Maven Repositories:
  • Maven Local Repo
    • C:\Users\Reddy Shekar\.m2\repository------------Windows
    • /home/ReddySekhar/.m2/repository----------------Linux
  • Maven Central Repo
    • it will be by the Maven community team.
Remote Repo
    • It will be used within the organization
3. Is there any chance of changing the default path to a custom one?
      
    Yes Can change that custom path
  • Setting.xml
    • LocalRepository <Tag>

 Maven life Cycles:

life Cycles              Goals

Clean----------------It will delete the previous build files.
Site------------------To generate a document for your source code.
Default-------------
  • Validate------------It will validate your project Structure and resource files.
  • Compile-----------It will compile your source code.
  • Test----------------It will use to run Junit Test cases.
  • Package-----------It will create packages / Build Artifacts.
  • Install-------------It will store your build Build Artifacts in a local Repo.
  • Deploy-----------It will store your build Build Artifacts in a Remote Repo.
4. What is the difference between the Maven Local Repo & Remote Repo?
  • Install-------------It will store your build Build Artifacts in a local Repo.
  • Deploy-----------It will store your build Build Artifacts in a Remote Repo.
5. How to skip the Test cases?
    
    



Thursday, November 17, 2022

AWS--Sree

 

 AWS
=========================================================================

Class:01

Introduction

Class:02

North Virginia  (Zone US-EAST-1)--------------> 6 Availability 

mslookup www.paytm.com

IP addressing:-

IPV4------------>32 Bit size----------------192.168.33.1 *************

IPV6------------>128 Bit Size---------------fe80::314f:50bb:42fa:743a%5


0.0.0.0 to 255.255.255.255------------------------>R F C 1918


  • Class A        1.0.0.1        to    126.255.255.254            {Public IP's}-----Hallticket No: ABCD1234
  •                     10.0.0.0      to    10.255.255.255              {Private IP's}----Roll no:56      
  • Class B       128.1.0.1     to    191.255.255.254
  • Class C       192.0.1.1     to   223.255.254.254
  • Class D       Reserved
  • Class E       Reserved


NAT:- (Network Address Translation)

  • Private IP is not internet routable,
  • To route to the internet, we are going to use a device called a Gateway router,
  • Which will convert Private IP addresses to public IPs wise versa, called Network Address Translation (NAT).
Read more »

Thursday, November 10, 2022

Youtube

 GIT

001. What is git reset? types of git reset?

002. How to delete the local branch & remote branch in git?
  • Local branch:  git branch -D <bn>
  • Remote branch: git push origin --delete <bn>
003. Difference between git diff and git status?
  • git diff: 
  • git status:
004. What are hooks in git?
  • Hooks are special scripts
  • it will be execute before or after a certain commands
005. What is the importance .git directory?
  • branch
  • config
  • hooks
  • info
  • logs
  • HEAD
  • Objects
006. What are the branches, and differences between remote and local branches?
007. What Branching strategy that you are familiar with?
  • Master (or) main
  • Development
  • Feature/01
  • Feature/02
  • Creata a PR
  • qa
  • dev
  • pre-pord
  • master-main
  • tag
008. What is PR (Pull Request)? What's the importance of PR?
009. Which version of git you have used? 
  • git version
  • git version 2.17.1
011. What is git squash?
git merge --squash <bn>
012. Command to list all commits?
     git log
git log --oneline




Linux & Shell Script:

001. Command to find empty files in a given directory ?
    find . -empty
002. Commands you will use it for configuring ssh connectivity between 2 machines and what files                 will  be  present in .ssh folder ?
  • First we need to private key & public key to connect
  • ssh-keygen
  • ~/.ssh
  • id_rsa-------id_rsa.pub----know_hosts----authorised_key
003. How to schedule a shell script in unix machine?
Crontab
004. Command to get load average?
    top
005. Need to identify IP Address in log file and count IP addresses in log file ?
  • git clone git@github.com:Sundupalli/Unix_and_shell-Deekshith.git  
  • grep -E -o "([0-9]{1,3}[.]){3}[0-9]{1,3}" logfile | sort | uniq -c | sort -nr
006. What is command for checking the running process? how to get PID of process?
  • ps
  • ps -eaf
007. Command to get whether certain port is listing or not?
netstat -tunlap
008. How to identify the number of parameters that has been sent to shell script?
vi test.sh
sh test.sh
sh test.sh 3 4 6 
vi sh test.sh 3 4 6 7
echo "Hello world"
echo "The number of parameters $#"
ans:-  Hello world
The number of parameters 4
009. Command to delete empty line in a file?  
  • sed '/^$/d' test.sh
  • sed -i '/^$/d' test.sh
010. What is exit status?
echo $?
011. Given machine, how will you identify which machine it is?
uname -a

Shell Scripting By Udemy

 echo $SHELL   

chsh -s /bin/bash

Class 02 [ Shells vs Scripts ]

  • What is the Bash shell is 
    •  A "Program" that "interprets" the commands you type in your terminal and "passes" them on to the "Operating System".

    • BASH = Bourne Again Shell
    • Based on the Bourne Shell (sh), Created by Stephen Bourne in 1979.
    • its feature-rich.
    • Its fast
    • Its very common.
  • The difference between shell and scripts
    • A Shell script is a file containing commands for the shell.
    • A Bash script is simply a file containing commands for the Bash shell.
  • Why Bash is more popular
  • Why Scripting is a useful skill to learn...
Questions
  1. What is a bash script?
    1. A Bash script contains a list of commands specifically for the Bash shell.
  2. A shell is a program that interprets commands and passes them on to the operating system?
    1. True
  3. A benefit of bash is that it has a lot of features
    1. True
  4. Why should you write a script?
    1. The main benefits of writing scripts is to help you automate tasks and save you time
Class 03 [ Bash Script Structure - Part 1 - Core Components ]
  • file <File_name>
    • #!/bin/bash----------------------------------------------> Shebang line
    • #!/usr/bin/python3
    • Exit Statement  ( 0 = Sucessfull ; 1-255 = Unsucessfull )

  • #!/bin/bash
  • echo "This is my first Script"
  • exit 0
after that, we need to check the permission of the particular file.
ls
give permission to the file
chmod +x <File_name>
run the file
./<File_name>

Class 04 [ Bash Script Structure - Part 2 - Professional Components ]

 Comments:
   Single line Comments -----------#
   Double line Comments----------

# Author: Y Reddy Sekhar
# Date Created: 10-11-2022
# Last Modified: 10-11-2022

# Description 
# Prints "This is my first script" to the terminal

# Usage
# Provide file name here...

Class 05 [ Setting up Secure Script Permissions ]
  • The basics of file permissions
  • Setting file permission on your script
ls-l
chmod 744 <File_name>
chmod 777 <File_name>

Class 06 [ Project: Backup Script ]
File downloaded on your personal computer go and see it...

 

Class 07 [ Backup Script - Project Solution ]
                    While doing practice watch again.

Class 08 [ Adding scripts to your PATH ]
  • What is the PATH Variable?
  • How to add directories to your PATH Variable
echo "$PATH"

Class 09 [ Section Summary ]
        Document downloaded


 










    Labels:

    Wednesday, August 24, 2022

    DevOps - Interview Questions & Answer

    Git

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

    1. Command to find empty files in a given directory ?
    • find . -empty 
    1. Commands you will use it for configuring ssh connectivity between 2 machines and what files will be present in .ssh folder ?
      • First we need to private key & public key to connect
      • ssh-keygen
      • ~/.ssh
      • id_rsa-------id_rsa.pub----know_hosts----authorised_key
    1. How to schedule a shell script in unix machine?
      • Crontab
    1. Command to get load average?
    2. Why we need git? What makes git unique from other tools like SVN?
    1. Let's say i have maven repo cloned on to my local, did some changes and i have build the code now target folder will be generated. So now when i do git operations like git add, git commit or any other git operations target folder should not be considered, how would you achieve the same?
    2. difference between git pull and git fetch?
    3. How to clone specific branch in git?
    4. Lets say your organization has github and bitbucket to store code, you have cloned a repo onto your local and changed directory name. after some days one of your team members asks you to share clone link, how would you provide the same?
    5. I have shell script to delete particular dependency ( repo is maven project ). before running the script i need to clone repo to my local, here point to note i should only clone master branch and only last commit ( last commit has all the code ) how would you do this?
    6. what is submodule and why we need submodule?
    7. Lets say you have changed 5 files a,b,c,d and e in a repo and you did git add ., now all the files are in staging area, now i decided not to commit file d. how would delete it from staging area?
    8. What is git-cherry-pick? why we use it?
    9. Let’s say you’re working on new feature in some branch, now your manager says stop working on that and change few other things on old code. Here after changing the old code, I need to work on new code, so I need to place my new changes some place How would handle this scenario?
    10. What is a conflict in git?
    11. command to list all branches in a repo?
    12. What is git reset ? Types of reset ?
    13. How to delete local branch and remote branch in git ?
    14. Difference between git diff and git status ?
    15. What are hooks in git?
    16. what is the importance .git directory?
    17. what are the branches, diff between remote and local branches?
    18. what Branching strategy that you are familier with?
    19. What PR (Pull request) is? whats the importance of PR?
    20. Which version of git you have used?
    21. Difference between git merge and git rebase?
    22. What is git squash?
    23. Branching strategy used in your project?
    24. Command to list all commits?
    25. Branching strategy?
    26. Need a script which identify inactive branches ( no commits since 2 months )?
    27. How to set configs globally in git?



    Maven
    ========================w  
    when i issue mvn install what all things happen in background?
    1. what are the settings you need to do before running mvn deploy?
    2. why maven takes much time for 1st execution and from 2nd execution it will take less time?
    1. what is multi module project in maven and what are the setting you want to do in multi module parent and child project? what is dependency management?
    2. what is transitive dependency?
    3. .m2 is local repository for maven, now I don’t want to use .m2 folder as my local repository I want to use some other folder as my local, is it possible in maven? If yes, how would you do that?
    4. mvn install -Dmaven.repo.local=/alternate/repo/location 
      
      1. maven follows convention over configuration that means it assumes code should be there under src/main/java, test cases under src/tests and many more.Here my requirement is I don’t want to follow that conventions I need to use different folder structure is that possible in maven?
      mvn help:effective-pom -Doutput=pom_eff.xml
      
      1. What are dependency and plugin in maven? Give one example for each?
      2. What are 3 build life cycles in maven?
      3. In Which tag we will mention output artifact type( like jar, war or any other)?
      4. What are things you need to set, if you want download dependency from private repository ?
      5. What are the issues you faced while working on maven projects?
      6. Command to skip the test cases in maven
      7. what is multi module project?
      8. what is the importance of dependency managment?
      9. what are the settings that you need to do for mvn deploy ( to push artifcats to repository )?
      10. mvn version that you have used?
      11. Tell me 3 build lifecycle in maven? What does mvn site does?
      12. Is there way by which we can set local repository as some other custom directory, other than .m2?
      13. Settings that you make for mvn deploy?
      14. What is the default value of packaging tag? What other values for other artifact types?
      15. What are GAV's?
      16. what are the tags that you came across in pom.xml?
      17. Explain maven life cycle?


    Jenkins
    ========================


    1. How to save only last 5 builds of jenkins job?
    2. Have you worked on Jenknsfile? can we use docker container as a node in Jenkinsfile? Who will handle docker container creation and deletion? If i am building a maven project always docker container is fresh instance it will try to download dependency from repository, what measures you will take to reduce build time?
    3. Why we need multi branch pipeline?
    4. If you forget Jenkins password, how would you login back?
    5. Have you worked on commit based job in jenkins? what settings you need to do in jenkins and github to setup commit based job?
    6. you want to create 50 freestyle jobs with same configurations, but only change is job name. how would you achieve the same?
    7. How can you copy job from your local jenkins instance to other local jenkins instance?
    8. How to Downgrade plugins in Jenkins?
    9. Have you worked on Jenkinsfile? Can we use different nodes for each stage?
    10. Can you list few ways by which we can trigger our build in Jenkins? What is the difference between Build Periodically and Poll SCM?
    11. How to set Jenkins build to fail based specific word in console output ?
    12. What are active and reactive parameters (Dynamic parameterization) in Jenkins ?
    13. How to customize the build number display to something else in Jenkins job page?
    14. What are multi branch pipeline?
    15. What is shared library in Jenkins ?
    16. what is the need of CICD tools?
    17. What type of Jenkinsfile you have worked on?
    18. In master slave setup if I want run job on specific node is is possible?
    19. what is the importance of Jenkins secrets?
    20. What are types jobs you have worked on??
    21. Can we have job for pr and once merge is done the source branch should be deleted?
    22. How do you take Jenkins backup?
    23. Can you tell me importance of post block??
    24. list of best practices to follow while writing Jenkins pipeline?
    25. Is it possible to run each stage on different agaent?
    26. Is it possible to change success or error message that we see in console ouput ?
    27. Have list of command that has to executed in certain directory in the code, is it possible to do the same?
    28. Can we have versioning on Jenkins freestyle job?


    Docker
    ========================
    1. Any 3 best practices of docker?
    2. Difference between docker stop and docker kill?
    3. Command to list conatiners which state is exited?
    4. command to clean-up docker host ( deleting stopped conatiners, dangling images and unused networks)?
    5. What version of docker you have used? Specific reason to use that particular version?
    6. Can we have multiple CMD in Dockerfile?
    7. Have you worked on docker swarm and docker compose?
    8. Have you worked on multi-stage dockerfile and why we need that?
    9. Lets say i have container which is attached with a volume, if container crashes what happens to volume?
    10. can you copy a file form local to run container?
    11. Lets say I have 1 GB file that has to be sent to docker daemon, as its 1GB it will take muchtime and network too. By which option while building dockerfile we can send the fileIn better manner?
    12. What is the difference between ADD and COPY docker instructions in Dockerfile?
    13. Command to remove to stopped and running Containers?
    14. Inside the container I did many changes like Creating, modifying and deleting file but I Wanted to check which files has been changed And what action has been taken what is the Command we need to use ?
    15. What does ONBUILD instruction do in Dockerfile?
    16. What is the use of .dockerignore file?
    17. I have dockerfile that accepts arguments, if I supply value as “1” then it should use maven 2.x version for base image and if I supply “2” then it should take maven latest as base image
    18. What are docker compose and docker swarm?
    19. How to configure docker private registry?
    20. Types of network in docker? if you dont specify network to deploy on which network the conatiner will be created?
    21. Explain a sample dockerfile that you have used in your project?
    22. Can we launch linux conatiners windows and viceversa?
    23. Why we need docker compose and docker swarm
    24. What's the difference between docker volume and docker mounting
    25. What is the importance of .dockerigonre file, can name docker file with any other name?
    26. I need to delete all stopped containers and unused images command for that?
    27. How do you monitor docker in production
    28. Is it good to use docker compose in production



    Kubernetes
    ========================