SciProgCentre / plotly.kt

An interactive Kotlin wrapper for plotly visualization tools
https://sciprogcentre.github.io/plotly.kt/
Apache License 2.0
147 stars 21 forks source link

pushUpdates & pullUpdates Do Not Work in a Docker Container #84

Open alonalbert opened 2 years ago

alonalbert commented 2 years ago

More specifically, they do not work unless the container is running in host network mode.

The problem seems to be that the PlotlyServer baseUrl is using a hostname that is internal to the docker container but the value is being passed to the JavaScript which is running in an external network.

altavir commented 2 years ago

Indeed, the Url is resolved from the request. I will add a custom property to PlotlyServer, which will allow to set it up manually.

altavir commented 2 years ago

@alonalbert I've pushed a commit that possibly addresses the issue. It allows setting override host and port (not for Jupyter). If you can check it, please let me know.

alonalbert commented 2 years ago

I'll check when I get a chance, though I'm not sure it will be enough.

Keep in mind that the hostname might not be a static value. For a running server, i can access it via different hostnames. Local IP, local hostname, hostname alias, public IP, public IP with different port etc

I suspect you need something that gets the actual hostname and IP that the JavaScript actually is using, not a static setting.

Perhaps you already did that, i didn't look at the commit.

On Sat, Aug 28, 2021, 8:48 AM Alexander Nozik @.***> wrote:

Indeed, the Url is resolved from the request. I will add a custom property to PlotlyServer, which will allow to set it up manually.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mipt-npm/plotly.kt/issues/84#issuecomment-907644710, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAMVLEE4GHNNGOHQMDIGAXDT7EAMLANCNFSM5C6BLUQQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

altavir commented 2 years ago

It is not static.

Look at the code here: https://github.com/mipt-npm/plotly.kt/blob/5980ffd7abddcb0a273a644d77ad69d517b01201/plotlykt-server/src/main/kotlin/space/kscience/plotly/server/PlotlyServer.kt#L187-L193

It takes the URI from the request and then transforms it. So the actual address embedded in the page is depending on where the page has been requested from. I am just not sure, how it will work with multiple interfaces. Your suggestions are welcome.