Please find the specifications by clicking Here
Firstname : BAH
Surname : MAMADOU ALPHA
For Eazytraining's 17th DevOps Bootcamp
Period : march-april-may
Sunday the 14th, Janaury 2024
the goal of this project is to embed an application in a docker container. The project has three main parts:
1- BUILd : this involves writing a Dockerfile with the instructions given in the statement, and testing the application with a "CURL" command provided in the statement, which is supplied with identifiers.
2- IAC : set up the automation part with the As Code infrastructure using Docker compose (this tool enables us to automatize our containerized application).
3- Registry: In this part, we're asked to create a private Registry to store our own images.
4- IHM of the Registry: Here we could consult our own images that we've uploaded to our private registry
Translated with DeepL.com (free version)
I had to deploy an application named "student_list", which is very basic and enables POZOS to show the list of some students with their age. student_list application has two modules: The first module is a REST API (with basic authentication needed) who send the desire list of the student based on JSON file The second module is a web app written in HTML + PHP who enable end-user to get a list of student
First, let me introduce you the six files of this project and their role
Then, I'll show you how I built and tested the architecture to justify my choices
Third and last part will be about to provide the deployment process I suggest for this application. The files' role
In my delivery you can find three main files : a Dockerfile, a docker-compose.yml and a docker-compose.registry.yml
docker-compose.yml: to launch the application (API and web app)
docker-compose.registry.yml: to launch the local registry and its frontend
simple_api/student_age.py: contains the source code of the API in python
simple_api/Dockerfile: to build the API image with the source code in it
simple_api/student_age.json: contains student name with age on JSON format
index.php: PHP page where end-user will be connected to interact with the service to list students with their age.
Considering you just have cloned this repository, you have to follow those steps to get the 'student_list' application ready :
1- Change directory and build the api container image :
2- Create a bridge-type network for the two containers to be able to contact each other by their names thanks to dns functions :
We double Ckeck if the network is create
3- Move back to the root dir of the project and run the backend api container with those arguments :
cd .. docker run -d --network pozos --name test-api-pozos -v ${PWD}/student_age.json:/data/student_age.json -p 4000:5000 api-pozos:v1 Here the port 4000 of the VM "Eazytraining" will forward by the port 5000 of our container "test-api"
4- Test the api through the frontend : Using command line :
The next command will ask the frontend container to request the backend api and show you the output back. The goal is to test both if the api works and if frontend can get the student list from it.
I'm using the hostname IP "127.0.0.1" beacause i'm in localy. my application which responds from the "student_age.json" script" giving me the list of students and their ages.
so far I'm validating the Build and Test part of my muni docker project.
we need to set up a docker compose that will allow us to automate the deployment of our infrastructure. The goal is to create a second "website" container with the required recommendations.
Let me remove the test container and the test network before to lauch the automatic scritp to provisonne my cinfrastructure via "Docker compose"
let build the docker-compose file with the following comand to create the network and both containerthe website and the api :
We try to test, if we can reach our website via the port of the Eazytraining VM.
We cannot see the list of the student because we don't fill the folow parameters "(http://<api_ip_or_name:port>/pozos/api/v1.0/get_student_ages)"
let fix it, we have to go in the follow path "website/index.php"
I fixed because i change my Docker-compose file to include the parameter "container_name" sto have the resolution DNS beteween the containers.
We will create here a registry, wich help use to store our images.