Posts

Showing posts from January, 2023

How to push code from EC2 instance into a Github repository with Git bash

Image
  Pushing code changes from EC2 instance to GitHub using Git bash Let us see how to push a code change using Git bash or iTerm from Jenkins EC2 instance into GitHub. After configuring a freestyle job or pipeline using Jenkins for building and deployment, you would like to make a code change to make sure Jenkins have started automated builds/deployments. Pre-requistes: SSH keys set up and uploaded into GitHub. Connect to Jenkins EC2 instance using GitHub. Project setup already in GitHub Steps: 1. Login to Jenkins EC2 instance first. Make sure you are inside EC2 instance. 2. Type below command to see if you have already cloned your repository. ls -al you should see the repo name. once you see the repo name, cd into repo folder (If you don't see any GitHub Repo folder already cloned, you need to clone from GitHub by executing below command: git clone git@github.com:user_name/your_repo.git now go inside repo folder. 3. cd youreponame change repo_name per your name of the repo you creat

How to configure webhooks in GitHub to trigger jobs in Jenkins

Image
  A Webhook is a mechanism to automatically trigger the build of a Jenkins project in response to a commit pushed to a Git repository . Pre-Requistes: Make sure you install GitHub integration plug-in in Jenkins 1. Go to Jenkins, Create a job. If you already have a existing job, click on configure. Go to build triggers section and choose the below option - GitHub hook trigger for GitScm pooling. 2. Now go to GitHub, choose your repository. Click on settings, Webhooks. 3. Click on Add web hook. 4. You need to enter Jenkins URL & add /github-webhook/ in the end http://jenkins_public_dns_name:8080/github-webhook/ 5. Now enter payload URL as Jenkins URL, select just push event, click on active. Click on Add webhook 6. After you created, click on webhooks. 7. Click on recent deliveries and you should get response 200 as below: 8. Now go and make some code changes in your repo in GitHub. 9. If you look in Jenkins, you will see job is getting triggered immediately. You can watch these step

How to Setup Tomcat 9 on Ubuntu 18.0.4 in AWS EC2

Image
  How to Setup Tomcat 9 on Ubuntu 18.0.4 in AWS EC2 What is Tomcat?  Apache Tomcat is a free and open-source implementation of the Jakarta Servlet, Jakarta Expression Language, and WebSocket technologies. It provides a "pure Java" HTTP web server environment in which Java code can also run. Thus it is a Java web application server, although not a full JEE application server.  Pre-requistes: Create  brand new EC2 instance  first for setting up Tomcat.  Open  port 8080  in security firewall rules for EC2 instance in AWS YouTube Demo: >>>>>> Tomcat Installation  Follow the steps below to install Tomcat on your EC2 instance: Change VM Host Name to Tomcat sudo hostnamectl set-hostname Tomcat Update to Latest packages sudo apt update Install Tomcat9 sudo apt-get install tomcat9 tomcat9-docs tomcat9-admin -y Setting up tomcat admin app sudo cp -r /usr/share/tomcat9-admin/* /var/lib/tomcat9/webapps/ -v Setup tomcat user  You will need to edit  tomcat-users.xml to  a