NODE-TO-DO APPLICATION DEPLOYMENT Under build trigger option as GitHub hook trigger for GITScm polling
Step 1:--
I have selected a freestyle project under project description as "This job will deploy the node app on server automatically"
Then in the second step I have copied the GitHub URL details and pasted it in the Github URL section.
Now in the build trigger section I will select option as GitHub hook trigger for GITScm polling then below are the options. Here as i have already installed Github plugin so I am getting option as GitHub hook trigger for GITScm polling.
As i have selected the option named: GitHub hook trigger for GITscm polling in this process we need a connection between Github and the system for that I need a U.R.L that U.R.L is called Webhook. So when ever the developer commits the code in github the webhook will be triggered and connection between Github and Jenkins will be established.
Here in the Payload URL section I can see the Port URL details 8080. Means under Github will connect with the U.R.L(web hook) under port number 8080. So in the EC2 instance and under security group i will do edit inbound rules and then i have added port number 8080
So in the Web hook option under settings we will click the Add web hook option.
After some time when i click on the refresh option a Tick signal will come which shows Github webhook is active Which signifies Github and Webhook both are connected.
Now lets go the Build Steps option i will select Execute Shell option. The below command says it will stop any existing running containers, networks, volumes and images created and then it will create new containers .
the meaning of docker-compose up -d --no-deps --build web (web is the name of the service and --no-deps we can build the code again and again with out any dependency).
Now as soon as the developer has done some changes in the code it's automatically started polling from source and it's build has been triggered automatically. Here the code has been deployed automatically.
Subscribe to my newsletter
Read articles from Sidharth Dash directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Sidharth Dash
Sidharth Dash
Hello Team, Working Devops Support Engineer having 8.2 years of experience in Unix, Shell Scripting, SQL. Since one year i started my journey as a DevOps support engineer where i am involved in Deployments, Infrastructure monitoring using AWS- cloud-watch, Automating simple task using shell scripts.