Skip to content

Commit

Permalink
Update to .NET 8
Browse files Browse the repository at this point in the history
  • Loading branch information
flenny authored Sep 2, 2024
2 parents 98af077 + 14a78b9 commit 6baff1b
Show file tree
Hide file tree
Showing 27 changed files with 77 additions and 162 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0'
dotnet-version: '8.0'

# Run the npm ci command before building
# the dotnet project, because the project
Expand Down
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/src/ILICheck.Web/bin/Debug/net7.0/ILICheck.Web.dll",
"program": "${workspaceFolder}/src/ILICheck.Web/bin/Debug/net8.0/ILICheck.Web.dll",
"args": [],
"cwd": "${workspaceFolder}/src/ILICheck.Web",
"stopAtEntry": false,
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

## [Unreleased]

### Changed

- Updated to .NET 8.0.
- The app now runs on port 8080 inside the docker container. Please update your Docker compose!
- Default uid & gid of container user changed to 1654.

## v3.0.110 - 2024-05-16

### Added
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<PackageProjectUrl>https://github.com/GeoWerkstatt/interlis-check-service</PackageProjectUrl>
<RepositoryUrl>https://github.com/GeoWerkstatt/interlis-check-service.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<AnalysisLevel>7.0-recommended</AnalysisLevel>
<AnalysisLevel>8.0-recommended</AnalysisLevel>
</PropertyGroup>

<ItemGroup>
Expand Down
17 changes: 6 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
WORKDIR /src
ARG VERSION
ARG REVISION
Expand Down Expand Up @@ -38,7 +38,7 @@ RUN npx license-checker --json --production \
--customPath licenseCustomFormat.json \
--out ${PUBLISH_DIR}/ClientApp/build/license.json

FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS final
FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS final
ARG VERSION
ARG REVISION
ENV HOME=/app
Expand All @@ -62,13 +62,11 @@ RUN \
DEBIAN_FRONTEND=noninteractive && \
mkdir -p /usr/share/man/man1 /usr/share/man/man2 && \
apt-get update && \
apt-get install -y curl unzip default-jre-headless sudo vim htop cron libcap2-bin && \
apt-get install -y curl unzip default-jre-headless sudo vim htop cron && \
rm -rf /var/lib/apt/lists/*

# Add non-root user and create our folders
# Create our folders
RUN \
useradd --uid 941 --user-group --home $HOME --shell /bin/bash abc && \
usermod --groups users abc && \
mkdir -p \
$ILICHECK_APP_HOME_DIR \
$ILICHECK_APP_LOG_DIR \
Expand All @@ -80,7 +78,7 @@ RUN \
$ILITOOLS_MODELS_DIR \
$ILITOOLS_PLUGINS_DIR

EXPOSE 80
EXPOSE 8080
VOLUME $ILICHECK_APP_LOG_DIR
VOLUME $ILICHECK_UPLOADS_DIR
VOLUME $ILITOOLS_CONFIG_DIR
Expand All @@ -92,13 +90,10 @@ VOLUME $ILITOOLS_PLUGINS_DIR
ENV LANG=C.UTF-8
ENV LC_ALL=C.UTF-8

# Allow dotnet to bind to well known ports
RUN setcap CAP_NET_BIND_SERVICE=+eip /usr/share/dotnet/dotnet

COPY --from=build /app/publish $ILICHECK_APP_HOME_DIR
COPY docker-entrypoint.sh /entrypoint.sh
COPY ilivalidator-wrapper.sh /usr/local/bin/ilivalidator

HEALTHCHECK CMD curl --fail http://localhost/health || exit 1
HEALTHCHECK CMD curl --fail http://localhost:8080/health || exit 1

ENTRYPOINT ["/entrypoint.sh"]
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Mit [Docker](https://www.docker.com/) kann der *INTERLIS Web-Check-Service* in e
Um einen ersten Augenschein der Applikation zu nehmen, kann der Container in der Kommandozeile wie folgt gestartet werden:

```bash
docker run -it --rm -p 8080:80 ghcr.io/geowerkstatt/interlis-check-service:latest
docker run -it --rm -p 8080:8080 ghcr.io/geowerkstatt/interlis-check-service:latest
```

`docker-compose.yml`
Expand Down Expand Up @@ -107,12 +107,12 @@ services:
#
# environment:
# - PUID=1000
# Optional, Default user id 941
# Optional, Default user id 1654
# Using PUID and PGID allows to map the container's internal user to a user on the
# host machine which prevents permisson issues when writing files to the mounted volume
#
# - PGID=1000
# Optional, Default group id 941
# Optional, Default group id 1654
# Using PUID and PGID allows to map the container's internal user to a user on the
# host machine which prevents permisson issues when writing files to the mounted volume
#
Expand Down Expand Up @@ -179,11 +179,11 @@ services:
# Expose ports (HOST:CONTAINER)
#
# ports:
# - 3080:80
# Map port 80 in the container to any desired port on the Docker host
# INTERLIS Web-Check-Service web app runs on port 80 inside the container
# - 3080:8080
# Map port 8080 in the container to any desired port on the Docker host
# INTERLIS Web-Check-Service web app runs on port 8080 inside the container
ports:
- 3080:80
- 3080:8080
```
## Individuelle Anpassung
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.0
4.0
12 changes: 6 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,12 @@ services:
#
# environment:
# - PUID=1000
# Optional, Default user id 941
# Optional, Default user id 1654
# Using PUID and PGID allows to map the container's internal user to a user on the
# host machine which prevents permisson issues when writing files to the mounted volume
#
# - PGID=1000
# Optional, Default group id 941
# Optional, Default group id 1654
# Using PUID and PGID allows to map the container's internal user to a user on the
# host machine which prevents permisson issues when writing files to the mounted volume
#
Expand Down Expand Up @@ -146,8 +146,8 @@ services:
# Expose ports (HOST:CONTAINER)
#
# ports:
# - 3080:80
# Map port 80 in the container to any desired port on the Docker host
# INTERLIS Web-Check-Service web app runs on port 80 inside the container
# - 3080:8080
# Map port 8080 in the container to any desired port on the Docker host
# INTERLIS Web-Check-Service web app runs on port 8080 inside the container
ports:
- 3080:80
- 3080:8080
30 changes: 14 additions & 16 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,20 @@ download_and_configure_ilitool ilivalidator $ILIVALIDATOR_VERSION $ILITOOLS_HOME
echo "done!"

# Use default user:group if no $PUID and/or $PGID is provided.
groupmod -o -g ${PUID:-941} abc && \
usermod -o -u ${PGID:-941} abc &> /dev/null && \
usermod -aG sudo abc && \
echo "abc ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
groupmod -o -g ${PUID:-1654} app && \
usermod -o -u ${PGID:-1654} app &> /dev/null

# Change owner for our folders
echo -n "Fix permissions for mounted volumes ..." && \
chown -R abc:abc $ILICHECK_APP_HOME_DIR && \
chown -R abc:abc $ILICHECK_APP_LOG_DIR && \
chown -R abc:abc $ILICHECK_UPLOADS_DIR && \
chown -R abc:abc $ILICHECK_WEB_ASSETS_DIR && \
chown -R abc:abc $ILITOOLS_HOME_DIR && \
chown -R abc:abc $ILITOOLS_CONFIG_DIR && \
chown -R abc:abc $ILITOOLS_CATALOGUES_DIR && \
chown -R abc:abc $ILITOOLS_MODELS_DIR && \
chown -R abc:abc $ILITOOLS_PLUGINS_DIR && \
chown -R app:app $ILICHECK_APP_HOME_DIR && \
chown -R app:app $ILICHECK_APP_LOG_DIR && \
chown -R app:app $ILICHECK_UPLOADS_DIR && \
chown -R app:app $ILICHECK_WEB_ASSETS_DIR && \
chown -R app:app $ILITOOLS_HOME_DIR && \
chown -R app:app $ILITOOLS_CONFIG_DIR && \
chown -R app:app $ILITOOLS_CATALOGUES_DIR && \
chown -R app:app $ILITOOLS_MODELS_DIR && \
chown -R app:app $ILITOOLS_PLUGINS_DIR && \
echo "done!"

# Export current environment for all users and cron jobs
Expand All @@ -82,11 +80,11 @@ ilivalidator model repositories: $ILIVALIDATOR_MODEL_DIR
ilivalidator trace messages: $([[ $ILIVALIDATOR_ENABLE_TRACE = true ]] && echo enabled || echo disabled)
http proxy: ${PROXY:-no proxy set}
http proxy exceptions: $([[ -n $NO_PROXY ]] && echo $NO_PROXY || echo undefined)
user uid: $(id -u abc)
user gid: $(id -g abc)
user uid: $(id -u app)
user gid: $(id -g app)
timezone: $TZ
--------------------------------------------------------------------------
"

echo -e "INTERLIS web check service app is up and running!\n" && \
sudo -H --preserve-env --user abc dotnet ILICheck.Web.dll
sudo -H --preserve-env --user app dotnet ILICheck.Web.dll
3 changes: 0 additions & 3 deletions ilivalidator-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ proxy_host=${proxy_host#*://} # remove protocol
[[ $ILIVALIDATOR_ENABLE_TRACE = true ]] && options+=" --trace"
[[ $(find $ILITOOLS_PLUGINS_DIR -maxdepth 1 -type f -iname "*.jar" | grep .) ]] && [[ $is_gpkg = false ]] && options+=" --plugins $ILITOOLS_PLUGINS_DIR"

# Print executed commands to the Docker container log output
exec {BASH_XTRACEFD}> >(sudo tee /proc/1/fd/2)

# Execute ilivalidator/ili2gpkg with the given options
if [[ $ENABLE_GPKG_VALIDATION = true && $is_gpkg = true ]]
then
Expand Down
6 changes: 3 additions & 3 deletions src/ILICheck.Web/Controllers/DownloadController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public DownloadController(ILogger<DownloadController> logger, IFileProvider file
/// <returns>The ilivalidator log file.</returns>
[HttpGet]
[SwaggerResponse(StatusCodes.Status200OK, "Returns the ilivalidator log file.", ContentTypes = new[] { "text/xml; charset=utf-8", "application/geo+json" })]
[SwaggerResponse(StatusCodes.Status400BadRequest, "The server cannot process the request due to invalid or malformed request.", typeof(ProblemDetails), new[] { "application/json" })]
[SwaggerResponse(StatusCodes.Status400BadRequest, "The server cannot process the request due to invalid or malformed request.", typeof(ProblemDetails), "application/json")]
[SwaggerResponse(StatusCodes.Status404NotFound, "The log file for the requested jobId cannot be found.", ContentTypes = new[] { "application/json" })]
public IActionResult Download(Guid jobId, LogType logType)
{
Expand Down Expand Up @@ -63,8 +63,8 @@ public IActionResult Download(Guid jobId, LogType logType)
/// <param name="jobId">The job identifier.</param>
/// <returns>The log data for the specified <paramref name="jobId"/>.</returns>
[HttpGet("json")]
[SwaggerResponse(StatusCodes.Status200OK, "Returns the ilivalidator log data in JSON format.", typeof(IEnumerable<LogError>), new[] { "application/json" })]
[SwaggerResponse(StatusCodes.Status400BadRequest, "The server cannot process the request due to invalid or malformed request.", typeof(ValidationProblemDetails), new[] { "application/json" })]
[SwaggerResponse(StatusCodes.Status200OK, "Returns the ilivalidator log data in JSON format.", typeof(IEnumerable<LogError>), "application/json")]
[SwaggerResponse(StatusCodes.Status400BadRequest, "The server cannot process the request due to invalid or malformed request.", typeof(ValidationProblemDetails), "application/json")]
[SwaggerResponse(StatusCodes.Status404NotFound, "The log file for the requested jobId cannot be found.", ContentTypes = new[] { "application/json" })]
public IActionResult GetJsonLog(Guid jobId)
{
Expand Down
2 changes: 1 addition & 1 deletion src/ILICheck.Web/Controllers/SettingsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public SettingsController(ILogger<SettingsController> logger, IConfiguration con
/// </summary>
/// <returns>JSON-formatted client application settings.</returns>
[HttpGet]
[SwaggerResponse(StatusCodes.Status200OK, "The the application settings which can be used to configure a client.", typeof(SettingsResponse), new[] { "application/json" })]
[SwaggerResponse(StatusCodes.Status200OK, "The the application settings which can be used to configure a client.", typeof(SettingsResponse), "application/json")]
public IActionResult GetSettings()
{
logger.LogTrace("Application configuration requested.");
Expand Down
6 changes: 3 additions & 3 deletions src/ILICheck.Web/Controllers/StatusController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public StatusController(ILogger<StatusController> logger, IValidatorService vali
/// <param name="jobId" example="2e71ae96-e6ad-4b67-b817-f09412d09a2c">The job identifier.</param>
/// <returns>The status information for the specified <paramref name="jobId"/>.</returns>
[HttpGet("{jobId}")]
[SwaggerResponse(StatusCodes.Status200OK, "The job with the specified jobId was found.", typeof(StatusResponse), new[] { "application/json" })]
[SwaggerResponse(StatusCodes.Status400BadRequest, "The server cannot process the request due to invalid or malformed request.", typeof(ValidationProblemDetails), new[] { "application/json" })]
[SwaggerResponse(StatusCodes.Status404NotFound, "The job with the specified jobId cannot be found.", typeof(ProblemDetails), new[] { "application/json" })]
[SwaggerResponse(StatusCodes.Status200OK, "The job with the specified jobId was found.", typeof(StatusResponse), "application/json")]
[SwaggerResponse(StatusCodes.Status400BadRequest, "The server cannot process the request due to invalid or malformed request.", typeof(ValidationProblemDetails), "application/json")]
[SwaggerResponse(StatusCodes.Status404NotFound, "The job with the specified jobId cannot be found.", typeof(ProblemDetails), "application/json")]
public IActionResult GetStatus(ApiVersion version, Guid jobId)
{
logger.LogTrace("Status for job <{JobId}> requested.", jobId);
Expand Down
4 changes: 2 additions & 2 deletions src/ILICheck.Web/Controllers/UploadController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public UploadController(ILogger<UploadController> logger, IConfiguration configu
/// </remarks>
/// <returns>Information for a newly created validation job.</returns>
[HttpPost]
[SwaggerResponse(StatusCodes.Status201Created, "The validation job was successfully created and is now scheduled for execution.", typeof(UploadResponse), new[] { "application/json" })]
[SwaggerResponse(StatusCodes.Status400BadRequest, "The server cannot process the request due to invalid or malformed request.", typeof(ProblemDetails), new[] { "application/json" })]
[SwaggerResponse(StatusCodes.Status201Created, "The validation job was successfully created and is now scheduled for execution.", typeof(UploadResponse), "application/json")]
[SwaggerResponse(StatusCodes.Status400BadRequest, "The server cannot process the request due to invalid or malformed request.", typeof(ProblemDetails), "application/json")]
[SwaggerResponse(StatusCodes.Status413PayloadTooLarge, "The transfer file is too large. Max allowed request body size is 200 MB.")]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1629:DocumentationTextMustEndWithAPeriod", Justification = "Not applicable for code examples.")]
[SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1028:CodeMustNotContainTrailingWhitespace", Justification = "Not applicable for code examples.")]
Expand Down
10 changes: 0 additions & 10 deletions src/ILICheck.Web/Exceptions/GeoPackageException.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Runtime.Serialization;

namespace ILICheck.Web
{
Expand Down Expand Up @@ -37,14 +36,5 @@ public GeoPackageException(string message, Exception innerException)
: base(message, innerException)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="GeoPackageException"/> class
/// with serialized data.
/// </summary>
protected GeoPackageException(SerializationInfo info, StreamingContext streamingContext)
: base(info, streamingContext)
{
}
}
}
10 changes: 0 additions & 10 deletions src/ILICheck.Web/Exceptions/InvalidXmlException.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Runtime.Serialization;

namespace ILICheck.Web
{
Expand Down Expand Up @@ -37,14 +36,5 @@ public InvalidXmlException(string message, Exception innerException)
: base(message, innerException)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="InvalidXmlException"/> class
/// with serialized data.
/// </summary>
protected InvalidXmlException(SerializationInfo info, StreamingContext streamingContext)
: base(info, streamingContext)
{
}
}
}
20 changes: 0 additions & 20 deletions src/ILICheck.Web/Exceptions/MultipleTransferFileFoundException.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Runtime.Serialization;

namespace ILICheck.Web
{
Expand Down Expand Up @@ -46,24 +45,5 @@ public MultipleTransferFileFoundException(string fileExtension, string message,
{
FileExtension = fileExtension;
}

/// <summary>
/// Initializes a new instance of the <see cref="MultipleTransferFileFoundException"/> class
/// with serialized data.
/// </summary>
protected MultipleTransferFileFoundException(SerializationInfo info, StreamingContext streamingContext)
: base(info, streamingContext)
{
FileExtension = info.GetString(nameof(FileExtension));
}

/// <inheritdoc />
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
if (info == null) throw new ArgumentNullException(nameof(info));

info.AddValue(nameof(FileExtension), FileExtension);
base.GetObjectData(info, context);
}
}
}
10 changes: 0 additions & 10 deletions src/ILICheck.Web/Exceptions/TransferFileNotFoundException.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Runtime.Serialization;

namespace ILICheck.Web
{
Expand Down Expand Up @@ -37,14 +36,5 @@ public TransferFileNotFoundException(string message, Exception innerException)
: base(message, innerException)
{
}

/// <summary>
/// Initializes a new instance of the <see cref="TransferFileNotFoundException"/> class
/// with serialized data.
/// </summary>
protected TransferFileNotFoundException(SerializationInfo info, StreamingContext streamingContext)
: base(info, streamingContext)
{
}
}
}
Loading

0 comments on commit 6baff1b

Please sign in to comment.