Skip to content

Commit

Permalink
Merge branch '69-making-the-webapp-use-the-record-service-through-the…
Browse files Browse the repository at this point in the history
…-gateway-service' into front-end-lucia
  • Loading branch information
Mister-Mario committed Apr 6, 2024
2 parents 4467576 + 93b0ee7 commit 8c025f4
Show file tree
Hide file tree
Showing 60 changed files with 7,304 additions and 497 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,22 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
workdir: users/userservice
docker-push-recordservice:
name: Push record service Docker Image to GitHub Packages
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: arquisoft/wiq_en1b/recordservice
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
workdir: users/recordservice
docker-push-gatewayservice:
name: Push gateway service Docker Image to GitHub Packages
runs-on: ubuntu-latest
Expand Down Expand Up @@ -107,7 +123,7 @@ jobs:
deploy:
name: Deploy over SSH
runs-on: ubuntu-latest
needs: [docker-push-userservice,docker-push-authservice,docker-push-gatewayservice,docker-push-webapp,docker-push-questionservice,docker-push-questiongenerator]
needs: [docker-push-userservice,docker-push-authservice,docker-push-gatewayservice,docker-push-webapp,docker-push-questionservice,docker-push-questiongenerator,docker-push-recordservice]
steps:
- name: Deploy over SSH
uses: fifsky/ssh-action@master
Expand Down
16 changes: 16 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb

recordservice:
container_name: recordservice-${teamname:-defaultASW}
image: ghcr.io/arquisoft/wiq_en1b/recordservice:latest
profiles: ["dev", "prod"]
build: ./users/recordservice
depends_on:
- mongodb
ports:
- "8004:8004"
networks:
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb

questionservice:
container_name: questionservice-${teamname:-defaultASW}
Expand All @@ -74,6 +88,7 @@
- mongodb
- userservice
- authservice
- recordservice
- questionservice
ports:
- "8000:8000"
Expand All @@ -83,6 +98,7 @@
AUTH_SERVICE_URL: http://authservice:8002
USER_SERVICE_URL: http://userservice:8001
QUESTION_SERVICE_URL: http://questionservice:8003
RECORD_SERVICE_URL: http://recordservice:8004

webapp:
container_name: webapp-${teamname:-defaultASW}
Expand Down
2 changes: 1 addition & 1 deletion docs/images/3-TechnicalContext.drawio.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/images/5-Level1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/images/5-Level2.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/images/Deployed-Infrastructure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/src/01_introduction_and_goals.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ See https://docs.arc42.org/section-1/[Introduction and Goals] in the arc42 docum
[options="header",cols="1,2"]
|===
|Quality attribute|Scenario
| Usability | The user must be able to understand the function of the application before the minute mark.
| Usability | The user must be able to start playing a game before the minute mark.
| Performance | The application will be able to operate within reasonable response times, taking into account the already present waiting times (time to answer, between questions, etc).
| Security & Privacy | The information stored about a user can only be accessed by said user, never others.
| Robustness | The application will be able to handle any user error that could happen at runtime.
| Robustness | The application will be able to handle any user or external systems (Wikidata) errors.
| Accessibility | The application will be accessible by all users, even if the suffer from visual impediments such as colorblindness.
|===

Expand Down
2 changes: 1 addition & 1 deletion docs/src/02_architecture_constraints.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ifndef::imagesdir[:imagesdir: ../images]
=== Technical constraints
Wikidata:: The information needed must be got from this central storage.
GitHub:: All the communication and code-sharing will be done by GitHub, so all the work will be recorded there.
API:: Give access about users and generated questions through an API.
Open API:: Give access about users and generated questions through an open API.

