@ -10,47 +10,45 @@ This project aims to discover the container concepts and tools, and practice the
- `Docker`, is a set of "platform as a service" products that use OS-level virtualization to deliver software in packages called containers.
- `Dockerfile`, is a text document that contains all the commands a user could call on the command line to assemble an image.
- `Docker Images`, is a read-only template that contains a set of instructions for creating a container that can run on the Docker platform.
- `Docker Networks`, it's enables a user to link a Docker container to as many networks as he/she requires.
- `Docker Volumes`, Volumes are the preferred mechanism for persisting data generated by and used by Docker containers.
- `Docker Networks`, it enables a user to link a Docker container to as many networks as he/she requires.
- `Docker Volumes`, Volumes are the preferred mechanism for persisting data generated and used by Docker containers.
- `Docker Compose`, Compose is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application's services.
### Tips
- Spend time on the theory before rushing into the practice.
- Read the official documentation of docker.
- Read the official documentation of Docker.
> Any lack of understanding of the concepts of this project may affect the difficulty of future projects, Take your time to understand all concepts.
> Any lack of understanding of the concepts of this project may affect the difficulty of future projects, take your time to understand all concepts.
> Be curious and never stop searching!
> Each operation in Dockerfile is a layer in the image, You must design it appropriately to avoid duplicate or useless layers in the image.
> It is not recommended to use 'latest' in your Dockerfile, instead of that you can specify the version in the tag,
> It is not recommended to use 'latest' in your Dockerfile, instead of that you can specify the version in the tag.
### Instructions
You have to install docker in your Linux virtual machine.
> You will need it in the audit.
You have to install Docker in your Linux virtual machine, you will also need it in the audit.
You have to implement this architecture:
![architecture](pictures/architecture.png)
You will use the services you developed in the `crud-master` project, otherwise, you can use our services: `crud-master solution`
You will use the services you developed in the `crud-master` project.
You are required to create `Dockerfiles` for each service and call them in your `docker-compose.yml` (Each service should have its container for optimal performance.).
You are required to create `Dockerfile`s for each service and call them in your `docker-compose.yml` (Each service should have its container for optimal performance.).
To ensure performance, the containers should be created from the penultimate stable version of either `Alpine` or `Debian`, depending on your preference.
The corresponding service and Docker image must share the same name.
This implies that you must build your project's Docker images and are not allowed to use pre-built Docker images or services like DockerHub, except for `Alpine` and `Debian`.
This implies that you must build your project's Docker images and you are not allowed to use pre-built Docker images or services like DockerHub, except for `Alpine` and `Debian`.
#### Docker Containers:
- `inventory-database container` is a SQL database server that contains your inventory database, it must be accessible via port `5432`.
- `billing-database container` is a SQL database server that contains your billing database, it must be accessible via port `5432`.
- `inventory-app container` is a Node.Js server that contains your inventory-app code running and connected to the inventory database and accessible via port `8080`.
- `billing-app container` is a Node.Js server that contains your billing-app code running and connected to the billing database and consuming the messages from the RabbitMQ queue, and it can be accessible via port `8080`.
- `RabbitMQ container` is a RabbitMQ server that contains the queue
- `api-gateway-app container` is a Node.Js server that contains your api-gateway-app code running and forwarding the requests to the other services and it's accessible via port `3000`.
- `inventory-app container` is a Node.js server that contains your inventory-app. It will be connected to the inventory database and accessible via port `8080`.
- `billing-app container` is a Node.js server that contains your billing-app. It will be connected to the billing database and consuming the messages from the RabbitMQ queue. It will be accessible via port `8080`.
- `RabbitMQ container` is a RabbitMQ server that contains the queue.
- `api-gateway-app container` is a Node.js server that contains your api-gateway-app. It will forward the requests to the other services and it's accessible via port `3000`.
> Containers must be restarted in case of failure!
@ -67,12 +65,13 @@ This implies that you must build your project's Docker images and are not allowe
> All resources in your infrastructure must be targeted and managed by docker-compose.
> You don't have to push your credentials and passwords to your repo, the credentials and passwords must be in the `.env` file, and this file must be ignored in the `.gitignore` file
> You don't have to push your credentials and passwords to your repo, the credentials and passwords must be in the `.env` file, and this file must be ignored in the `.gitignore` file.
> Don't push your passwords to Git, unless you want to throw a thief's party with free drinks and no bouncers on duty!
### Documentation
You must push a `README.md` file contains full documentation of your solution (Prerequisites, Configuration, Setup, Usage, ...).
You must push a `README.md` file containing full documentation of your solution (prerequisites, configuration, setup, usage, etc).
### Bonus
@ -82,7 +81,7 @@ Challenge yourself!
### Submission and audit
You must submit the `README.md` file and all files used to create and delete and manage your infrastructure: docker-compose, Dockerfiles, scripts,...
You must submit the `README.md` file and all files used to create, delete and manage your infrastructure: docker-compose, Dockerfiles, scripts and so on.
> The infrastructure must be able to be created, deleted, and managed only by docker-compose.
> In the audit you will be asked different questions about the concepts and the practice of this project, prepare yourself!
> In the audit you will be asked different questions about the concepts and the practices of this project, prepare yourself!
A `README.md` file and all files used to create and delete and manage the student infrastructure must be submitted in the repo.
A `README.md` file and all files used to create, delete and manage the student infrastructure must be submitted in the repo.
###### Are all the required files present?
###### `.env` file is not exists in the repo?
###### `.env` file do not exist in the repo?
###### Are all pushed files in the repo clean of any credentials or passwords?
##### Ask the following questions to the group or student
##### Ask the following questions to the group or student.
###### What are containers and what are their benefits of it?
##### What are containers and what are their advantages?
###### What is the difference between containers and virtual machines?
##### What is the difference between containers and virtual machines?
###### What is docker and what is its main role of it?
##### What is Docker and what is it used for?
###### Did the student reply correctly to the questions?
##### Check the Student Documentation
The Documentation must exists in the `README.md` file!
##### Open and read the `README.md` file provided by the student.
###### Did the README.md file contains the all required information about the solution(Prerequisites, Configuration, Setup, Usage, ...)?
###### Did the `README.md` file contains all the required information to run and manage the solution (prerequisites, configuration, setup, usage, etc)?
##### Check the student infrastructure:
#### Check the student infrastructure:
The student must implement this architecture:
![architecture](../pictures/architecture.png)
@ -45,58 +44,56 @@ api-gateway-app ... done
user:~$
```
###### did the student respect the architecture?
###### Did the student architecture reflect the infrastructure enforced by the subject?
###### did the infrastructure start correctly?
###### Did the infrastructure start correctly?
##### Ask the following questions to the group or student
###### What is microservices architecture?
##### What is a microservices architecture?
###### Why do we use microservices architecture?
##### Why do we use microservices architecture?
###### What is a queue and what are its benefits of it?
##### What is a queue and what is it used for?
###### What is RabbitMQ?
##### What is RabbitMQ?
###### Did the student reply correctly to the questions?
##### Verify the Dockerfiles:
#### Verify the Dockerfiles:
###### Is there a Dockerfile for each service?
###### Are all Dockerfiles based on Debian or alpine?
###### There is no sensitive data in DockerFiles or other solution files, rather it's exists in the `.env`?
###### Are all Dockerfiles based on `Debian` or `Alpine`?
##### Ask the following questions to the group or student
###### Explain What is a Dockerfile
##### What is a Dockerfile?
###### Explain the instructions used on the Dockerfile
##### Explain the instructions used on the Dockerfile.
###### Did the student reply correctly to the questions?
##### Check the Containers:
#### Check the Containers:
```console
user:~$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
- `inventory-database container` is a SQL database server that contains the inventory database, it must be accessible via port `5432`.
- `billing-database container` is a SQL database server that contains the billing database, it must be accessible via port `5432`.
- `inventory-app container` is a Node.Js server that contains the inventory-app code running and connected to the inventory database and accessible via port `8080`.
- `billing-app container` is a Node.Js server that contains the billing-app code running and connected to the billing database and consuming the messages from the RabbitMQ queue, and it can be accessible via port `8080`.
- `RabbitMQ container` is a RabbitMQ server that contains the queue
- `api-gateway-app container` is a Node.Js server that contains the api-gateway-app code running and forwarding the requests to the other services and it's accessible via port `3000`.
- `inventory-database container` is a SQL database server that contains your inventory database, it must be accessible via port `5432`.
- `billing-database container` is a SQL database server that contains your billing database, it must be accessible via port `5432`.
- `inventory-app container` is a Node.js server that contains your inventory-app. It will be connected to the inventory database and accessible via port `8080`.
- `billing-app container` is a Node.js server that contains your billing-app. It will be connected to the billing database and consuming the messages from the RabbitMQ queue. It will be accessible via port `8080`.
- `RabbitMQ container` is a RabbitMQ server that contains the queue.
- `api-gateway-app container` is a Node.js server that contains your api-gateway-app. It will forward the requests to the other services and it's accessible via port `3000`.
###### Do all containers exists with the correct configuration?
###### Do all containers have the correct configuration?
###### Do the containers configured to restart in case of failure?
###### Are the containers configured to restart in case of failure?
##### Check the Docker volumes:
#### Check the Docker volumes:
```console
user:~$ docker volume ls
@ -125,33 +122,33 @@ user:~$
- `billing-database volume` contains the billing database.
- `api-gateway-app volume` contains the Api gateway logs.
###### Do all volumes exist with the correct configuration?
###### Do all volumes have the correct configuration?
##### Ask the following questions to the group or student
###### What is Docker volume?
##### What is a Docker volume?
###### Why do we use Docker volume?
##### Why do we use Docker volumes?
###### Did the student reply correctly to the questions?
##### Check the solution network:
#### Check the solution network:
###### Does the connection from outside the docker host allowed only to the api-gateway-app?
###### Is the connection to the api-gateway-app the only one exposed from outside of the Docker host?
###### Is the connection to the api-gateway-app protected by SSL certification (self-signed certification is authorized)?
##### Ask the following questions to the group or student
###### What is the Docker network?
##### What is the Docker network?
###### Why do we use the Docker network?
##### Why do we use the Docker network?
###### What is an SSL certification and why do we use it?
##### What is an SSL certification and why do we use it?
###### Did the student reply correctly to the questions?
##### Check the Docker images:
#### Check the Docker images:
```console
user:~$ docker images
@ -169,16 +166,14 @@ user:~$
##### Ask the following questions to the group or student
###### What is a Docker image?
##### What is a Docker image?
###### Why do we use Docker images?
##### Why do we use Docker images?
###### Where we can find some Public Docker images?
##### Where we can find some public Docker images?
###### Did the student reply correctly to the questions?
##### Test The solution
#### Inventory API Endpoints
##### Open Postman and make a `POST` request to `http://[GATEWAY_IP]:[GATEWAY_PORT]/api/movies/` address with the following body as `Content-Type: application/json`: