Let's make a beautiful CI/CD Pipeline for your Node JS Application
Task-01
1)Fork this repository:
2)Create a connection to your Jenkins job and your GitHub Repository via GitHub Integration.
Generate the SSH keys for integrating your Jenkins project with your git repository. Use ssh-keygen command to create public and private key.
Configuring GitHub:
1)Go to your GitHub account settings.
2)Go to SSH and GPG keys, Add public key that we created using ssh-keygen and select key-type Authentication key.
cat id_rsa.pub
Thus with above command you will get Public key and add this public key in “Key” Section of “SSH & GPG Keys”
For GitHub-Webhook:
Webhooks provide a way for notifications to be delivered to an external web server whenever certain actions occur on a repository or organization.
1)Go to your GitHub repository and click on Settings.
2)Click on Webhooks and then click on Add webhook.
3)In the ‘Payload URL’ field, paste your Jenkins environment URL. At the end of this URL add /github-webhook/. In the ‘Content type’ select: ‘application/json’ and leave the ‘Secret’ field empty.
For Installing GitHub Integration plugin in Jenkins
1)Open your jenkins dashboard.
2)Click on the Manage Jenkins button on your Jenkins dashboard
3)Click on Manage Plugins
4)Install GitHub Integration plugin
Configuring Jenkins:
1)Create a jenkins job
2)Creating a new Freestyle Project for node.js application
3)Select the GitHub project URL write your project GitHub URL
4)Select the “Git” and provide the below credentials
Click on ADD and for the “kind” label select from the drop down list for
5)Add private key which we created using ssh-keygen command.
Provide Unique ID, Description and then paste the “Private key “ at last as “Paraphrase” and click on ADD
6)Click on the ‘Build Triggers’ tab and then on the ‘GitHub hook trigger for GITScm polling’.
Once the connection between the Jenkins server and Github is successful a green tick as highlighted below will be shown.
Task-02
1)In the Execute shell run the application using Docker compose
2)You will have to make a Docker Compose file for this Project
3)After build you can check console output.
Set the inbound rule on AWS and access the app at “public-ip:8000”
Thank you for reading!! I hope you find this article helpful!!
Happy Learning!!
Sayali✨