=== Organizational constraints
Team size:: The team is formed by 6 people.
Expand Down
27 changes: 18 additions & 9 deletions docs/src/03_system_scope_and_context.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ image::3-BusinessContext.drawio.svg["Business context diagram"]
|Users request a question to be shown
|The question and the set of answers corresponding to that question are presented
|*_Question Generation_*
|User requests a question and the information extracted from wikidata
|System requests a question and the information extracted from wikidata
|The question and the set of answers corresponding to that question are created
|*_Wikidata API_*
|Some part or topic related to the creation of a question
|Some concepts that will facilitate the creation of the question such as wrong answers
|Topic to create a question
|Correct anwser for the topic asked
|===

=== Technical Context
Expand All @@ -84,15 +84,24 @@ together with a mapping table showing the relationships between channels and inp
****
image::3-TechnicalContext.drawio.svg["Business context diagram"]
.User And Application interface +
The user will access the web application via the HTTPs protocol
The user will access the web application via the HTTP protocol

.Home and Login interface +
The home will allow user to be redirected to the login and authentication phase via the HTTPs protocol
The home will allow user to be redirected to the login and authentication phase via the HTTP protocol

.Login and Question Generation interface +
The login will allow the user to enter the game and so the question generation will start, this will happend through a redirect
.Login and Users Database +
The login will access the users database directly via an internal network

.Login and Database +
The login will access the database directly via TCP/IP protocol
.Login and Game interface +
The login will allow the user to enter the game menu

.Game and Users Database +
The game will access the users database directly via an internal network

.Game and Questions Database +
The game will access the questions database directly via an internal network

.Question Generator and Questions Database +
The question generator will access the question database directly via an internal network


28 changes: 22 additions & 6 deletions docs/src/04_solution_strategy.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,42 @@ See https://docs.arc42.org/section-4/[Solution Strategy] in the arc42 documentat

The technologies chosen for developing the WIQ web app are ::
* **ReactJS** : A JavaScript library that facilitates the creation of interactive grafical interfaces.
* **Sass** : A scripting language that is compiled into CSS. It extends CSS by providing several mechanisms such as variables, nested rules, mixins, functions, and inheritance.
* **TypeScript** : A superset of JavaScript that adds various features that can resolve code errors before running the actual code.
* **SpringBoot** : An extension of the Spring framework for creating Java applications. SpringBoot offers many preconfigurations that accelerate the code production process.
* **Sass** : A scripting language that is compiled into CSS. It extends CSS by providing several mechanisms such as variables, nested rules, mixins, functions, and inheritance. (Not used)
* **TypeScript** : A superset of JavaScript that adds various features that can resolve code errors before running the actual code. (Not used)
* **SpringBoot** : An extension of the Spring framework for creating Java applications. SpringBoot offers many preconfigurations that accelerate the code production process. (Not used)
* **Wikidata Toolkit** : Wikidata Toolkit is a Java library for accessing Wikidata and other Wikibase installations. It can be used to create bots, to perform data extraction tasks (e.g., convert all data in Wikidata to a new format), and to do large-scale analyses that are too complex for using a simple SPARQL query service.
* **Docker** : Docker provides tools and a runtime environment to manage these containers efficiently, allowing developers to build, ship, and run applications consistently across different environments.
* **MySql** : MySQL is an open-source relational database management system that uses SQL for managing and manipulating data.
* **MySql** : MySQL is an open-source relational database management system that uses SQL for managing and manipulating data. (Not used)
* **Mongo DB** : MongoDB is a popular open-source NoSQL database management system that stores data flexible, JSON-like documents with dynamic schemas.

* **Express** : Express is a minimal and flexible Node.js web application framework that provides a robust set of features for building web and mobile applications.

* **Nodejs** : Node.js is an open-source, cross-platform JavaScript runtime environment that executes JavaScript code outside of a web browser, allowing developers to build scalable network applications.

* **Java** : Java is a high-level, object-oriented programming language developed by Sun Microsystems. It is known for its portability, security features, and wide range of applications, from mobile to enterprise systems.

* **TO BE ORGANIZED**





=== Top-level Decomposition

To be updated along the development of the application where we will add the most important architectural and design patterns

==== Architectural Patterns

