What can Jenkins do ?

  • When you commit a code to a branch your code gets automatically deployed on an Environment
  • Can be used on production to do back and perform maintenance activity as well as renewing certificates
  • Can perform compilation
  • Code Validation
    • Sonar
    • Execute TestCases
    • Performance Testing
  • Pipeline
  • Continuous Integration
  • Continuous Delivery

Install apache derby

Steps to install apache derby on ubuntu :

Get the download link of apache derby on below URL :

http://db.apache.org/derby/derby_downloads.html

Download the apache derby for your version of java

wget http://apachemirror.wuchna.com//db/derby/db-derby-10.14.2.0/db-derby-10.14.2.0-bin.tar.gz -P ~/Downloads/

Unzip it to the /opt directory

sudo tar -C /opt/ -zxvf ~/Downloads/db-derby-10.14.2.0-bin.tar.gz

Add below lines to your ~/.profile or ~/.bashrc (Adding derby to path variable)

export DERBY_HOME=/opt/db-derby-10.14.2.0
export PATH=${GRADLE_HOME}/bin:${DERBY_HOME}/bin:${PATH}

Now reload the bashrc and start the apache derby server using startNetworkServer command

source ~/.bashrc
sudo /opt/db-derby-10.14.2.0/bin/startNetworkServer
#execute with sudo since it need many access

Run the command sysinfo to get all the details about apache derby

sysinfo

Connecting to the server via IJ tool and creating a database

About Apache Derby

  • What is Apache Derby
    • Apache Derby is an open source relational database implemented in java
    • It uses SQL standard
  • Why and when to choose Apache Derby
    • It has a small footprint of 3.5 mb for base engine and embeded JDBC driver
    • Supports Embeded Derby as well as Client and Network Server.
    • Easy to deploy install and use.
    • The on-disk database format used by Derby is portable and platform-independent.
    • Standard base : Derby adheres to database standards such as JDBC and the ANSI/ISO SQL specification. This means that Derby provides modern relational database functionality, including SQL syntax, transaction management, concurrency, triggers, and online backups. It also means that developers can migrate easily to other databases later on.
    • Secure : Derby provides secure data management appropriate to the environment where the engine runs. While traditional enterprise database systems rely on machines being physically isolated in a locked room, Derby databases often reside on unprotected laptops and other unattended hardware.
  • What is Embedded Derby ?
    • When an application accesses a Derby database using the Embedded Derby JDBC driver, the Derby engine does not run in a separate process, and there are no separate database processes to start up and shut down. Instead, the Derby database engine runs inside the same Java Virtual Machine (JVM) as the application. So, Derby becomes part of the application just like any other jar file that the application uses. 
  • Derby Network Server Architecture
  • What is an IJ Server ?
    • a tool that allows SQL scripts to be executed against any JDBC database, including non-Derby databases.
    • ij is an interactive SQL scripting tool that comes with Derby. It can be used with the Derby Embedded JDBC driver or with a client JDBC driver, such as the Derby Network Client.
  • What is a dblook tool?
    • a schema extraction tool for a Derby database.
  • What is a sysinfo tool?
    • a utility to display version numbers and class path
  • What is Derby Engine?
    • There are four main code areas: JDBC, SQL, Store and Services.
  • What is Derby Network Client ?
    • The Derby network server provides traditional client/server access to the Derby engine. The network server lets clients connect over TCP/IP using a subset of the DRDA protocol. The network server supports connections from networked JDBC, ODBC/CLI, Perl, and PHP clients.

NetCat ncat or nc

Note : ncat is a utility of nmap that has implemented the netcat utility into it

https://nmap.org/ncat/

Uninstall NetCat (Remove preinstall netcat since it does not have -e option)

sudo apt-get remove --purge netcat-openbsd

Install ncat

sudo apt-get install nmap

Test the nmap and ncat using -v

Check Port Opening using ncat

nc -zv <ip> <port>

z : sets nc to simply scan for listening daemons, without actually sending any data to them.
v : enables verbose mode.

