diff --git a/DamageAssesmentApi/.dockerignore b/DamageAssesmentApi/.dockerignore new file mode 100644 index 0000000..3729ff0 --- /dev/null +++ b/DamageAssesmentApi/.dockerignore @@ -0,0 +1,25 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md \ No newline at end of file diff --git a/DamageAssesmentApi/DamageAssesment.Api.Answers/DamageAssesment.Api.Answers.csproj b/DamageAssesmentApi/DamageAssesment.Api.Answers/DamageAssesment.Api.Answers.csproj index f33241f..87cdc93 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Answers/DamageAssesment.Api.Answers.csproj +++ b/DamageAssesmentApi/DamageAssesment.Api.Answers/DamageAssesment.Api.Answers.csproj @@ -1,10 +1,12 @@ - + net6.0 enable enable True + Linux + ..\docker-compose.dcproj @@ -12,6 +14,7 @@ + diff --git a/DamageAssesmentApi/DamageAssesment.Api.Answers/Dockerfile b/DamageAssesmentApi/DamageAssesment.Api.Answers/Dockerfile new file mode 100644 index 0000000..2ae373c --- /dev/null +++ b/DamageAssesmentApi/DamageAssesment.Api.Answers/Dockerfile @@ -0,0 +1,21 @@ +#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:6.0 AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["DamageAssesment.Api.Answers/DamageAssesment.Api.Answers.csproj", "DamageAssesment.Api.Answers/"] +RUN dotnet restore "DamageAssesment.Api.Answers/DamageAssesment.Api.Answers.csproj" +COPY . . +WORKDIR "/src/DamageAssesment.Api.Answers" +RUN dotnet build "DamageAssesment.Api.Answers.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "DamageAssesment.Api.Answers.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "DamageAssesment.Api.Answers.dll"] \ No newline at end of file diff --git a/DamageAssesmentApi/DamageAssesment.Api.Answers/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Answers/Program.cs index 373d300..84e8dc6 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Answers/Program.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Answers/Program.cs @@ -2,6 +2,8 @@ using DamageAssesment.Api.Answers.Db; using DamageAssesment.Api.Answers.Interfaces; using DamageAssesment.Api.Answers.Providers; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Options; +using Microsoft.OpenApi.Models; using System.Reflection; var builder = WebApplication.CreateBuilder(args); @@ -14,10 +16,13 @@ builder.Services.AddEndpointsApiExplorer(); //builder.Services.AddSwaggerGen(); builder.Services.AddSwaggerGen(c => { + // Include XML comments from your assembly var xmlFile = $"{Assembly.GetExecutingAssembly().GetName().Name}.xml"; var xmlPath = Path.Combine(AppContext.BaseDirectory, xmlFile); c.IncludeXmlComments(xmlPath); + + }); builder.Services.AddScoped(); builder.Services.AddAutoMapper(AppDomain.CurrentDomain.GetAssemblies()); //4/30 @@ -31,7 +36,11 @@ var app = builder.Build(); if (app.Environment.IsDevelopment()) { app.UseSwagger(); - app.UseSwaggerUI(); + app.UseSwaggerUI(options => + { + options.SwaggerEndpoint("/swagger/v1/swagger.json","" ); + // options.RoutePrefix = ""; // Serve Swagger UI at the root URL + }); } app.UseAuthorization(); diff --git a/DamageAssesmentApi/DamageAssesment.Api.Attachments/DamageAssesment.Api.Attachments.csproj b/DamageAssesmentApi/DamageAssesment.Api.Attachments/DamageAssesment.Api.Attachments.csproj index 46a5b7a..60ec9db 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Attachments/DamageAssesment.Api.Attachments.csproj +++ b/DamageAssesmentApi/DamageAssesment.Api.Attachments/DamageAssesment.Api.Attachments.csproj @@ -5,6 +5,8 @@ enable enable True + Linux + ..\docker-compose.dcproj @@ -14,6 +16,7 @@ + diff --git a/DamageAssesmentApi/DamageAssesment.Api.Attachments/Dockerfile b/DamageAssesmentApi/DamageAssesment.Api.Attachments/Dockerfile new file mode 100644 index 0000000..f3bdaa0 --- /dev/null +++ b/DamageAssesmentApi/DamageAssesment.Api.Attachments/Dockerfile @@ -0,0 +1,31 @@ +#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:6.0 AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["DamageAssesment.Api.Attachments/DamageAssesment.Api.Attachments.csproj", "DamageAssesment.Api.Attachments/"] +RUN dotnet restore "DamageAssesment.Api.Attachments/DamageAssesment.Api.Attachments.csproj" +COPY . . +WORKDIR "/src/DamageAssesment.Api.Attachments" +RUN dotnet build "DamageAssesment.Api.Attachments.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "DamageAssesment.Api.Attachments.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +# Copy the appsettings.json file to the container +#COPY appsettings.json . +# Create directories for attachments and set permissions +RUN mkdir -p /app/DMS_Attachments/Active && \ + mkdir -p /app/DMS_Attachments/Deleted && \ + chown -R www-data:www-data /app/DMS_Attachments + # Update appsettings.json with the correct paths for attachments +RUN sed -i 's#"folderpath": "DMS_Attachments/Active"#"folderpath": "/app/DMS_Attachments/Active"#' appsettings.json && \ + sed -i 's#"Deletepath": "DMS_Attachments/Deleted"#"Deletepath": "/app/DMS_Attachments/Deleted"#' appsettings.json + +ENTRYPOINT ["dotnet", "DamageAssesment.Api.Attachments.dll"] \ No newline at end of file diff --git a/DamageAssesmentApi/DamageAssesment.Api.Employees/DamageAssesment.Api.Employees.csproj b/DamageAssesmentApi/DamageAssesment.Api.Employees/DamageAssesment.Api.Employees.csproj index a696247..bbaad6a 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Employees/DamageAssesment.Api.Employees.csproj +++ b/DamageAssesmentApi/DamageAssesment.Api.Employees/DamageAssesment.Api.Employees.csproj @@ -5,6 +5,8 @@ enable enable True + Linux + ..\docker-compose.dcproj @@ -12,6 +14,7 @@ + diff --git a/DamageAssesmentApi/DamageAssesment.Api.Employees/Dockerfile b/DamageAssesmentApi/DamageAssesment.Api.Employees/Dockerfile new file mode 100644 index 0000000..cbc7d04 --- /dev/null +++ b/DamageAssesmentApi/DamageAssesment.Api.Employees/Dockerfile @@ -0,0 +1,21 @@ +#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:6.0 AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["DamageAssesment.Api.Employees/DamageAssesment.Api.Employees.csproj", "DamageAssesment.Api.Employees/"] +RUN dotnet restore "DamageAssesment.Api.Employees/DamageAssesment.Api.Employees.csproj" +COPY . . +WORKDIR "/src/DamageAssesment.Api.Employees" +RUN dotnet build "DamageAssesment.Api.Employees.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "DamageAssesment.Api.Employees.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "DamageAssesment.Api.Employees.dll"] \ No newline at end of file diff --git a/DamageAssesmentApi/DamageAssesment.Api.Employees/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Employees/Program.cs index 7d5dbff..2d0d739 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Employees/Program.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Employees/Program.cs @@ -33,7 +33,11 @@ var app = builder.Build(); if (app.Environment.IsDevelopment()) { app.UseSwagger(); - app.UseSwaggerUI(); + app.UseSwaggerUI(options => + { + options.SwaggerEndpoint("/swagger/v1/swagger.json", ""); + // options.RoutePrefix = ""; // Serve Swagger UI at the root URL + }); } app.UseAuthorization(); diff --git a/DamageAssesmentApi/DamageAssesment.Api.Employees/Properties/launchSettings.json b/DamageAssesmentApi/DamageAssesment.Api.Employees/Properties/launchSettings.json index 2c81744..ad75199 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Employees/Properties/launchSettings.json +++ b/DamageAssesmentApi/DamageAssesment.Api.Employees/Properties/launchSettings.json @@ -1,23 +1,14 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:14425", - "sslPort": 0 - } - }, +{ "profiles": { "DamageAssesment.Api.Employees": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", - "applicationUrl": "http://localhost:5135", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5135" }, "IIS Express": { "commandName": "IISExpress", @@ -26,6 +17,21 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "publishAllPorts": true + } + }, + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:14425", + "sslPort": 0 } } -} +} \ No newline at end of file diff --git a/DamageAssesmentApi/DamageAssesment.Api.Locations/DamageAssesment.Api.Locations.csproj b/DamageAssesmentApi/DamageAssesment.Api.Locations/DamageAssesment.Api.Locations.csproj index a696247..bbaad6a 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Locations/DamageAssesment.Api.Locations.csproj +++ b/DamageAssesmentApi/DamageAssesment.Api.Locations/DamageAssesment.Api.Locations.csproj @@ -5,6 +5,8 @@ enable enable True + Linux + ..\docker-compose.dcproj @@ -12,6 +14,7 @@ + diff --git a/DamageAssesmentApi/DamageAssesment.Api.Locations/Dockerfile b/DamageAssesmentApi/DamageAssesment.Api.Locations/Dockerfile new file mode 100644 index 0000000..bb9aeb9 --- /dev/null +++ b/DamageAssesmentApi/DamageAssesment.Api.Locations/Dockerfile @@ -0,0 +1,21 @@ +#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:6.0 AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["DamageAssesment.Api.Locations/DamageAssesment.Api.Locations.csproj", "DamageAssesment.Api.Locations/"] +RUN dotnet restore "DamageAssesment.Api.Locations/DamageAssesment.Api.Locations.csproj" +COPY . . +WORKDIR "/src/DamageAssesment.Api.Locations" +RUN dotnet build "DamageAssesment.Api.Locations.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "DamageAssesment.Api.Locations.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "DamageAssesment.Api.Locations.dll"] \ No newline at end of file diff --git a/DamageAssesmentApi/DamageAssesment.Api.Locations/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Locations/Program.cs index c152e61..ed592ad 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Locations/Program.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Locations/Program.cs @@ -32,7 +32,11 @@ var app = builder.Build(); if (app.Environment.IsDevelopment()) { app.UseSwagger(); - app.UseSwaggerUI(); + app.UseSwaggerUI(options => + { + options.SwaggerEndpoint("/swagger/v1/swagger.json", ""); + // options.RoutePrefix = ""; // Serve Swagger UI at the root URL + }); } app.UseAuthorization(); diff --git a/DamageAssesmentApi/DamageAssesment.Api.Locations/Properties/launchSettings.json b/DamageAssesmentApi/DamageAssesment.Api.Locations/Properties/launchSettings.json index 940c35e..ee6e004 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Locations/Properties/launchSettings.json +++ b/DamageAssesmentApi/DamageAssesment.Api.Locations/Properties/launchSettings.json @@ -1,23 +1,14 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:20458", - "sslPort": 0 - } - }, +{ "profiles": { "DamageAssesment.Api.Locations": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", - "applicationUrl": "http://localhost:5213", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5213" }, "IIS Express": { "commandName": "IISExpress", @@ -26,6 +17,21 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "publishAllPorts": true + } + }, + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:20458", + "sslPort": 0 } } -} +} \ No newline at end of file diff --git a/DamageAssesmentApi/DamageAssesment.Api.Questions/Controllers/QuestionsController.cs b/DamageAssesmentApi/DamageAssesment.Api.Questions/Controllers/QuestionsController.cs index ae98924..f7eb968 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Questions/Controllers/QuestionsController.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Questions/Controllers/QuestionsController.cs @@ -17,7 +17,7 @@ namespace DamageAssesment.Api.Questions.Controllers } /// - /// GET request for retrieving questions. + /// GET request for retrieving questions, e.g api/fr/Questions (default returns all language). /// // get all questions diff --git a/DamageAssesmentApi/DamageAssesment.Api.Questions/DamageAssesment.Api.Questions.csproj b/DamageAssesmentApi/DamageAssesment.Api.Questions/DamageAssesment.Api.Questions.csproj index a696247..bbaad6a 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Questions/DamageAssesment.Api.Questions.csproj +++ b/DamageAssesmentApi/DamageAssesment.Api.Questions/DamageAssesment.Api.Questions.csproj @@ -5,6 +5,8 @@ enable enable True + Linux + ..\docker-compose.dcproj @@ -12,6 +14,7 @@ + diff --git a/DamageAssesmentApi/DamageAssesment.Api.Questions/Dockerfile b/DamageAssesmentApi/DamageAssesment.Api.Questions/Dockerfile new file mode 100644 index 0000000..11f44c9 --- /dev/null +++ b/DamageAssesmentApi/DamageAssesment.Api.Questions/Dockerfile @@ -0,0 +1,21 @@ +#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:6.0 AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["DamageAssesment.Api.Questions/DamageAssesment.Api.Questions.csproj", "DamageAssesment.Api.Questions/"] +RUN dotnet restore "DamageAssesment.Api.Questions/DamageAssesment.Api.Questions.csproj" +COPY . . +WORKDIR "/src/DamageAssesment.Api.Questions" +RUN dotnet build "DamageAssesment.Api.Questions.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "DamageAssesment.Api.Questions.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "DamageAssesment.Api.Questions.dll"] \ No newline at end of file diff --git a/DamageAssesmentApi/DamageAssesment.Api.Questions/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Questions/Program.cs index 321c989..a15343e 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Questions/Program.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Questions/Program.cs @@ -36,7 +36,7 @@ var app = builder.Build(); if (app.Environment.IsDevelopment()) { app.UseSwagger(); - app.UseSwaggerUI(); + app.UseSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", ""); }); } app.UseAuthorization(); diff --git a/DamageAssesmentApi/DamageAssesment.Api.Questions/Properties/launchSettings.json b/DamageAssesmentApi/DamageAssesment.Api.Questions/Properties/launchSettings.json index e4e08ae..acc789d 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Questions/Properties/launchSettings.json +++ b/DamageAssesmentApi/DamageAssesment.Api.Questions/Properties/launchSettings.json @@ -1,23 +1,14 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:60754", - "sslPort": 0 - } - }, +{ "profiles": { "DamageAssesment.Api.Questions": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", - "applicationUrl": "http://localhost:5133", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5133" }, "IIS Express": { "commandName": "IISExpress", @@ -26,6 +17,21 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "publishAllPorts": true + } + }, + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:60754", + "sslPort": 0 } } -} +} \ No newline at end of file diff --git a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/DamageAssesment.Api.SurveyResponses.csproj b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/DamageAssesment.Api.SurveyResponses.csproj index 02ef277..8c36ffa 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/DamageAssesment.Api.SurveyResponses.csproj +++ b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/DamageAssesment.Api.SurveyResponses.csproj @@ -5,6 +5,8 @@ enable enable True + Linux + ..\docker-compose.dcproj @@ -13,6 +15,7 @@ + diff --git a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Dockerfile b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Dockerfile new file mode 100644 index 0000000..0001073 --- /dev/null +++ b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Dockerfile @@ -0,0 +1,21 @@ +#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:6.0 AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["DamageAssesment.Api.SurveyResponses/DamageAssesment.Api.SurveyResponses.csproj", "DamageAssesment.Api.SurveyResponses/"] +RUN dotnet restore "DamageAssesment.Api.SurveyResponses/DamageAssesment.Api.SurveyResponses.csproj" +COPY . . +WORKDIR "/src/DamageAssesment.Api.SurveyResponses" +RUN dotnet build "DamageAssesment.Api.SurveyResponses.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "DamageAssesment.Api.SurveyResponses.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "DamageAssesment.Api.SurveyResponses.dll"] \ No newline at end of file diff --git a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Program.cs index cf41624..672b1e9 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Program.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Program.cs @@ -70,7 +70,7 @@ var app = builder.Build(); if (app.Environment.IsDevelopment()) { app.UseSwagger(); - app.UseSwaggerUI(); + app.UseSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", ""); }); } app.UseAuthorization(); diff --git a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Properties/launchSettings.json b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Properties/launchSettings.json index 0d51b15..3aa93ec 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Properties/launchSettings.json +++ b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/Properties/launchSettings.json @@ -1,23 +1,14 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:58856", - "sslPort": 0 - } - }, +{ "profiles": { "DamageAssesment.Api.SurveyResponses": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", - "applicationUrl": "http://localhost:5104", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5104" }, "IIS Express": { "commandName": "IISExpress", @@ -26,6 +17,21 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "publishAllPorts": true + } + }, + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:58856", + "sslPort": 0 } } -} +} \ No newline at end of file diff --git a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/appsettings.json b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/appsettings.json index 2d6dfe4..4e7bc46 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/appsettings.json +++ b/DamageAssesmentApi/DamageAssesment.Api.SurveyResponses/appsettings.json @@ -6,14 +6,23 @@ } }, "AllowedHosts": "*", - "EndPointSettings": { - "AnswerUrlBase": "http://localhost:5200", - "LocationUrlBase": "http://localhost:5213", - "RegionUrlBase": "http://localhost:5211", - "QuestionUrlBase": "http://localhost:5133", - "EmployeeUrlBase": "http://localhost:5135", - "AttachmentUrlBase": "http://localhost:5243", - "SurveyUrlBase": "http://localhost:5009" + //"EndPointSettings": { + // "AnswerUrlBase": "http://localhost:5200", + // "LocationUrlBase": "http://localhost:5213", + // "RegionUrlBase": "http://localhost:5211", + // "QuestionUrlBase": "http://localhost:5133", + // "EmployeeUrlBase": "http://localhost:5135", + // "AttachmentUrlBase": "http://localhost:5243", + // "SurveyUrlBase": "http://localhost:5009" + //}, + + "EndPointSettings": { + "AnswerUrlBase": "http://damageassesment.api.answers:80", + "LocationUrlBase": "http://damageassesment.api.locations:80", + "QuestionUrlBase": "http://damageassesment.api.questions:80", + "EmployeeUrlBase": "http://damageassesment.api.employees:80", + "AttachmentUrlBase": "http://damageassesment.api.attachments:80", + "SurveyUrlBase": "http://damageassesment.api.survey:80" + } } -} diff --git a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Controllers/SurveysController.cs b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Controllers/SurveysController.cs index e360e53..eb96f87 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Controllers/SurveysController.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Controllers/SurveysController.cs @@ -13,10 +13,13 @@ namespace DamageAssesment.Api.Surveys.Controllers { this.surveyProvider = surveyProvider; } + /// - /// GET request for retrieving surveys. + /// GET request for retrieving surveys /// - + /// + /// This endpoint retrieves surveys. You can use it to get all surveys or surveys for a specific language. + /// [Route("Surveys")] [Route("{Language}/Surveys")] [HttpGet] diff --git a/DamageAssesmentApi/DamageAssesment.Api.Surveys/DamageAssesment.Api.Survey.csproj b/DamageAssesmentApi/DamageAssesment.Api.Surveys/DamageAssesment.Api.Survey.csproj index a696247..bbaad6a 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Surveys/DamageAssesment.Api.Survey.csproj +++ b/DamageAssesmentApi/DamageAssesment.Api.Surveys/DamageAssesment.Api.Survey.csproj @@ -5,6 +5,8 @@ enable enable True + Linux + ..\docker-compose.dcproj @@ -12,6 +14,7 @@ + diff --git a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Dockerfile b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Dockerfile new file mode 100644 index 0000000..dcf5f8c --- /dev/null +++ b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Dockerfile @@ -0,0 +1,21 @@ +#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:6.0 AS base +WORKDIR /app +EXPOSE 80 + +FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build +WORKDIR /src +COPY ["DamageAssesment.Api.Surveys/DamageAssesment.Api.Survey.csproj", "DamageAssesment.Api.Surveys/"] +RUN dotnet restore "DamageAssesment.Api.Surveys/DamageAssesment.Api.Survey.csproj" +COPY . . +WORKDIR "/src/DamageAssesment.Api.Surveys" +RUN dotnet build "DamageAssesment.Api.Survey.csproj" -c Release -o /app/build + +FROM build AS publish +RUN dotnet publish "DamageAssesment.Api.Survey.csproj" -c Release -o /app/publish /p:UseAppHost=false + +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "DamageAssesment.Api.Survey.dll"] \ No newline at end of file diff --git a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Program.cs b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Program.cs index 98fa8a3..960ce13 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Program.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Program.cs @@ -6,6 +6,7 @@ using Microsoft.EntityFrameworkCore; using Microsoft.IdentityModel.Tokens; using System.Text; using System.Reflection; +using Microsoft.AspNetCore.Builder; var builder = WebApplication.CreateBuilder(args); @@ -52,7 +53,7 @@ var app = builder.Build(); if (app.Environment.IsDevelopment()) { app.UseSwagger(); - app.UseSwaggerUI(); + app.UseSwaggerUI(options => { options.SwaggerEndpoint("/swagger/v1/swagger.json", ""); }); } app.UseAuthentication(); diff --git a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Properties/launchSettings.json b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Properties/launchSettings.json index 247b548..2f661b9 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Properties/launchSettings.json +++ b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Properties/launchSettings.json @@ -1,23 +1,14 @@ -{ - "$schema": "https://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:51498", - "sslPort": 0 - } - }, +{ "profiles": { "DamageAssesment.Api.Surveys": { "commandName": "Project", - "dotnetRunMessages": true, "launchBrowser": true, "launchUrl": "swagger", - "applicationUrl": "http://localhost:5009", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5009" }, "IIS Express": { "commandName": "IISExpress", @@ -26,6 +17,21 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } + }, + "Docker": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "publishAllPorts": true + } + }, + "$schema": "https://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:51498", + "sslPort": 0 } } -} +} \ No newline at end of file diff --git a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Providers/SurveysProvider.cs b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Providers/SurveysProvider.cs index 38ea756..be43db1 100644 --- a/DamageAssesmentApi/DamageAssesment.Api.Surveys/Providers/SurveysProvider.cs +++ b/DamageAssesmentApi/DamageAssesment.Api.Surveys/Providers/SurveysProvider.cs @@ -54,7 +54,7 @@ namespace DamageAssesment.Api.Surveys.Providers IEnumerable surveysList = null; try { - logger?.LogInformation("Gell all Surveys from DB"); + logger?.LogInformation("Get all Surveys from DB"); var surveys = await surveyDbContext.Surveys.Where(s => s.IsEnabled == true).ToListAsync(); var surveyTranslations = await surveyDbContext.SurveysTranslation.ToListAsync(); diff --git a/DamageAssesmentApi/DamageAssesment.sln b/DamageAssesmentApi/DamageAssesment.sln index 101bcec..1fa1023 100644 --- a/DamageAssesmentApi/DamageAssesment.sln +++ b/DamageAssesmentApi/DamageAssesment.sln @@ -9,12 +9,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DamageAssesment.Api.Answers EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DamageAssesment.Api.Attachments", "DamageAssesment.Api.Attachments\DamageAssesment.Api.Attachments.csproj", "{FF619F3A-D1BB-4934-A0E1-6EF7D0DAACD6}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4CB40DC2-D9D2-4384-A7A6-9968F5C777A2}" - ProjectSection(SolutionItems) = preProject - ReadMe.txt = ReadMe.txt - ReadMe4Dev.txt = ReadMe4Dev.txt - EndProjectSection -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DamageAssesment.Api.Locations", "DamageAssesment.Api.Locations\DamageAssesment.Api.Locations.csproj", "{746C67BF-9949-4361-B5D2-358C7607750E}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DamageAssesment.Api.SurveyResponses", "DamageAssesment.Api.SurveyResponses\DamageAssesment.Api.SurveyResponses.csproj", "{D11808FE-AD1C-4BA6-87FD-9D18B2DC81F2}" @@ -37,6 +31,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DamageAssesment.Api.Employe EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DamageAssesment.Api.Employees.Test", "DamageAssesment.Api.Employees.Test\DamageAssesment.Api.Employees.Test.csproj", "{D6BF9AE9-72FA-4726-A326-35A35D27FFB8}" EndProject +Project("{E53339B2-1760-4266-BCC7-CA923CBCF16C}") = "docker-compose", "docker-compose.dcproj", "{BADDE601-D7A6-425C-A592-A7E365E26188}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -99,6 +95,10 @@ Global {D6BF9AE9-72FA-4726-A326-35A35D27FFB8}.Debug|Any CPU.Build.0 = Debug|Any CPU {D6BF9AE9-72FA-4726-A326-35A35D27FFB8}.Release|Any CPU.ActiveCfg = Release|Any CPU {D6BF9AE9-72FA-4726-A326-35A35D27FFB8}.Release|Any CPU.Build.0 = Release|Any CPU + {BADDE601-D7A6-425C-A592-A7E365E26188}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BADDE601-D7A6-425C-A592-A7E365E26188}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BADDE601-D7A6-425C-A592-A7E365E26188}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BADDE601-D7A6-425C-A592-A7E365E26188}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/DamageAssesmentApi/default-local.conf b/DamageAssesmentApi/default-local.conf new file mode 100644 index 0000000..c0db4a3 --- /dev/null +++ b/DamageAssesmentApi/default-local.conf @@ -0,0 +1,45 @@ + + + +server { + + listen 80; + server_name dev-services.damageasessment.net; + + location /service1 { + + rewrite /service1/(.*) /$1 break; + proxy_pass http://localhost:80/; # Replace with the address of your .NET Core application + } + location /service2 { + + rewrite /service2/(.*) /$1 break; + proxy_pass http://localhost:80/; # Replace with the address of your .NET Core application + } + location /service3 { + + rewrite /service3/(.*) /$1 break; + proxy_pass http://localhost:80/; # Replace with the address of your .NET Core application + } + location /service4 { + + rewrite /service4/(.*) /$1 break; + proxy_pass http://localhost:80/; # Replace with the address of your .NET Core application + } + location /service5 { + + rewrite /service5/(.*) /$1 break; + proxy_pass http://localhost:80/; # Replace with the address of your .NET Core application + } + location /service6 { + + rewrite /service6/(.*) /$1 break; + proxy_pass http://localhost:80/; # Replace with the address of your .NET Core application + } + location /service7 { + + rewrite /service7/(.*) /$1 break; + proxy_pass http://localhost:80/; # Replace with the address of your .NET Core application + } + +} diff --git a/DamageAssesmentApi/default.conf b/DamageAssesmentApi/default.conf new file mode 100644 index 0000000..1e8c1b5 --- /dev/null +++ b/DamageAssesmentApi/default.conf @@ -0,0 +1,45 @@ + + + +server { + + listen 80; + server_name dev-services.damageasessment.net; + + location /service1 { + + rewrite /service1/(.*) /$1 break; + proxy_pass http://172.17.0.1:80/; # Replace with the address of your .NET Core application + } + location /service2 { + + rewrite /service2/(.*) /$1 break; + proxy_pass http://172.17.0.1:80/; # Replace with the address of your .NET Core application + } + location /service3 { + + rewrite /service3/(.*) /$1 break; + proxy_pass http://172.17.0.1:80/; # Replace with the address of your .NET Core application + } + location /service4 { + + rewrite /service4/(.*) /$1 break; + proxy_pass http://172.17.0.1:80/; # Replace with the address of your .NET Core application + } + location /service5 { + + rewrite /service5/(.*) /$1 break; + proxy_pass http://172.17.0.1:80/; # Replace with the address of your .NET Core application + } + location /service6 { + + rewrite /service6/(.*) /$1 break; + proxy_pass http://172.17.0.1:80/; # Replace with the address of your .NET Core application + } + location /service7 { + + rewrite /service7/(.*) /$1 break; + proxy_pass http://172.17.0.1:80/; # Replace with the address of your .NET Core application + } + +} diff --git a/DamageAssesmentApi/docker-compose.dcproj b/DamageAssesmentApi/docker-compose.dcproj new file mode 100644 index 0000000..325679e --- /dev/null +++ b/DamageAssesmentApi/docker-compose.dcproj @@ -0,0 +1,21 @@ + + + + 2.1 + Linux + badde601-d7a6-425c-a592-a7e365e26188 + LaunchBrowser + {Scheme}://localhost:{ServicePort}/swagger + damageassesment.api.answers + + + + + + docker-compose.yml + + + + + + \ No newline at end of file diff --git a/DamageAssesmentApi/docker-compose.override.yml b/DamageAssesmentApi/docker-compose.override.yml new file mode 100644 index 0000000..4f1bab1 --- /dev/null +++ b/DamageAssesmentApi/docker-compose.override.yml @@ -0,0 +1,67 @@ +version: '3.4' + +services: + nginx: + container_name: my-nginx + image: nginx:latest + restart: always + ports: + - "80:80" + volumes: + - ./default.conf:/etc/nginx/conf.d/default-local.conf + #- ./certs:/etc/nginx/certs + #- ./error.log:/var/log/nginx/error.log + + damageassesment.api.answers: + environment: + - ASPNETCORE_ENVIRONMENT=Development + ports: + - "80" + + damageassesment.api.attachments: + environment: + - ASPNETCORE_ENVIRONMENT=Development + ports: + - "80" + + + damageassesment.api.employees: + environment: + - ASPNETCORE_ENVIRONMENT=Development + ports: + - "80" + + + damageassesment.api.locations: + environment: + - ASPNETCORE_ENVIRONMENT=Development + ports: + - "80" + + + damageassesment.api.questions: + environment: + - ASPNETCORE_ENVIRONMENT=Development + ports: + - "80" + + + damageassesment.api.survey: + environment: + - ASPNETCORE_ENVIRONMENT=Development + ports: + - "80" + + + damageassesment.api.surveyresponses: + environment: + - ASPNETCORE_ENVIRONMENT=Development + - services__Answers=http://damageassesment.api.answers:80 + - services__Locations=http://damageassesment.api.locations:80 + - services__Questions=http://damageassesment.api.questions:80 + - services__Employees=http://damageassesment.api.employees:80 + - services__Attachments=http://damageassesment.api.attachments:80 + - services__Surveys=http://damageassesment.api.survey:80 + ports: + - "80" + diff --git a/DamageAssesmentApi/docker-compose.yml b/DamageAssesmentApi/docker-compose.yml new file mode 100644 index 0000000..27b3387 --- /dev/null +++ b/DamageAssesmentApi/docker-compose.yml @@ -0,0 +1,50 @@ +version: '3.4' + +services: + damageassesment.api.answers: + image: ${DOCKER_REGISTRY-}damageassesmentapianswers + build: + context: . + dockerfile: DamageAssesment.Api.Answers/Dockerfile + + damageassesment.api.attachments: + image: ${DOCKER_REGISTRY-}damageassesmentapiattachments + build: + context: . + dockerfile: DamageAssesment.Api.Attachments/Dockerfile + + + damageassesment.api.employees: + image: ${DOCKER_REGISTRY-}damageassesmentapiemployees + build: + context: . + dockerfile: DamageAssesment.Api.Employees/Dockerfile + + + damageassesment.api.locations: + image: ${DOCKER_REGISTRY-}damageassesmentapilocations + build: + context: . + dockerfile: DamageAssesment.Api.Locations/Dockerfile + + + damageassesment.api.questions: + image: ${DOCKER_REGISTRY-}damageassesmentapiquestions + build: + context: . + dockerfile: DamageAssesment.Api.Questions/Dockerfile + + + damageassesment.api.survey: + image: ${DOCKER_REGISTRY-}damageassesmentapisurvey + build: + context: . + dockerfile: DamageAssesment.Api.Surveys/Dockerfile + + + damageassesment.api.surveyresponses: + image: ${DOCKER_REGISTRY-}damageassesmentapisurveyresponses + build: + context: . + dockerfile: DamageAssesment.Api.SurveyResponses/Dockerfile + diff --git a/DamageAssesmentApi/launchSettings.json b/DamageAssesmentApi/launchSettings.json new file mode 100644 index 0000000..097218b --- /dev/null +++ b/DamageAssesmentApi/launchSettings.json @@ -0,0 +1,17 @@ +{ + "profiles": { + "Docker Compose": { + "commandName": "DockerCompose", + "commandVersion": "1.0", + "serviceActions": { + "damageassesment.api.answers": "StartDebugging", + "damageassesment.api.attachments": "StartDebugging", + "damageassesment.api.employees": "StartDebugging", + "damageassesment.api.locations": "StartDebugging", + "damageassesment.api.questions": "StartDebugging", + "damageassesment.api.survey": "StartDebugging", + "damageassesment.api.surveyresponses": "StartDebugging" + } + } + } +} \ No newline at end of file diff --git a/DamageAssesmentApi/nginx.conf b/DamageAssesmentApi/nginx.conf new file mode 100644 index 0000000..13145bc --- /dev/null +++ b/DamageAssesmentApi/nginx.conf @@ -0,0 +1,86 @@ +user www-data; +worker_processes auto; +pid /run/nginx.pid; +include /etc/nginx/modules-enabled/*.conf; + +events { + worker_connections 768; + # multi_accept on; +} + +http { + + ## + # Basic Settings + ## + + sendfile on; + tcp_nopush on; + tcp_nodelay on; + keepalive_timeout 65; + types_hash_max_size 2048; + # server_tokens off; + + # server_names_hash_bucket_size 64; + # server_name_in_redirect off; + + include /etc/nginx/mime.types; + default_type application/octet-stream; + + ## + # SSL Settings + ## + + ssl_protocols TLSv1 TLSv1.1 TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE + ssl_prefer_server_ciphers on; + + ## + # Logging Settings + ## + + access_log /var/log/nginx/access.log; + error_log /var/log/nginx/error.log; + + ## + # Gzip Settings + ## + + gzip on; + + # gzip_vary on; + # gzip_proxied any; + # gzip_comp_level 6; + # gzip_buffers 16 8k; + # gzip_http_version 1.1; + # gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript; + + ## + # Virtual Host Configs + ## + + #include /etc/nginx/conf.d/*.conf; + #include /etc/nginx/sites-enabled/*; + include /etc/nginx/sites-available/*; +} + + +#mail { +# # See sample authentication script at: +# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript +# +# # auth_http localhost/auth.php; +# # pop3_capabilities "TOP" "USER"; +# # imap_capabilities "IMAP4rev1" "UIDPLUS"; +# +# server { +# listen localhost:110; +# protocol pop3; +# proxy on; +# } +# +# server { +# listen localhost:143; +# protocol imap; +# proxy on; +# } +#}