Skip to content

Commit

Permalink
Next test release (#38) (#39)
Browse files Browse the repository at this point in the history
* creating the health service

* more work on the healthService

* Like Service Done

* rename direct message projects

* small fix

* update for HealthService

middleware is now ready and works, some few issues still needs some fixing

* added GetLike

* added so post uses likeservice when getting posts

* added LikeService to docker

* fixed small issue

* Moved the Timeline to it's own service. Next time is to remove the current TimelineService.

* Added the Timeline projects seperated from the Post projects, and removed all the redudant classes that happened to appear.

* Smaller changes to the DBContext.

* Added docker support for Timeline and Post.

* more work on Health

the service is now done and complete
started working on some UI for the health service too better present how each service is doing

* Health Service is done

* added signalR and fixed sln

* ratelimit for saving like and post

theese two are proven to be a easy target for ddos and just over use

* Update LikeAPI.csproj

* small fix

* new dockerfile

* fix for build

* Refactored the timeline repo methods to use using instead for cleaner code.

* Refactored the post repository to use using instead.

* fixed double call to repo

* fixed minor issue

* security stuff + gateway (#34)

* gateway initial

* added gateway to sln

* Gateway implementation WIP, need to add authorization still.

* Made it avaiable to take in a identity server.

* refactored for identityServer4

* WIP

* stuff

* Migth be getting closer to getting the authentcation work.

* Trying to add a bearer token instead of a jwt token

* Minor changes to the auth service

* removed identityserver functionality from auth

* Made the basic implementation of the auth with ocelot.

---------




* Added MessagingClient

* fixed ports that prevent all services to run (#35)

* Made messaging work.

* Services to gateway (#36)

* added likeservice to gateway

* added commentservice to gateway and docker

* Uncommented the HealthReporting

---------



* Sent some updates, added the method needed to the ocelot file.

* Removed the authorize attribute, as it is done through the api gateway.

* Fixed create post method

* Changed path

* Fixed dependency injection in post

* Added rabbitmq to docker compose

* latest changes

* Might have made it work

* Added async modifiers

* added mapping

* Send this stuff, might work.

* Deleted some stuff.

* Initializing the list in my timeline class.

* AddCommentToPost

* Added references

* Forgot a mapping

* Added messaging to like

* Changed to void

* Should work now

* Added refrerence

* Changed it to IMapper instead

* Updated the controller like

* Instalized the userID list

* Changed some stuff in regards to the json response

* Added the map configuration for like

* probarely fixed it

* post tests

* another test added

---------

Co-authored-by: Anders Senger <[email protected]>
Co-authored-by: JensIssa <[email protected]>
Co-authored-by: kasp441 <[email protected]>
Co-authored-by: Ominousity <[email protected]>
  • Loading branch information
5 people authored Apr 7, 2024
1 parent f24f220 commit 79dc17c
Show file tree
Hide file tree
Showing 146 changed files with 4,294 additions and 395 deletions.
17 changes: 17 additions & 0 deletions ApiGateway/ApiGateway.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>919a775f-bc38-4dca-891a-bdcc363b3659</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.2" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.19.5" />
<PackageReference Include="Ocelot" Version="23.0.0" />
</ItemGroup>

</Project>
25 changes: 25 additions & 0 deletions ApiGateway/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
USER app
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["ApiGateway/ApiGateway.csproj", "ApiGateway/"]
RUN dotnet restore "./ApiGateway/./ApiGateway.csproj"
COPY . .
WORKDIR "/src/ApiGateway"
RUN dotnet build "./ApiGateway.csproj" -c $BUILD_CONFIGURATION -o /app/build

FROM build AS publish
ARG BUILD_CONFIGURATION=Release
RUN dotnet publish "./ApiGateway.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false

FROM base AS final
WORKDIR /app
COPY --from=publish /app/publish .
ENTRYPOINT ["dotnet", "ApiGateway.dll"]
48 changes: 48 additions & 0 deletions ApiGateway/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.IdentityModel.Tokens;
using Ocelot.DependencyInjection;
using Ocelot.Middleware;
using System.Text;


var builder = WebApplication.CreateBuilder(args);

builder.Configuration.SetBasePath(builder.Environment.ContentRootPath)
.AddJsonFile("ocelot.json", optional: false, reloadOnChange: true)
.AddEnvironmentVariables();

string securityKey = "EGloFd7oowoQlAo0MLBKPnB8Ct3RKC0k1RMmmeRnw92vqRPGKkCPgk9DNxVJBtXmlwAYQh4MKeEIOcdObJlBxJTpr4Zic3qu4QE9n6CGdH1h6MwxwzCntYwS0JU0kN8g";


builder.Services.AddAuthentication(
options =>
{
options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
}
).AddJwtBearer(
JwtBearerDefaults.AuthenticationScheme, options =>
{
options.TokenValidationParameters = new TokenValidationParameters
{
ValidateIssuer = false,
ValidateAudience = false,
ValidateLifetime = false,
ValidateIssuerSigningKey = true,
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(securityKey))
};

}
);

builder.Services.AddOcelot(builder.Configuration);

var app = builder.Build();

app.UseRouting();
app.UseAuthentication();
app.UseAuthorization();

app.UseOcelot().Wait();

app.Run();
49 changes: 49 additions & 0 deletions ApiGateway/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{
"profiles": {
"http": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "http://localhost:5075"
},
"https": {
"commandName": "Project",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "https://localhost:7063;http://localhost:5075"
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"Docker": {
"commandName": "Docker",
"launchBrowser": true,
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
"environmentVariables": {
"ASPNETCORE_HTTPS_PORTS": "8081",
"ASPNETCORE_HTTP_PORTS": "8080"
},
"publishAllPorts": true,
"useSSL": true
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:1958",
"sslPort": 44378
}
}
}
8 changes: 8 additions & 0 deletions ApiGateway/appsettings.Development.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
}
}
9 changes: 9 additions & 0 deletions ApiGateway/appsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
}
},
"AllowedHosts": "*"
}
Loading

0 comments on commit 79dc17c

Please sign in to comment.