mqttHub icon indicating copy to clipboard operation
mqttHub copied to clipboard

Server does not run as single file: -p:PublishSingleFile=true

Open asymetrixs opened this issue 3 years ago • 4 comments

Build with dotnet publish -f net5.0 -r linux-x64 -c Release --sc -p:PublishSingleFile=true leads to the following problem on start up:

[LOGO]
The official MQTT server implementation of MQTTnet
Copyright (c) 2017-2020 The MQTTnet Team
https://github.com/chkr1011/MQTTnet
System.ArgumentException: The path is empty. (Parameter 'path')
   at System.IO.Path.GetFullPath(String path)
   at System.Diagnostics.FileVersionInfo.GetVersionInfo(String fileName)
   at MQTTnet.Server.Program.PrintLogo()
   at MQTTnet.Server.Program.Main(String[] args)

Possibly related to API incompatibility

asymetrixs avatar Feb 15 '22 16:02 asymetrixs

I don't think this will work at all because the application requires certain directories like the Python standard library and custom scripts and the folders.

chkr1011 avatar Feb 16 '22 17:02 chkr1011

It does start up without -p:PublishSingleFile=true but not sure if it really works, did not test it in action. What do you mean by "requires certain directories"? If it is possible for the user to add scripts, then the application should make sure that the directories are present after start-up (or create them). If so, please document which directories it creates. Also interesting for when running in a Docker container to persist the scripts. The Python standard library should be installed on the host, I guess. So the application should be able to find it via $PATH/%PATH% or a custom environment variable that points to Python.

asymetrixs avatar Feb 16 '22 18:02 asymetrixs

This application uses IronPython which comes with its own implementation of the standard library. I have no clue if an installed one on the system can or will be used instead. I will add the directories to the Wiki soon.

If it starts and accepts connections everything is fine.

chkr1011 avatar Feb 16 '22 18:02 chkr1011

IronPython is shipped with your application. So all fine after dotnet restore and dotnet build. The Debian image used in #5 does not ship with Python pre-installed, yet the MQTTnet.Server starts properly. So all good then.

asymetrixs avatar Feb 16 '22 18:02 asymetrixs