* **Microservices** : Selected as our main architecture. We will have various small independent services that interact between them to support all the fuctionalities of the web application
* **Microservices** : Selected as our main architecture. We will have various small independent services that interact between them to support all the fuctionalities of the web application.

* **API Gateway** : This API gateway serves as a centralized point for managing, securing, and routing requests between clients and multiple backend services or APIs. This is applied to centralized the calls to the different microservices.

* **Shared data** : An architectural pattern used to communicate two services through a data repository. In our case, we will communicate the questions generator and the game through a database for a better efficiency and robustness.

==== Design Patterns

* **Façade** : Pattern used to communicate between different parts of the whole application (APIs)
* **Façade** : Pattern used to communicate between different parts of the whole application (APIs).
* **Template** : Pattern used to set some fixed steps of an algorithm. This was used for the different questions generators.

=== Decisions for achieving quality goals

Expand Down
28 changes: 15 additions & 13 deletions docs/src/05_building_block_view.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -61,26 +61,28 @@ In this level of descomposition we separate the main services of our system show


Contained Building Blocks::
* *_WIQ_ HOME* : Service which will collect the user interaction and redirect it to the corresponding service.
* *_WIQ_ USER MANAGEMENT* : Service that will manage the user information, login, authentication, etc.
* *_WIQ_ QUESTION GAME* Service that will generate and show the different questions for our game.
* *_Webapp_* : The web part of our application that will use the wiq services to let the user play.
* *Gateway service* : Service that will redirect every call to our endpoints to the specific one.
* *_WIQ Services_* : Our collection of endpoints that will attend any need of our Webapp as well as giving support to external calls.

=== Level 2

image::5-Level2.svg["Level 2"]

Motivation::

In this level of descomposition of the system we start to identify the different microservices of the system.
In this level of descomposition of the system we identify the different views of the webapp and microservices of the WIQ services.


Contained Building Blocks::
* *_HOME_ WELCOME PAGE* : Microservice that will welcome the user giving a small explanation about the game and facilate the registration/login process.
* *_USER MANAGEMENT_ USERSERVICE* : Microservice that will allow the user create an account for the user and let him access the game.
* *_USER MANAGEMENT_ AUTHSERVICE* : Microservice that will login the user in the system and let him access the game.
* *_HOME_ GAMEMODE PAGE* : Microservice that will let the user start a game.
* *_QUESTION GAME_ GAME CONFIGURATION* Microservice that will let the user customize some game parameters (amount of questions, time to respond a question, etc).
* *_QUESTION GAME_ QUESTION RESTAPI* Microservice that will work as our open API allowing other systems to retrieve information like:
** Random questions and corresponding answers.
* *_QUESTION GAME_ QUESTION GENERATOR* Microservice that will generate the different questions for our game communicating with wikidata.
* *_QUESTION GAME_ GAME* Microservice that will show the different questions for our game and manage the user answers in order to give a final score.
* *_Webapp_ Home* : First view of the webapp.
* *_Webapp_ Log in and Register* : Views of the webapp that allow the user to get into the application.
* *_Webapp_ Game menu* : Intermediate view between the records and the actual game.
* *_Webapp_ User's games records* : View where the user will be able to see different statistics of the games played (Correct answers, points, total games).
* *_Webapp_ Question Game* : Game view where the user will be able answer the random question by choosing 1 of 4 possibilities.

* *_WIQ Services_ Authentication service* : Microservice that will let the user log in a created account.
* *_WIQ Services_ User service* : Microservice that will let the user create an account.
* *_WIQ Services_ Record service* : Microservice that will manage the records of all users and will let anyone get the records of a user.
* *_WIQ Services_ Question service* Microservice that will get some random questions for an user game. It will also let anyone get random questions from outside our system.
* *_WIQ Services_ Question generator* Microservice that will generate the random questions accesing wikidata and load them into the system.
Loading

0 comments on commit 8c025f4

Please sign in to comment.