Deploy app on Azure with Jenkins and Nginx

Let's create an Azure virtual machine first to run your application.

Now try to connect the created virtual machine
Path:- Virtual machine --> Select your machine --> Connect --> SSH using Azure CLI --> Click on connect

Step 1:- Update the system first using the below command "sudo apt update -y"

Step 2:- Clone the project from the GitHub repository

Step 3:- Now install Jenkins on the machine but before installing Jenkins you need to install Java. "sudo apt install default-jdk"

Java is successfully installed on the system.

Step 4:- For Jenkins installation use Linux Documents from where you will get commands.

curl -fsSL https://pkg.jenkins.io/debian-stable/jenkins.io-2023.key | sudo tee \
  /usr/share/keyrings/jenkins-keyring.asc > /dev/null
echo deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] \
  https://pkg.jenkins.io/debian-stable binary/ | sudo tee \
  /etc/apt/sources.list.d/jenkins.list > /dev/null
sudo apt-get update
sudo apt-get install jenkins

Jenkins installation is done.

Step 5:- Start the Jenkins service using the command "sudo systemctl start jenkins"

By default, Jenkins is working on port no 8080 but we configured the Jenkins service file and changed the port to 8050.
Let's open port no 8050 in the Azure security group.

Go to the location and try to change port no in Jenkins.service file

Successfully open 8050 port no.
Add the port in the "Add inbound port rule".
After this reload the daemon service and then restart the Jenkins service

Jenkins is up and running. To get the password go to the above listed path i,e.,
/var/lib/jenkins/secrets/initialAdminPassword

Job is triggered automatically.

Now install Nginx to push the changes to the Nginx.