Project 1: Notes App
Prerequisites โ
EC2 instance ๐ฅ๏ธ
GitHub ๐
Docker ๐ณ
Docker Hub ๐
Jenkins ๐
Steps Included:
๐ ๏ธ Configuration Steps:
Create EC2 Instance:
- Set up a new EC2 instance on AWS.๐ฅ๏ธ
SSH Connection:
- Connect to your EC2 instance using SSH.๐
Update Instance:
- Ensure your instance is up to date with the latest updates.๐
Docker Installation:
- Install Docker on your EC2 instance.๐ณ
User Addition to Docker Group:
- Add your user to the Docker group for seamless Docker access.๐ฅ
Java Installation:
- Install Java on your EC2 instance.โ
Jenkins Installation:
- Install Jenkins on your EC2 instance.๐
Jenkins User to Docker Group:
- Grant Jenkins user access to the Docker group.๐ฉโ๐ป๐ณ
Reboot Instance:
- Reboot your EC2 instance for changes to take effect.โป๏ธ
Inbound Rules Configuration:
- Edit inbound rules to allow access to Jenkins on port 8080.๐ช
Jenkins Setup:
- Finally, configure and set up Jenkins for your continuous integration needs.๐ ๏ธ
๐Pipeline Creation Steps:
New Pipeline Setup:
- Initiate the creation of a new pipeline.
GitHub Project Selection:
- Opt for the 'GitHub Project' option and input the GitHub URL for your project.๐
Pipeline Script Configuration:
- Choose 'Pipeline Script' as the script option.๐
Groovy Scripting:
Use Groovy script to:
Clone the code from the specified GitHub repository.
Build a Docker image from the cloned code.
Docker Hub Account Creation:
- Create an account on Docker Hub.๐
Credentials Setup:
In Jenkins, navigate to 'Manage Jenkins' -> 'Credentials' -> 'System' -> 'Global Credentials' -> 'Add'.
Add Docker Hub credentials using environment variables.๐
Dockerhub Credentials in Code:
- Use the 'withCredentials' Groovy syntax to provide Docker Hub login credentials within the pipeline code.๐
Image Retagging:
- Retag the previously built image using the 'docker tag' command.๐ท๏ธ
Dockerhub Login:
- Incorporate the script to log in to Docker Hub using the specified credentials.๐
Image Push to Dockerhub:
- Push the latest image to Docker Hub using the 'docker push' command.๐ข
These steps collectively configure a comprehensive pipeline, from code cloning to Docker image pushing, including Docker Hub integration. ๐๐ณ
๐ข Docker-Compose Deployment and Automated Build Configuration:
Docker-Compose Integration:
- Enhance pipeline robustness by deploying through Docker-Compose. Install Docker-Compose on the instance.๐ณ
Security Configuration:
- Edit inbound rules in security, adding port 8000 for improved access. Verify the application in the browser.๐ช
GitHub Repository Integration:
- Optimize code retrieval by adding a Jenkinsfile to the GitHub repository, containing pipeline code.๐
Pipeline Configuration:
Choose the 'Pipeline from SCM' option in Jenkins.
Provide the GitHub repository URL, specify the branch, and mention the Jenkinsfile path. Save the configuration.๐
Automated Declarative Checkout:
- Trigger builds with Declarative Checkout SCM by simply clicking 'Build.' The Jenkinsfile in the repository automates the process of code retrieval.๐ค
Webhook Setup in GitHub:
In GitHub repository settings, add a webhook for automation.
In Jenkins, go to 'Configure' -> 'Build Triggers' -> select 'GitHub hook trigger for GitSCM polling' -> Save.๐ ๏ธ
Automated Build Trigger:
- Any changes committed to the GitHub code trigger automatic builds in Jenkins, creating an efficient and automated build pipeline.๐
These steps optimize the deployment process through Docker-Compose, enhance security, and automate the build process with GitHub integration, ensuring a seamless and efficient pipeline. ๐๐
"๐ Thank you for taking the time to explore this blog!๐ I hope you found the information both helpful and insightful.โจ
๐ Enjoy your learning journey, and don't hesitate to reach out if you have any feedback. ๐ค Happy exploring!"