diff --git a/docs/documentation/database/infrastructure.md b/docs/documentation/database/infrastructure.md index fc83b22..1b6cbea 100644 --- a/docs/documentation/database/infrastructure.md +++ b/docs/documentation/database/infrastructure.md @@ -1,19 +1,45 @@ # Infrastructure -The infrastructure of the database is composed of the following components: +This document describes the infrastructure of the database and server components of the project. -- User -- Pepper - - Interface - - Robot -- Raspberry Pi - - Database - - MariaDB - - Server - - Apache - - phpMyAdmin - - Node.js +## Components -User interacts with Pepper through the interface. The interface sends the user input to the robot. The robot processes the input (java) and sends the output (xml) back to the interface. The interface displays the output to the user. The Raspberry Pi hosts the server and database. The database stores the data and the server hosts the website. The server runs Apache, phpMyAdmin, and Node.js. The interface makes a request to the server (HTTP GET) to retrieve the data in the database. The server processes the request (HTTP GET) and retrieves (SQL) the data from the database. The interface displays the data to the user. +The database component of the project consists of the following components: + +- Node.js (Server) +- Apache2 (Web Server) +- phpMyAdmin (Database Management Tool) +- MariaDB (Database) + +## Diagrams + +Architecture application diagram of the project. + +![Architecture application](../diagrams/assets/appDiagramV2.png) + +Deyplomment application diagram of the project. + +![Deyplomment application](../diagrams/assets/appDiagramV4.png) + +## Database + +The database component of the project is responsible for storing and managing the data used by the application. The database is implemented using MariaDB. The database is responsible for storing data such as exercises, names, descriptions, images, videos and exercise paths. The database is accessed by the server component of the project to retrieve data. + +## Server + +The server components of the project are responsible for handling requests from the client application and interacting with the database. The server is implemented using Node.js and is responsible for handling requests to retrieve exercises. The server is also responsible for serving the client application to the user. + +The web server component of the project is implemented using Apache2 and is responsible for hosting phpMyAdmin, a database management tool used to interact with the database. + +## Problems/Solutions + +During the setup of the infrastructure, the following problems were encountered. + +### Reverse proxy + +The initial problem is that the Pi has a limeted amount of ports that can be used. This means that the server can only be accessed through port 80. This is a problem because the server is running on port 3000. To solve this problem, a reverse proxy was used to redirect traffic from port 80 to port 3000. This was done by creating a virtual host in the Apache2 configuration file that listens on port 80 and redirects traffic to port 3000. + +When implementing the reverse proxy a problem was encountered where everything on port 80 was being redirected to port 3000. This was a problem because the server was also running on port 80. The initial solution was to remove the reverse proxy from sites-enabled and restart the server. However this caused the reverse proxy to stop working. Eventually it took too long to fix the problem and the reverse proxy was removed. + +Running the server on port 443 was also considered as a solution. At the first sight this dind't seem possible since the access to port 443 is restricted. However, after some research it was found that it is possible to run the server on port 443 by starting the node with sudo. This was the solution that was chosen. -![Application Architecture Diagram](../diagrams/assets/appDiagram.png) \ No newline at end of file diff --git a/docs/documentation/diagrams/.$appDiagram.drawio.bkp b/docs/documentation/diagrams/.$appDiagram.drawio.bkp index 31a34c1..1d420ac 100644 --- a/docs/documentation/diagrams/.$appDiagram.drawio.bkp +++ b/docs/documentation/diagrams/.$appDiagram.drawio.bkp @@ -1,140 +1,99 @@ - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - + - - - - - + + - + + + + + + + + + + + + + + + + - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/docs/documentation/diagrams/appDiagram.drawio b/docs/documentation/diagrams/appDiagram.drawio index 1d420ac..7114ed8 100644 --- a/docs/documentation/diagrams/appDiagram.drawio +++ b/docs/documentation/diagrams/appDiagram.drawio @@ -1,99 +1,105 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + - + - + - + - + - + - + - - + + - + - + - + - - + + - + + + + diff --git a/docs/documentation/diagrams/assets/.$appDiagramV4.png.bkp b/docs/documentation/diagrams/assets/.$appDiagramV4.png.bkp new file mode 100644 index 0000000..c46a0d1 Binary files /dev/null and b/docs/documentation/diagrams/assets/.$appDiagramV4.png.bkp differ diff --git a/docs/documentation/diagrams/assets/appDiagramV4.png b/docs/documentation/diagrams/assets/appDiagramV4.png new file mode 100644 index 0000000..b432d52 Binary files /dev/null and b/docs/documentation/diagrams/assets/appDiagramV4.png differ