Task -1 DevOps Assembly Lines

Task Overview :

JOB#1
If Developer push to dev branch then Jenkins will fetch from dev and deploy on dev-docker environment.

JOB#2
If Developer push to master branch then Jenkins will fetch from master and deploy on master-docker environment.
both dev-docker and master-docker environment are on different docker containers.

JOB#3
Manually the QA team will check (test) for the website running in dev-docker environment. If it is running fine then Jenkins will merge the dev branch to master branch and trigger #job 2

Step 1 :

First we have to create 3 jobs in jenkins to automate the Integration and deployment process.

Now add your github repository url and specify the dev branch we have to pull data from dev branch. Then we have to copy the the code from jenkins to our webserver that is inside the docker container.

After that we have to add this code in jenkins executable shell. Create a dev directory in jenkins and host the website in web-server i.e. /usr/local/apache2/htdocs/

$ sudo cp -v -r -f * /home/root/Desktop/web
$ if sudo docker ps | grep dev-docker
$ then
$ echo "it is running"
$ else
$ sudo docker run -dit -p 8081:80 -v /home/root/Desktop/web:/usr/local/apache2/htdocs/ --name dev-docker httpd
$ fi

now we have to build the execution shell.

here we are exposing this one docker container to port 8081 for testing code from dev branch. Now this job will automatically trigger and deploy our code to the webserver.

Step 2 :

Now we have to add the github repo url and specify master branch.

$ sudo cp -v -r -f * /home/root/Desktop/web2
$ if sudo docker ps | grep master-docker
$ then
$ echo "already running"
$ else
$ sudo docker run -dit -p 8082:80 -v /home/root/Desktop/web2:/usr/local/apache2/htdocs/ --name master-docker httpd

Again we have to trigger job2.

and again build the execution shell.

Now here we are exposing this container port 8082.

Step 3 :

In this step we have to add github repo url and github username password. And have to specify branch as dev branch.

After that QUA Team can able to manually build or write script. for testing remove the dev-docker container after the QUA Team approve the changes.

And here the setup is done.Now QUA team will trigger the Job3 after testing the website in testing environment.

Here we are at the end. Thanks for reading.