Devops - Workshop Project Doc - A4r - Uoef2md
Devops - Workshop Project Doc - A4r - Uoef2md
Project Documentation: -
Note: The below steps explain how to setup the Project on an Ubuntu Linux machine.
• After installing Git:
o Setup the Project Repo on your local system/remote server
• After installing Jenkins, Docker, & Docker-Compose
o Execute the containers via BASH
• Execute the containers via:
o Jenkins Pipeline script
o Jenkinsfile (stored in SCM)
To Clone the repo at your local system, run the below command in a new Directory:
$ git clone https://github.com/VardhanNS/phpmysql-app
Once the command is executed, there will be a local copy of the files for your reference.
You can either initialize a new Git repo and copy the contents there or simply use the
above shared public repo.
Edureka VM Installation Guide
The above command will build the Image along with other components into a Container
so as to make the container executable, but it wouldn’t have executed it yet. You should
get a confirmation on the terminal about the various steps in the build process that has
been successful.
The next step is to run the Docker container which we have just built. Run this command:
$ docker-compose up
Note: You can add a flag ‘-d’ to the compose up command if you want to run the
container in detached mode. This is typically done when executing via Jenkins server. But
the flag is not a mandate when we run this command via BASH.
After a few seconds, 2 Container should be up and running. One would be a PHP
container and the other would be MySQL container. To verify that both containers are
running, run this command:
$ docker ps
The PHP service is running on port number 8008 in your localhost as defined in the
compose file. Open your browser, and hit the URL: localhost:8008 to see the E-
Commerce Application software running at your system.
Note: Before you build/execute the container the next time, destroy the already running
Containers. This is because whenever we execute the container, it will be started with the
same name (As mentioned in our compose file. You can change these settings if you wish
to).
An important aspect of this Project is you pushing your custom docker image to the
docker hub. Create a Dockerhub account and a new Docker Repo if you haven’t one
already. Run the below commands to establish a connection between your local system
and the docker hub.
On executing this command, you will be prompted for the password too. The next step is
to add a tag the Image you built and then push it to docker hub. The image ID of the
image you build is the Image ID displayed when you ran the docker-compose build
command.
$ docker-compose build
Now to rename the Image and add a tag, you have to run the command:
docker tag bb38976d03cf yourHubUserName/yourRepoName:imageTag
Replace the variables mentioned in the above step according to your needs. The next
step is to push the image to the docker hub with command:
docker push yourHubUserName/yourRepoName