Skip to content

Commit

Permalink
Merge pull request #123 from zivillian/update
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
zivillian authored Aug 25, 2024
2 parents cdc94f3 + 0fad698 commit d900f53
Show file tree
Hide file tree
Showing 23 changed files with 91,642 additions and 93,792 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get tag
Expand All @@ -32,7 +32,7 @@ jobs:
with:
images: zivillian/ism7mqtt
- name: Build
uses: docker/build-push-action@v3
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
Expand Down
54 changes: 27 additions & 27 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v2
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Publish ism7mqtt Windows
Expand All @@ -45,51 +45,51 @@ jobs:
run: dotnet publish -c release -r linux-arm -p:PublishTrimmed=True --sc -nowarn:IL2026,IL2104 src/ism7config/ism7config.csproj
- name: Publish ism7config Linux ARM64
run: dotnet publish -c release -r linux-arm64 -p:PublishTrimmed=True --sc -nowarn:IL2026,IL2104 src/ism7config/ism7config.csproj
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: ism7mqtt-win-x64
path: src/ism7mqtt/bin/release/net6.0/win-x64/publish
- uses: actions/upload-artifact@v2
path: src/ism7mqtt/bin/release/net8.0/win-x64/publish
- uses: actions/upload-artifact@v4
with:
name: ism7mqtt-linux-x64
path: src/ism7mqtt/bin/release/net6.0/linux-x64/publish
- uses: actions/upload-artifact@v2
path: src/ism7mqtt/bin/release/net8.0/linux-x64/publish
- uses: actions/upload-artifact@v4
with:
name: ism7mqtt-linux-arm
path: src/ism7mqtt/bin/release/net6.0/linux-arm/publish
- uses: actions/upload-artifact@v2
path: src/ism7mqtt/bin/release/net8.0/linux-arm/publish
- uses: actions/upload-artifact@v4
with:
name: ism7mqtt-linux-arm64
path: src/ism7mqtt/bin/release/net6.0/linux-arm64/publish
- uses: actions/upload-artifact@v2
path: src/ism7mqtt/bin/release/net8.0/linux-arm64/publish
- uses: actions/upload-artifact@v4
with:
name: ism7proxy-win-x64
path: src/ism7proxy/bin/release/net6.0/win-x64/publish
- uses: actions/upload-artifact@v2
path: src/ism7proxy/bin/release/net8.0/win-x64/publish
- uses: actions/upload-artifact@v4
with:
name: ism7proxy-linux-x64
path: src/ism7proxy/bin/release/net6.0/linux-x64/publish
- uses: actions/upload-artifact@v2
path: src/ism7proxy/bin/release/net8.0/linux-x64/publish
- uses: actions/upload-artifact@v4
with:
name: ism7proxy-linux-arm
path: src/ism7proxy/bin/release/net6.0/linux-arm/publish
- uses: actions/upload-artifact@v2
path: src/ism7proxy/bin/release/net8.0/linux-arm/publish
- uses: actions/upload-artifact@v4
with:
name: ism7proxy-linux-arm64
path: src/ism7proxy/bin/release/net6.0/linux-arm64/publish
- uses: actions/upload-artifact@v2
path: src/ism7proxy/bin/release/net8.0/linux-arm64/publish
- uses: actions/upload-artifact@v4
with:
name: ism7config-win-x64
path: src/ism7config/bin/release/net6.0/win-x64/publish
- uses: actions/upload-artifact@v2
path: src/ism7config/bin/release/net8.0/win-x64/publish
- uses: actions/upload-artifact@v4
with:
name: ism7config-linux-x64
path: src/ism7config/bin/release/net6.0/linux-x64/publish
- uses: actions/upload-artifact@v2
path: src/ism7config/bin/release/net8.0/linux-x64/publish
- uses: actions/upload-artifact@v4
with:
name: ism7config-linux-arm
path: src/ism7config/bin/release/net6.0/linux-arm/publish
- uses: actions/upload-artifact@v2
path: src/ism7config/bin/release/net8.0/linux-arm/publish
- uses: actions/upload-artifact@v4
with:
name: ism7config-linux-arm64
path: src/ism7config/bin/release/net6.0/linux-arm64/publish
path: src/ism7config/bin/release/net8.0/linux-arm64/publish
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:6.0 AS build-env
FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
WORKDIR /app

COPY src/ism7ssl/ ./ism7ssl/
Expand All @@ -15,7 +15,7 @@ RUN if [ "$TARGETARCH" = "amd64" ]; then \
&& dotnet publish -c Release -o out -r $RID --sc -nowarn:IL2026,IL2104 ism7mqtt/ism7mqtt.csproj \
&& dotnet publish -c Release -o out -r $RID --sc -nowarn:IL2026,IL2104 ism7config/ism7config.csproj

FROM mcr.microsoft.com/dotnet/runtime-deps:6.0-alpine
FROM mcr.microsoft.com/dotnet/runtime-deps:8.0-alpine
WORKDIR /app
COPY --from=build-env /app/out .
ENV \
Expand Down
6 changes: 6 additions & 0 deletions src/ism7config/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,10 @@ public IEnumerable<long> Ids
class Parameter
{
public long ParameterId { get; set; }
}

