Code Monkey home page Code Monkey logo

ci-cd-pipeline's Introduction

Create ec2 node for jenkins server select amazon linux machine

===============================Jenkins Installation==================================

To change hostname

  • $ hostname JENKINS-SERVER
  • $ cd /etc
  • $ vi hostname

Add 8080 port in security group to run jenkins

===============================Install and Configure Maven==================================

M2=/opt/maven/bin
JAVA_HOME=/usr/lib/jvm/java-11-openjdk-11.0.19.0.7-1.amzn2.0.1.x86_64
PATH=$PATH:$HOME/bin:$JAVA_HOME:$M2_HOME:$M2
  • $ echo $PATH
  • $ source .bash_profile
  • $ echo $PATH
  • $ mvn -v
  • // In jenkins GUI
  • // Install Maven integration plugin
  • // Go to tools
  • // under JDK
  • // Name -java11
  • Java Path -- /usr/lib/jvm/java-11-openjdk-11.0.19.0.7-1.amzn2.0.1.x86_64
  • // under maven
  • MAVEN_HOME:/opt/maven //You need to add this at Jenkins Job under Maven Installations
  • // Enable github plugin
  • // Restart jenkins
  • // Now go ec2 machine
  • $ yum install git
  • // Create new item - test-maven-project
  • // Select source code as git
  • // branch main
  • // under root POM
  • clean install
  • // Click build now

====================================Create Tomcat Server========================================

Create new ec2 , amazon linux-2 HVM

  • Add port 8080 for tomcat server in the security group
  • $ sudo su
  • $ cd ~
  • $ sudo amazon-linux-extras install java-openjdk11 -y
  • $ wget copy tar gz link from tomcat downloads
  • $ tar -xzvf file.tar.gz
  • $ mv source tomcat
  • $ cd bin

to start tomcat

  • $ ./startup.sh
  • $ cd ..
  • $ find / -name context.xml
  • vim to hostmanager file

Comment that part and in the manager file comment similarly

  • $ cd /bin
  • $ ./shutdown.sh
  • $ ./startup.sh
  • $ cd ..
  • $ cd conf/
  • $ vim tomcat-users.xml

Shift + G (go to end of the file)

  • replace this with the last
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="admin" password="admin" roles="manager-gui,manager-script,manager-jmx,manager-status" />
<user username="deployer" password="deployer" roles="manager-script" />
<user username="tomcat" password="s3cret" roles="manager-gui" />
  • $ cd ..
  • $ cd /bin
  • $ ./shutdown.sh
  • $ ./startup.sh

In tomcat ip in browser

  • Go to Manager APP

  • Integrate tomcat with Jenkins

  • Go to jenkins GUI and install plugin - deploy to container

  • Add credentials of tomcat server to jenkins

  • Go to credentials

  • Add credential

  • Username - deployer

  • give pass and desc

Create a new Job build and deply to tomcat

  • Give git repo
  • under POM clean install
  • Under post build actions deploy war container **/*.war
  • Under container add tomcat 8x credentials tomcat credentials
  • Provide url of tomcat server

===============================Install and Configure Docker Host==================================

Create new ec2 instance ubuntu

  • $ sudo apt update && sudo apt-get update
  • $ sudo apt install docker.io
  • $ sudo usermod -aG docker ubuntu (Give complete access to username ubuntu)
  • $ sudo nano /etc/hostname
  • $ sudo init 6 (restart the server)
  • $ chown -R ubuntu:ubuntu /opt-
  • $ chown -R ubuntu:ubuntu /opt/Docker
  • $ cd /opt/Docker
  • $ nano Dockerfile //Below is the content of Dockerfile
RUN cp -R /usr/local/tomcat/webapps.dist/* /usr/local/tomcat/webapps
COPY ./*.war /usr/local/tomcat/webapps
  • $ docker build -t webapp:v1 .
  • $ docker stop registerapp
  • $ docker rm registerapp
  • $ docker run -d --name registerapp -p 8086:8080 webapp:v1

ci-cd-pipeline's People

Contributors

ritish134 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.