Skip to content

Commit

Permalink
Merge pull request #64 from Arquisoft/develop
Browse files Browse the repository at this point in the history
V0.1.0 Web app
  • Loading branch information
ChristianFN2 authored Mar 10, 2024
2 parents effb44d + 0fa26df commit a844671
Show file tree
Hide file tree
Showing 36 changed files with 1,912 additions and 153 deletions.
35 changes: 26 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ jobs:
- run: npm --prefix webapp run test:e2e
docker-push-webapp:
name: Push webapp Docker Image to GitHub Packages
runs-on: ubuntu-latest
runs-on: ARM64
permissions:
contents: read
packages: write
needs: [e2e-tests]
#needs: [e2e-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -59,13 +59,30 @@ jobs:
registry: ghcr.io
workdir: webapp
buildargs: API_URI
docker-push-questionservice:
name: Push question service Docker Image to GitHub Packages
runs-on: ARM64
permissions:
contents: read
packages: write
# needs: [e2e-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
uses: elgohr/Publish-Docker-Github-Action@v5
with:
name: arquisoft/wiq_en1a/usequestionservicerservice
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
workdir: questionservice
docker-push-authservice:
name: Push auth service Docker Image to GitHub Packages
runs-on: ubuntu-latest
runs-on: ARM64
permissions:
contents: read
packages: write
needs: [e2e-tests]
#needs: [e2e-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -78,11 +95,11 @@ jobs:
workdir: users/authservice
docker-push-userservice:
name: Push user service Docker Image to GitHub Packages
runs-on: ubuntu-latest
runs-on: ARM64
permissions:
contents: read
packages: write
needs: [e2e-tests]
#needs: [e2e-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -95,11 +112,11 @@ jobs:
workdir: users/userservice
docker-push-gatewayservice:
name: Push gateway service Docker Image to GitHub Packages
runs-on: ubuntu-latest
runs-on: ARM64
permissions:
contents: read
packages: write
needs: [e2e-tests]
#needs: [e2e-tests]
steps:
- uses: actions/checkout@v4
- name: Publish to Registry
Expand All @@ -112,7 +129,7 @@ jobs:
workdir: gatewayservice
deploy:
name: Deploy over SSH
runs-on: ubuntu-latest
runs-on: ARM64
needs: [docker-push-userservice,docker-push-authservice,docker-push-gatewayservice,docker-push-webapp]
steps:
- name: Deploy over SSH
Expand Down
24 changes: 22 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,28 @@
# wiq_en1a
# WIQ
[![Deploy on release](https://github.com/Arquisoft/wiq_en1a/actions/workflows/release.yml/badge.svg)](https://github.com/Arquisoft/wiq_en1a/actions/workflows/release.yml)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Arquisoft_wiq_en1a&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Arquisoft_wiq_en1a)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=Arquisoft_wiq_en1a&metric=coverage)](https://sonarcloud.io/summary/new_code?id=Arquisoft_wiq_en1a)
### Members

Welcome to WIQ, your gateway to a world of knowledge exploration! 🚀

WIQ is a dynamic web application that harnesses the power of Wikidata to create an engaging and educational experience. Dive into the vast ocean of information, challenge yourself with thought-provoking questions across various topics, and elevate your learning journey.

Happy exploring! 🌐✨
### Getting Started:
A quick start is using docker compose, so all containers will be created automatically. The web application is hosted on the port 3000 whereas the gateway service is in 8000.

```bash
git clone https://github.com/Arquisoft/wiq_en1a.git
docker compose --profile dev up --build
```

## Meet our Team
We are students of Software Architecture in the University of Oviedo. This web application is the laboratory project of the subject. We hope you like our webapp and we are welcomed to proposals of new content by our Issues.

You can check our Documentation [here](https://arquisoft.github.io/wiq_en1a/) where all the tecnical details are explained

### Developers

| Name | Email |
|-----------------------------|--------------------|
| Andrés Cadenas Blanco | UO282276@uniovi.es |
Expand Down
24 changes: 23 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ services:
- "27017:27017"
networks:
- mynetwork
# platform: linux/arm64

authservice:
container_name: authservice-${teamname:-defaultASW}
Expand All @@ -24,6 +25,7 @@ services:
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb
# platform: linux/arm64

userservice:
container_name: userservice-${teamname:-defaultASW}
Expand All @@ -38,7 +40,21 @@ services:
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb

# platform: linux/arm64
questionservice:
container_name: questionservice-${teamname:-defaultASW}
image: ghcr.io/arquisoft/wiq_en1a/questionservice:latest
profiles: ["dev", "prod"]
build: ./questionservice
depends_on:
- mongodb
ports:
- "8010:8010"
networks:
- mynetwork
environment:
MONGODB_URI: mongodb://mongodb:27017/userdb
# platform: linux/arm64
gatewayservice:
container_name: gatewayservice-${teamname:-defaultASW}
image: ghcr.io/arquisoft/wiq_en1a/gatewayservice:latest
Expand All @@ -55,6 +71,8 @@ services:
environment:
AUTH_SERVICE_URL: http://authservice:8002
USER_SERVICE_URL: http://userservice:8001
QUESTION_SERVICE_URL: http://questionservice:8010
# platform: linux/arm64

webapp:
container_name: webapp-${teamname:-defaultASW}
Expand All @@ -65,6 +83,8 @@ services:
- gatewayservice
ports:
- "3000:3000"
# platform: linux/arm64


prometheus:
image: prom/prometheus
Expand All @@ -79,6 +99,7 @@ services:
- "9090:9090"
depends_on:
- gatewayservice


grafana:
image: grafana/grafana
Expand All @@ -100,6 +121,7 @@ services:
- prometheus



volumes:
mongodb_data:
prometheus_data:
Expand Down
15 changes: 5 additions & 10 deletions docs/src/03_system_scope_and_context.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,15 @@ The title of the table is the name of your system, the three columns contain the
****

[plantuml,"Context diagram",png]
[plantuml,"Context Diagram",png]
----
actor Player
actor Client
[Wikidata] <<external>>
[WIQ Game] <<system>>
[UsersAPI] <<internal>>
[GeneratedQuestionsAPI] <<internal>>
Player ..> (WIQ Game) : register/login
Client ..> (WIQ Game) : view data
[GeneratedQuestionsAPI] ..> Wikidata
[WIQ Game] ..> UsersAPI
[WIQ Game] ..> GeneratedQuestionsAPI
Expand All @@ -71,21 +69,18 @@ Client ..> (WIQ Game) : view data
|Player
|Plays the game and can consult past scores

|Client
|Can access the data about players and generated questions

|WIQ Game
|Main system in which generated questions are shown and can be answered by players

|Wikidata
|External data repository from which questions are generated using the WikidataAPI
|External data repository from which questions are generated

|MongoDB
|Database for storing generated questions, players' info and scores
|Database for storing players' info and scores

|Users Info API
|Allows clients to see the info about players stored in the database
|Manages data of users, both registration/login data and their past scores

|Generated Questions API
|Allows clients to see the info about generated questions stored in the database
|Manages generation of questions from Wikidata
|===
44 changes: 11 additions & 33 deletions docs/src/05_building_block_view.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -63,24 +63,19 @@ In the best case you will get away with examples or simple signatures.
****

[plantuml,"White box overall system",png]
[plantuml,"Whitebox overall system",png]
----
actor Player
actor Client
[Wikidata]
rectangle "WIQ Game (Level 1)"{
[WIQ Game GUI]
[Data View]
[UsersAPI]
[GeneratedQuestionsAPI] #BurlyWood
Player ..> (WIQ Game GUI)
Client ..> (Data View)
[GeneratedQuestionsAPI] ..> Wikidata
[WIQ Game GUI] ..> UsersAPI
[WIQ Game GUI] ..> GeneratedQuestionsAPI
[Data View] ..> UsersAPI
[Data View] ..> GeneratedQuestionsAPI
}
----

Expand All @@ -97,11 +92,8 @@ Contained Black boxes::
|WIQ Game GUI
|Main window in which questions are shown and can be answered by the player. The latter can also see past scores.

|Data View
|Access to data about users and generated questions for the client.

|Generated Questions API
|In charge of generating the questions and storing their data
|In charge of generating the questions

|UsersAPI
|In charge of keeping track of the data of the users (registration and scores)
Expand Down Expand Up @@ -165,21 +157,18 @@ Leave out normal, simple, boring or standardized parts of your system
...describes the internal structure of _building block 1_.
****

[plantuml,"Generated Questions API (White Box)",png]
[plantuml,"Generated Questions API (WhiteBox)",png]
----
[Wikidata]
[wikidatanpm] <<library>>
[wikibase-sdk] <<library>>
[WIQ Game GUI]
[Data View]
database MongoDB
rectangle "GenedQuestsAPI (Level 2)"{
[GenQuestsService] ..> wikidatanpm
[GenQuestsService] ..> Wikidata
[GenQuestsService] ..> [wikibase-sdk]
[GenQuestsService] ..> [Wikidata]
[GenQuestsService] <--> MongoDB
[WIQ Game GUI] ..> GenQuestsService : new Question
[Data View] ..> GenQuestsService : get Questions
[WIQ Game GUI] ..> [GenQuestsService] : new Question
}
----

Expand All @@ -194,23 +183,12 @@ Contained Black boxes::
|Name |Responsibility

|GenQuestsService
|Receives different petitions regarding the generation of questions or their retrieval and responds accordingly.
|Receives different petitions regarding the generation of questions and responds accordingly.

|wikidatanpm
|wikibase-sdk
|External library that facilitates and simplifies the use of wikidata for the generation of questions.

|MongoDB
|The data of the generated questions is stored here for showing it later to the client.

|===

Additional explanation of relationships::

The service is requested either the generation of a question or the retrieval of a subset (from WIQ Game GUI or
Data View respectively).

For the first case, it makes use of the library to generate the question, retrieves it
for the interface to use and stores the pertinent data in the DB.
|Data about users and their scores is stored here

In the other case, it just makes the query according to the client choosings and retrieves the data of the
questions for the Data View to show.
|===
23 changes: 15 additions & 8 deletions docs/src/08_concepts.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,26 @@ image::08-Crosscutting-Concepts-Structure-EN.png["Possible topics for crosscutti
See https://docs.arc42.org/section-8/[Concepts] in the arc42 documentation.
****

=== _Domain model and terminology_

=== _<Concept 1>_

_<explanation>_


=== _Microservice based system_

=== _<Concept 2>_
Different business functionallities will be developed in different independent services.
This will ensure that if one of them fails, the rest are still working (For example,
if the rankings go down that will not affect the main game) as they have their own deployment
as well.
Other benefits are increased maintainability due to separation in small, more readable modules
and the possibillity of using different languages or technologies for each module if needed/prefered
without colliding with the rest.

_<explanation>_

...
=== _Gateway service routing_

=== _<Concept n>_

_<explanation>_
We will use a speciallized service that will route the requests to the corresponding service, acting as
a single entry point for the application. Requests to the services are much simpler as only the api base
endpoint and the action needs to be known and the gateway can also act as a filter to manage requests
conditionally if needed. This approach also favors security as we can control which requests are actually
sent based on its content or the context of the app.
11 changes: 11 additions & 0 deletions docs/src/11_technical_risks.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,14 @@ List of risks and/or technical debts, probably including suggested measures to m
See https://docs.arc42.org/section-11/[Risks and Technical Debt] in the arc42 documentation.
****

[options="header", cols="1,1,1,1"]
|===
|Risk |Why it exists |Severity - Explanation |Possible solutions

|Use of wikibase-sdk version 8 (not final)
|It is the last version that supports 'require', which is needed to use express in the same module
|Low - The difference is, a priori, merely functional, but retains the needed characteristics
|Upgrade only if a newer version supports 'require'

|===
8 changes: 4 additions & 4 deletions docs/src/12_glossary.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ See https://docs.arc42.org/section-12/[Glossary] in the arc42 documentation.
|===
|Term |Definition

|<Term-1>
|<definition-1>
|Microservice
|Small and independent component that performs a specific business function

|<Term-2>
|<definition-2>
|API
|Set of endpoints exposed by the backend server whose purpose is interacting with the client-side
|===
Loading

0 comments on commit a844671

Please sign in to comment.