Commit f39947fd authored by Lukáš Chudíček's avatar Lukáš Chudíček
Browse files

feat: merge branch 'main' into user-refactor

parents 1e50dc09 31bb2bb2
Loading
Loading
Loading
Loading
+18 −2
Original line number Original line Diff line number Diff line
@@ -16,6 +16,22 @@ This web application serves as a catalogue of movies across several genres. User


- **Administrator Control**: Only administrators have the authority to create, update, or remove movies from the catalogue, ensuring that the database is well-maintained and up-to-date.
- **Administrator Control**: Only administrators have the authority to create, update, or remove movies from the catalogue, ensuring that the database is well-maintained and up-to-date.


## Technologies Used

- Docker
- Spring Boot
- PostgreSQL
- MapStruct
- Grafana
- Prometheus

## Team Members

- Lukas Chudicek (team lead)
- Daniel Nemec
- Mario Straus
- Ecenur Sezer

## Modules
## Modules


The information about each specific module can be found in the README.md file of each module.
The information about each specific module can be found in the README.md file of each module.
@@ -58,6 +74,6 @@ docker-compose up -d


- note that you might need to clear the old images (if any present)
- note that you might need to clear the old images (if any present)


To observe the metrics of the system after the docker containers are up, please visit [Grafana UI](<localhost:3000>) with default credentials _admin:admin_.
To observe the metrics of the system after the docker containers are up, please visit [Grafana UI](https://localhost:3000) with default credentials _admin:admin_.


![Main dashboard](image.png)
A [screenshot](documentation/grafana-dashboard.png) of grafana board is also provided in documentation.
+4 −8
Original line number Original line Diff line number Diff line
# client
# Client Project


This project is here just to get the user token
This project provides the token to access the endpoints.


## Running
## Running


u know
Execute the following command to run the project.


```shell
```shell
mvn clean install -DskipTests && mvn spring-boot:run
mvn clean install -DskipTests && mvn spring-boot:run
@@ -15,15 +15,11 @@ mvn clean install -DskipTests && mvn spring-boot:run
- go to <http://localhost:8080>
- go to <http://localhost:8080>
- login with `muni`
- login with `muni`
- -> `yes continue` button
- -> `yes continue` button
- at this point there should be a bunch of uninteresting mess in the console
- click the `go to my calendar interface` button
- click the `go to my calendar interface` button
- even though the backend is not running, the token is dumped into the console
- even though the backend is not running, the token is available at the console.
- it is what it is


## Using the token
## Using the token


- i recommend

```shell
```shell
export TOKEN=the_token
export TOKEN=the_token
```
```
+13 −25
Original line number Original line Diff line number Diff line
version: '3.8'

services:
services:

  #  movie_recommender_db:
  #    image: postgres:16.2
  #    container_name: movie-recommender-postgres
  #    environment:
  #      POSTGRES_USER: ${MOVIE_RECOMMENDER_POSTGRES_USER}
  #      POSTGRES_PASSWORD: ${MOVIE_RECOMMENDER_POSTGRES_PASSWORD}
  #      POSTGRES_DB: ${MOVIE_RECOMMENDER_POSTGRES_DB}
  #    ports:
  #      - "${MOVIE_RECOMMENDER_POSTGRES_PORT}:5432"
  #    volumes:
  #      - movie-recommender-postgres-data:/var/lib/postgresql/data

  prometheus:
  prometheus:
    image: prom/prometheus:v2.43.0
    image: prom/prometheus:v2.43.0
    volumes:
    volumes:
@@ -32,7 +17,7 @@ services:
      - movie-recommender-service
      - movie-recommender-service


  grafana:
  grafana:
    image: grafana/grafana
    image: grafana/grafana:8.5.5
    volumes:
    volumes:
      - ./grafana/dashboards:/var/lib/grafana/dashboards
      - ./grafana/dashboards:/var/lib/grafana/dashboards
      - ./grafana/provisioning/dashboards.yml:/etc/grafana/provisioning/dashboards/dashboards.yml
      - ./grafana/provisioning/dashboards.yml:/etc/grafana/provisioning/dashboards/dashboards.yml
@@ -89,8 +74,8 @@ services:


  user-service:
  user-service:
    build:
    build:
      context: ./user-microservice # Assumes Dockerfile is in the same directory as docker-compose.yml
      context: ./user-microservice
      dockerfile: Dockerfile # Name of the Dockerfile
      dockerfile: Dockerfile
    container_name: user-microservice
    container_name: user-microservice
    ports:
    ports:
      - "${USER_PORT}:${USER_PORT}"
      - "${USER_PORT}:${USER_PORT}"
@@ -106,8 +91,8 @@ services:


  movie-service:
  movie-service:
    build:
    build:
      context: ./movie-microservice # Assumes Dockerfile is in the same directory as docker-compose.yml
      context: ./movie-microservice
      dockerfile: Dockerfile # Name of the Dockerfile
      dockerfile: Dockerfile
    container_name: movie-microservice
    container_name: movie-microservice
    ports:
    ports:
      - "${MOVIE_PORT}:${MOVIE_PORT}"
      - "${MOVIE_PORT}:${MOVIE_PORT}"
@@ -123,8 +108,8 @@ services:


  rating-service:
  rating-service:
    build:
    build:
      context: ./rating-microservice # Assumes Dockerfile is in the same directory as docker-compose.yml
      context: ./rating-microservice
      dockerfile: Dockerfile # Name of the Dockerfile
      dockerfile: Dockerfile
    container_name: rating-microservice
    container_name: rating-microservice
    ports:
    ports:
      - "${RATING_PORT}:${RATING_PORT}"
      - "${RATING_PORT}:${RATING_PORT}"
@@ -140,17 +125,20 @@ services:


  movie-recommender-service:
  movie-recommender-service:
    build:
    build:
      context: ./movie-recommender-microservice # Assumes Dockerfile is in the same directory as docker-compose.yml
      context: ./movie-recommender-microservice
      dockerfile: Dockerfile # Name of the Dockerfile
      dockerfile: Dockerfile
    container_name: movie-recommender-microservice
    container_name: movie-recommender-microservice
    ports:
    ports:
      - "${MOVIE_RECOMMENDER_PORT}:${MOVIE_RECOMMENDER_PORT}"
      - "${MOVIE_RECOMMENDER_PORT}:${MOVIE_RECOMMENDER_PORT}"
    depends_on:
    depends_on:
      - movie-service
      - movie-service
      - rating-service
      - rating-service
    environment:
      MOVIE_RECOMMENDER_PORT: ${MOVIE_RECOMMENDER_PORT}
      MOVIE_PORT: ${MOVIE_PORT}
      RATING_PORT: ${RATING_PORT}


volumes:
volumes:
  #  movie-recommender-postgres-data: # no db -> no volume
  movie-microservice-postgres-data:
  movie-microservice-postgres-data:
  rating-microservice-postgres-data:
  rating-microservice-postgres-data:
  user-microservice-postgres-data:
  user-microservice-postgres-data:
+461 KiB
Loading image diff...
+16 −6
Original line number Original line Diff line number Diff line
@@ -10,7 +10,7 @@ To get the microservice running you need to run docker compose in the parent dir
docker compose up --build 
docker compose up --build 
```
```


The service will be accessible at localhost:8001/api/v1/movies
The movie microservice endpoints work in [localhost:8001/api/v1/movies](http://localhost:8001/api/v1/movies).


## Movie API endpoints
## Movie API endpoints


@@ -125,15 +125,19 @@ Same implementation as Movie API endpoints except endpoint [Find Images for spec


## Seeding and clearing
## Seeding and clearing


To seed the database with some initial data, you can make the following POST request:
To seed the database with some initial data, you can use the following command while running the app:
```bash
```bash
curl -X POST http://localhost:8001/api/v1/movies/production/seed
docker cp ./sql/seed_movie_database.sql movie-postgres:/ && \
docker exec -it movie-postgres psql -U movie_user -d movie_database -p 5431 -a -f ./seed_movie_database.sql
```
```
To clear the whole database, you can make the following POST request:
To clear the whole database, you can use the following script:
```bash
```bash
curl -X POST http://localhost:8001/api/v1/movies/production/clear
docker cp ./sql/clear_movie_database.sql movie-postgres:/ && \
docker exec -it movie-postgres psql -U movie_user -d movie_database -p 5431 -a -f ./clear_movie_database.sql
```
```


For windows use `;` instead of `&&` in the above commands.



## Validation and Error handling
## Validation and Error handling


@@ -162,7 +166,13 @@ Responses to unsuccessful requests will include an appropriate HTTP status code


## Testing 
## Testing 


You can use swagger with url /api/v1/movies/swagger-ui/index.html to test the endpoints.
You can use swagger with url <http://localhost:8001/api/v1/swagger-ui/index.html#/> to test the endpoints.

- (your host, port may be different depending on your env)








Loading