Automating Developer and Client Connection
Shivam Gupta
Java | Spring Boot | Microservices | Backend Developer | Researcher | Machine Learning | MLH Best Social Good Hack Winner
One great automation using GitHub, Docker, and Jenkins which is a replica of real industry production and developer system. In this project, I tried to simulate testing and production environments as every product based company have.
How a developer build code and it goes under Quality Check and then after successful quality checks it proceeds further for the production or launching.
Jenkins And Docker are installed in RHEL OS Jenkins is added in sudoers file. User has a Github Profile and Git Bash is Installed
STEPS:
Step 1: Create a folder on your preferred place.
-Task - index.html - home.html
Step 2: Create branch and automate push command
Step 3: Set up Jenkins
Job1:
Execute shell:
if sudo docker ps | grep production_server then echo "Production Server Already Running" else sudo docker run -d -t -i -p 8081:80 -v /prodDir:/usr/local/apache2/htdocs/ --name production_server httpd fi sudo cp -r -v -f * /prodDir/
Click apply and then save
Job2
Build triggers : use polling in every minute (although we can use hooks which is better option but for now am going with polling)
Execute Shell:
if sudo docker ps | grep test_server then echo "Test Server Already Running" else sudo docker run -d -t -i -p 8082:80 -v /testDir:/usr/local/apache2/htdocs/ --name test_server httpd fi
sudo cp -r -v -f * /testDir/
Click apply and then save
Job3:
Build triggers : No need to add this trigger , as testing team will run this job but assuming that all tests are good so we trigger this job just after Job2
Click apply and then save
Conclusion
Now Everything is configured. As soon as the developer branch is commit by developer locally, it gets push on GitHub, Then our Job2 Job gets code from branch developer and deploy to test server. Finally our Job3 merges the branches by using credentials provided and production deployed.
Email: [email protected]