[JsonSourceGenerationOptions(GenerationMode = JsonSourceGenerationMode.Metadata, WriteIndented = true)]
[JsonSerializable(typeof(Config))]
partial class ConfigContext : JsonSerializerContext
{
}
22 changes: 11 additions & 11 deletions src/ism7config/Program.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Net;
using System.Text.Json;
using CommonServiceLocator;
using LuCon.Common.ConditionService;
using LuCon.Common.ConfigService;
using LuCon.Common.Declarations;
Expand All @@ -10,8 +9,9 @@
using LuCon.SocketServer.GatewayInterface;
using LuCon.SocketServer.SocketServerBase;
using LuCon.WebPortal.StandaloneService;
using Microsoft.Extensions.Logging.Abstractions;
using Microsoft.Extensions.Logging;
using Mono.Options;
using NLog.Extensions.Logging;
using Wolf.Common.Busconfig;
using Wolf.SocketServer.ISMInterface;
using LogLevel = NLog.LogLevel;
Expand Down Expand Up @@ -57,10 +57,10 @@ static async Task Main(string[] args)
var logconsole = new NLog.Targets.ConsoleTarget("logconsole");
logconfig.AddRule(LogLevel.Trace, LogLevel.Fatal, logconsole);
NLog.LogManager.Configuration = logconfig;

var loggerFactory = new NLogLoggerFactory();
var unitOfWork = new InMemoryDatabase();
var textService = new TextService();
var nc = new NetworkConnector(unitOfWork, textService, new NetworkConnectorSettings{TcpClientConnectTimeoutMs = 60000}, new BusconfigPendingGatewaysSingleton());
var nc = new NetworkConnector(loggerFactory.CreateLogger<NetworkConnector>(), unitOfWork, textService, new NetworkConnectorSettings{TcpClientConnectTimeoutMs = 60000}, new BusconfigPendingGatewaysSingleton());
var streamHandler = new XplatStreamHandler();

var gw = new GatewayBO
Expand All @@ -77,8 +77,7 @@ static async Task Main(string[] args)
};
var converterTemplateService = new ConverterTemplateServiceImplISM(fileSystemSettings, _ => new MemoryStream(Resources.ConverterTemplates));
var deviceTemplateService = new DeviceTemplateServiceImplISM(fileSystemSettings, _ => new MemoryStream(Resources.DeviceTemplates));
var nullLoggerFactory = new NullLoggerFactory();
var bundleQueueWorker = new BundleQueueWorker(nullLoggerFactory,
var bundleQueueWorker = new BundleQueueWorker(loggerFactory,
new TelegrBundleRequestFactory(new TelegrBundleRequestFactorySettings(), deviceTemplateService),
new BundleQueueWorkerSettings(),
new GatewayConfigConverter(converterTemplateService));
Expand All @@ -99,10 +98,10 @@ static async Task Main(string[] args)
parameterTemplateService,
faultMessageHandler,
deviceTemplateService,
nullLoggerFactory,
loggerFactory,
eventPublisher);
var provider = new ServiceProvider(bundleQueueWorker, parameterStore, unitOfWork);
ServiceLocator.SetLocatorProvider(() => provider);
GatewayContext.InitStaticServiceProviderOnceAtStartup(provider);
var writerSettings = new BusconfigWriterSettings();
var busconfigWriter = new BusconfigWriter(converterTemplateService,
new SchemaViewTemplateServiceImpl(fileSystemSettings, _ => new MemoryStream(Resources.schema_view)),
Expand All @@ -115,7 +114,8 @@ static async Task Main(string[] args)
new BusconfigInstanceProviderImpl(),
eventPublisher,
datalogCacheWriter,
new GuiTemplateServiceImpl(fileSystemSettings, _ => new MemoryStream(Resources.gui)));
new GuiTemplateServiceImpl(fileSystemSettings, _ => new MemoryStream(Resources.gui)),
provider);
var responseHandler = new ResponseHandler(busconfigWriter, faultMessageHandler);

GatewayContext gc = null;
Expand All @@ -135,7 +135,7 @@ static async Task Main(string[] args)
{
Sid = gc.GatewayID.ToString()
};
gc.WriteObject(systemconfigRequest, typeof(SystemconfigRequest), EnXmlInterfaceType.SystemconfigRequest);
gc.WriteXMLObject(systemconfigRequest, typeof(SystemconfigRequest), EnXmlInterfaceType.SystemconfigRequest);
int tries = 0;
while (tries < 120)
{
Expand All @@ -162,7 +162,7 @@ static async Task Main(string[] args)
.ToList()
});
}
await File.WriteAllTextAsync(file, JsonSerializer.Serialize(config, new JsonSerializerOptions { WriteIndented = true }));
await File.WriteAllTextAsync(file, JsonSerializer.Serialize(config, ConfigContext.Default.Config));
return;
}
await Task.Delay(1000);
Expand Down
Loading

0 comments on commit d900f53

Please sign in to comment.