Open a port for listening


Execute a command on remote


Connect to machine via shell


Port Scanning

Create a chat or a web server

Verbose Scan with ncat command

Read Me :

https://www.linuxtechi.com/nc-ncat-command-examples-linux-systems/
https://www.varonis.com/blog/netcat-commands/

Notes for Maven

====Eclipse======
Maven Clean

Run as -> Maven Build – clean (mvn clean) -. Deletes traget dir

Maven Build… – compile (mvn compile) – Creates class files

Maven Build… – test-compile

Maven Build… – test

Maven Install -> creates jar

Maven Build… – install (jar or war will be created)

======mvn cmd========
mvn clean
mvn compile
mvn test-compile
mvn test
mvn install -> jar file

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

Maven Build cycle (command)

validate
compile (validate, compile)
test (validate, compile)
package
integration-test
verify
install (validate, compile, test, package, integration-test,verify,install)

deploy (all the above)

clean

top Command

Top Command

by pressing :

  • 1 you will see no of cpu cores and their status
    • %CPU0 :
    • us – cpu used by user process
    • sy – system process
    • ni – show the process which has been given priority
    • id – idle time of CPU
    • wa – waiting for IO operation
    • hi – hardware interrupt like ctrl+C to stop a process which is utilizing cpu process
    • si – system interrupts
    • st – (steal time)amount of time consumed by your virtual machines hypervisor
  • M (in caps) you will sort by memory the top table
  • m – you will shot the memory is progress bar
  • P – (in caps) sort by cpu utilization
  • u – (type the user name) – to see the processes of that perticular user
  • c – command line argument of that process
  • z – it will become colorfull

In the table of top

  • PR – means priority
  • NI – Nice value(Priority that is set to that process)
  • VIR – Virtual Memory
  • RES – reserved memory (This cannot be swapped for other process)
  • SHR – Shared resources of that process
  • S – Status (R – Running in CPU, S – Sleeping

cat /proc/loadavg //when cpu utilization is high since top is heavy (w command also works)
0.41 0.65 0.65 4/813 5416
how to check loadavg?
1st section 1 min load avg
2nd section 5 min load avg
3rd section 15 min load avg

if load avg is like
20 10 5
This means your load avg is increasing and you need to worry
if load avg is like
5 19 15
This means your load avg is decreasing and you need not worry

Install and Setup Maven

Prerequisite for Maven :

  • Make sure JDK is installed
  • Make sure JAVA_HOME path variable is set

How to install Maven? (Windows)

  • Download the zip from Apache web site
  • Extract it into a directory
  • Set M2_HOME and MAVEN_HOME for the install directory
  • Set the bin folder of installed directory in path variable

Follow the steps below to install on ubuntu :

https://www.heapwizard.com/install-java-and-maven/

User/System variable for Maven

  • Add both M2_HOME and MAVEN_HOME variables in the environment variable and point it to the maven directory.

Check maven version with below command :

mvn -version

What is Maven?

  • Maven is a build tool
    • Compile Source Code
    • Copy Resource
    • Compile and Run Tests
    • Package Project
    • Deploy Project
    • Clean up

Why Maven came to be ?

  • Developers wanted a standard way of building project
  • A clear definition of what project consists of
  • Easy way to publish jar information and a way to share JARs accross several projects
  • The result is a tool that can now be used for building and managing any Java bases Projects which is called Maven

What is POM ?

  • A fundamental unit of work in Maven, POM is an XML file that contains information about project and configuration details used by Maven to build the project.
  • POM stands for Project Object Model
    • Describes a project
    • Name and Version, Artifact Type, Source Code Location, Dependencies
    • Plugins
    • Profiles (Alternate build configuration)
    • Uses XML by Default
    • Not the way Ant uses XML

Maven Objectives :

  • Making the build process easy.
  • Providing a uniform build system.
  • Providing a quality project information
  • Providing guidelines for best practices for development
  • Allowing transparent migration to new features