Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running on Linux #9

Open
vertonghenb opened this issue Sep 2, 2019 · 6 comments
Open

Running on Linux #9

vertonghenb opened this issue Sep 2, 2019 · 6 comments

Comments

@vertonghenb
Copy link

Since it's far cheaper to run on Linux, it might be beneficial to start looking to make this package run on Linux devices.

@arichika Any thoughts?

@arichika
Copy link
Owner

arichika commented Sep 3, 2019

The Windows has a great philosophy for compatibility. In terms of development productivity, I think that the Windows ecosystem remains low cost.

By the way, I think linux support is not difficult.

Just fix it like this,

RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? "wkhtmltopdf.exe" : "wkhtmltopdf";

If wkhtmltopdf works correctly, it will ... work. work? I think it works with minor modifications.

The most difficult part is to make sure that the latest wkhtmltopdf works correctly in various linux environments.

@vertonghenb
Copy link
Author

mmm gonna give a spin later this week, I was looking at the exact same line.
Well if you deploy to an Azure App Service the (basic tier) the costs of linux is divided by 7, thats why :)

@vertonghenb
Copy link
Author

vertonghenb commented Sep 8, 2019

@arichika good news, just tried your fork in a Azure Linux Self contained deployed and it works for the view with model, the others fail, don't know why yet but I think it has to do with the new routing system. The example Linux deploy can be found here.

Will you merge it into master and create a new deployment ?

@arichika
Copy link
Owner

arichika commented Sep 8, 2019

@vertonghenb thank you so much for good works.
I am using Docker for Windows and checking the operation with the latest wlhtmltopdf.
Please wait a little more. thank you.

@vertonghenb
Copy link
Author

vertonghenb commented Sep 8, 2019

@arichika ok sure, let me know if you need anything.

@arichika
Copy link
Owner

arichika commented Sep 9, 2019

I clarified some problems and solutions.

One, Generating url for internal action methods with port num.

For example, In the time that ActionAsPdf method calls self hosted action method using IUrlHelper.Action(), library will generated for internal refalencing url with additional ports number.

In the container like docker, the port number is explicitly disclosed, There is a problem here.

The program IUrlHelper.Action() generates a URL on port SomeDebugginPortNumber or SomeIntrnalPortNumer in container, but at that number, the container is not waiting for an external connection.

Since the started WkhtmlToPdf process is started by a process different from Container, it must be accessed with the published port number.

But unfortunately, the program doesn't know which port number will be started and which port number will be EXPOSE.

In short, we will need the following improvements:

Information about the host to connect to must be given as an external configuration value under the general Linux Container environment, even if it is your own action method.

Two, The Problems arounds WkHtmlToPdf Binaries

The latest WkHtmlToPdf has separate installation packages for each Linux distribution. It seems that the prerequisite packages required to work vary depending on the environment. I think that it is difficult to ensure proper operation between the test environment (eg Docker for Windows) and the execution environment (eg AzureWebApps for Linux) simply by placing the Wk binary in the project.

Also, since the procedure for installing dependent programs with Dockerfile is a common method, the WlHtmlToPdf binary should not be included in the Web project, and should be controlled by the execution environment administrator.

Solutions / Tasks

  • The installation of WkHtmlToPdf is specified in Dockerfile.
  • The host name and port number of the connection destination should be given from the outside. The default value guarantees the current operation for Windows.

Please wait a little while longer.

@arichika arichika added the WIP label Sep 9, 2019
@arichika arichika mentioned this issue Sep 9, 2019
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants