From 0bafe94ec369cc9850b33c6b36f4ebc8df095d4f Mon Sep 17 00:00:00 2001 From: Adiv <asifadiv@gmail.com> Date: Tue, 9 May 2023 00:38:48 +0100 Subject: [PATCH] added readme --- README.md | 127 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..b525b90 --- /dev/null +++ b/README.md @@ -0,0 +1,127 @@ +# Microservices + +This will be a guide on how to run each Microservice locally, and on a Docker container + +To run the Authentication and Profile microservices locally, .NET 8 preview 3 will need to be installed from here: https://dotnet.microsoft.com/en-us/download/dotnet/8.0 + +# Authentication Microservice + +If .NET 8 is installed, run the following commands from the root of AuthenticationMicroservice: +``` bash +cd .\AuthenticationMicroservice\ +dotnet build +dotnet run --launch-profile https +``` + +Requests can be made using something like Postman to see what gets returned when certain endpoints are hit. The endpoints can be found in the Swagger generated JSON at: +``` +https://localhost:7224/swagger/v1/swagger.json +``` +This will however require values to be filled within the appsettings.json, for it to be able to connect to a database and such. + +To run the Docker container for the Authentication Microservice, in the root of AuthenticationMicroservice run the following commands (environment variables will have to be passed in for it to function correctly, and so that information will be made public here): + +``` bash +cd .\AuthenticationMicroservice\ +docker build -t group17-auth-microservice . +docker run -p 8080:8080 -e ConnectionStrings__DbConnectionString="Server=tcp:ml01329sql.database.windows.net,1433;Initial Catalog=auth-db;Persist Security Info=False;User ID=local;Password=Testtest1;MultipleActiveResultSets=False;Encrypt=True;TrustServerCertificate=False;Connection Timeout=30;" -e TokenSettings__Secret="authservauthservauthservauthservauthservauthservauthservauthservauthservauthservauthservauthserv" -e EmailConfig__Email="aa03980.fyp@gmail.com" -e EmailConfig__Password="gzboldmxvyqfkntz" -e FrontendStrings__BaseUrl="https://gray-desert-06d027f03.3.azurestaticapps.net" group17-auth-microservice +``` + +Requests can be made using something like Postman to see what gets returned when certain endpoints are hit. The endpoints can be found in the Swagger generated JSON at: +``` +http:localhost:8080/swagger/v1/swagger.json +``` +Also note, that if an error such as a Connection Timeout Expired arises, this may be due to the database still booting up - due to the Auto-Pause delay of an hour. + +To run the unit tests, in the root of the AuthenticationMicroservice run the following commands: +``` bash +cd .\AuthenticationMicroservice.Tests\ +dotnet test +``` + +# Profile Microservice + +If .NET 8 is installed, run the following commands from the root of ProfileMicroservice: +``` bash +dotnet build +dotnet run --launch-profile https +``` + +Requests can be made using something like Postman to see what gets returned when certain endpoints are hit. The endpoints can be found in the Swagger generated JSON at: +``` +https://localhost:7244/swagger/v1/swagger.json +``` +This will however require values to be filled within the appsettings.json, for it to be able to connect to a database and such. + +To run the Docker container for the Profile Microservice, in the root of ProfileMicroservice run the following commands (environment variables will have to be passed in for it to function correctly, and so that information will be made public here): + +``` bash +docker build -t group17-profile-microservice . +docker run -p 8080:8080 -e ConnectionStrings__DbConnectionString="AccountEndpoint=https://ml01329profile.documents.azure.com/;AccountKey=tLq3LAdgsvNITMrmCEtN9dzxZGxKbvP1zqks3cldh1CRuf2ZvkeUekpE7v4g10nfJUx1Oto9KY6GACDbIuMeAw==;" -e ConnectionStrings__AzureBlobStorage="DefaultEndpointsProtocol" -e TokenSettings__Secret="authservauthservauthservauthservauthservauthservauthservauthservauthservauthservauthservauthserv" -e FrontendStrings__BaseUrl="https://gray-desert-06d027f03.3.azurestaticapps.net" group17-profile-microservice +``` + +Requests can be made using something like Postman to see what gets returned when certain endpoints are hit. The endpoints can be found in the Swagger generated JSON at: +``` +http:localhost:8080/swagger/v1/swagger.json +``` + +# TV Series Recommendation Microservice + +If the Python packages inside of requirements.txt on your machine are installed, run the following commands from the root of TVSeriesRecommendationMicroservice (if appsettings.json is not provided, it will use the tv_shows.csv file instead): +``` bash +python app.py +``` + +Requests can be made using something like Postman to see what gets returned when certain endpoints are hit. The endpoints can be found in the Swagger generated JSON at: +``` +http://131.227.230.109:5000/swagger.json +``` + +To run the Docker container for the TV Series Recommendation Microservice, in the root of TVSeriesRecommendationMicroservice run the following commands (environment variables will have to be passed in for it to function correctly, and so that information will be made public here): + +``` bash +docker build -t group17-recommendation-microservice . +docker run -p 5000:5000 -e ConnectionString="mongodb://tv-recommendations:Npevzu4NmmellEjIeoNYtHqa9pbVJsjzb8nVRnQL2DLGJKLw7c8A8pYYPXlB0sqi3W5PfTaPYHUYACDbkB0fKQ==@tv-recommendations.mongo.cosmos.azure.com:10255/?ssl=true&retrywrites=false&replicaSet=globaldb&maxIdleTimeMS=120000&appName=@tv-recommendations@" group17-recommendation-microservice +``` + +Requests can be made using something like Postman to see what gets returned when certain endpoints are hit. The endpoints can be found in the Swagger generated JSON from before + +# Reviews and Ratings Microservice + +If the Python packages inside of requirements.txt on your machine are installed, run the following commands from the root of ReviewsandRatingsMicroservice (if appsettings.json is not provided, it will fail to connect to a database): +``` bash +python app.py +``` + +Requests can be made using something like Postman to see what gets returned when certain endpoints are hit. The endpoints can be found in the Swagger generated JSON at: +``` +http://131.227.230.109:5001/swagger.json +``` + +To run the Docker container for the Reviews and Ratings Microservice, in the root of ReviewsandRatingsMicroservice run the following commands (environment variables will have to be passed in for it to function correctly, and so that information will be made public here): + +``` bash +docker build -t group17-reviews-and-ratings-microservice . +docker run -p 5001:5001 -e connectionString="mongodb://cloudcomputing:foVZXIBfI8rjcuUtGrSSSoxh2tZZ6e7SWioWkXAaByyxcPYoNoke0212u3IMxS1QfRvSknMbXNo1ACDb1kcGsg==@cloudcomputing.mongo.cosmos.azure.com:10255/?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=@cloudcomputing@" -e tokenSecret="authservauthservauthservauthservauthservauthservauthservauthservauthservauthservauthservauthserv" group17-reviews-and-ratings-microservice +``` + +Requests can be made using something like Postman to see what gets returned when certain endpoints are hit. The endpoints can be found in the Swagger generated JSON from before + +# Frontend + +This will be a guide on how to run the frontend locally + +To run the frontend locally, .NET 7.0.5 will need to be installed from here: https://dotnet.microsoft.com/en-us/download/dotnet/7.0 + +If .NET 7.0.5 is installed, run the following commands from the root of Frontend: +``` bash +dotnet build +dotnet run --launch-profile https +``` + +You can access the frontend at: +``` bash +https://localhost:7185/ +``` + +If appsettings.json is present, it will use the microservices (Container Apps) hosted in Azure, if you would like to use it with local or Docker versions of the microservice, change the strings inside of appsettings.json \ No newline at end of file -- GitLab