diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..fe1152b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,30 @@ +**/.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 +!**/.gitignore +!.git/HEAD +!.git/config +!.git/packed-refs +!.git/refs/heads/** \ No newline at end of file diff --git a/Wollmilchsau/Dockerfile b/Wollmilchsau/Dockerfile new file mode 100644 index 0000000..3ef0f24 --- /dev/null +++ b/Wollmilchsau/Dockerfile @@ -0,0 +1,30 @@ +# 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. + +# This stage is used when running from VS in fast mode (Default for Debug configuration) +FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base +USER $APP_UID +WORKDIR /app +EXPOSE 8080 +EXPOSE 8081 + + +# This stage is used to build the service project +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["Wollmilchsau/Wollmilchsau.csproj", "Wollmilchsau/"] +RUN dotnet restore "./Wollmilchsau/Wollmilchsau.csproj" +COPY . . +WORKDIR "/src/Wollmilchsau" +RUN dotnet build "./Wollmilchsau.csproj" -c $BUILD_CONFIGURATION -o /app/build + +# This stage is used to publish the service project to be copied to the final stage +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./Wollmilchsau.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration) +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "Wollmilchsau.dll"] \ No newline at end of file diff --git a/Wollmilchsau/Properties/launchSettings.json b/Wollmilchsau/Properties/launchSettings.json index 181fa11..5745c8b 100644 --- a/Wollmilchsau/Properties/launchSettings.json +++ b/Wollmilchsau/Properties/launchSettings.json @@ -1,23 +1,34 @@ { - "$schema": "https://json.schemastore.org/launchsettings.json", - "profiles": { - "http": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "applicationUrl": "http://localhost:5036", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } + "profiles": { + "http": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" }, - "https": { - "commandName": "Project", - "dotnetRunMessages": true, - "launchBrowser": true, - "applicationUrl": "https://localhost:7224;http://localhost:5036", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5036" + }, + "https": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "https://localhost:7224;http://localhost:5036" + }, + "Container (Dockerfile)": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}", + "environmentVariables": { + "ASPNETCORE_HTTPS_PORTS": "8081", + "ASPNETCORE_HTTP_PORTS": "8080" + }, + "publishAllPorts": true, + "useSSL": true } - } + }, + "$schema": "https://json.schemastore.org/launchsettings.json" +} \ No newline at end of file diff --git a/Wollmilchsau/Wollmilchsau.csproj b/Wollmilchsau/Wollmilchsau.csproj index 5686669..bd4102b 100644 --- a/Wollmilchsau/Wollmilchsau.csproj +++ b/Wollmilchsau/Wollmilchsau.csproj @@ -5,6 +5,8 @@ enable enable true + c5ef3966-d017-4e10-9476-d7ab9e3e5c1a + Linux @@ -18,6 +20,7 @@ + diff --git a/Wollmilchsau/appsettings.json b/Wollmilchsau/appsettings.json index 10f68b8..4da1fea 100644 --- a/Wollmilchsau/appsettings.json +++ b/Wollmilchsau/appsettings.json @@ -5,5 +5,60 @@ "Microsoft.AspNetCore": "Warning" } }, - "AllowedHosts": "*" + "AllowedHosts": "*", + "RateLimit": { + "MaxParallel": 5, + "RetryDelays": [ "00:00:02", "00:00:05", "00:00:15" ] + }, + "Matrix": { + "MAS": { + "BaseUrl": "https://synapseauth.bs18.de", + "Username": "01KKE7DKZT2SMDGSBANQMR98RV", + "Password": "CbqixMeihWLU6T" + }, + "Synapse": { + "BaseUrl": "https://synapse.bs18.de", + "BearerToken": "mct_pheE3gW6GR1HIg1z47ZVHGb1dwwIXq_Gsoev1" + } + }, + "Moodle": { + "BaseUrl": "https://moodle.bs18.de/webservice/rest/server.php", + "WsToken": "893de4687f2c4b9598b64ae2900bab2f" + + }, + "ConnectionStrings": { + "Marten": "Host=lxc-db3;Port=5432;Database=wollmilchsau;Username=wollmilchsau;Password=rVx0EoLDOnld", + "RedisCache": "lxc-matrix:6379" + }, + "OIDC": { + "Authority": "https://id.bs18.de/realms/master", + "ClientId": "wollmilchsau", + "ClientSecret": "4tPVKWc1nbAVbmk8jr11UHDAiymfMFrJ", + "ResponseType": "code", + "Scopes": [ "openid", "profile", "gruppen", "KlassenAttribut" ] + }, + "MSGraph": { + "ClientId": "c938782f-2779-45e6-8430-21238e69aa9e", + "TenantId": "872d7de7-8f8a-4c3a-a05d-d0fec30fb54d", + "ClientSecret": "Je6w3=1[h1U_VCK/UXLA7irVHIb[A34v", + "UseBetaForAuthMethods": false, + "Provisioning": { + "ForcePasswordResetOnFirstLogin": true, + "DefaultUsageLocation": "DE" + } + }, + "LDAP": { + "LdapUri": "ldaps://bs18-hh.de:10636", + "BindPassword": "skMXHFyf3fjW4iJhsoEyfQdc0wYthuVs6xim7BKhX3c5EZSuPcRrYYiGonynBnHW", + "BindDN": "cn=bs18ldap,ou=ldap,dc=bs18-hh,dc=de", + "BaseDN": "dc=bs18-hh,dc=de", + "UserBase": "ou=users", + "RoleBase": "ou=roles", + "GroupBase": "ou=groups", + "StudentsRole": "CN=ROLE_STUDENT", + "TeacherRole": "CN=ROLE_TEACHER", + "AdminRole": "CN=ROLE_ADMIN", + "KlasseGroupFilter": "(cn=klasse.*)", + "UserFilter": "(uid=*)" + } }