openworm / org.geppetto

Geppetto is an open-source platform to build web-based applications to visualize and simulate neuroscience data and models.
http://geppetto.org
Other
207 stars 50 forks source link

Solve contextPath problem across multiple types of deployments #609

Closed tarelli closed 4 years ago

tarelli commented 5 years ago
  1. [ ] Analyse all places in the code where the context path is currently used and how it relates to each deployment (e.g. in this deployment we have this contextpath, this is where the static files are served, this is where geppetto is served, etc.)
  2. [ ] Review current PRs which seems to work for JupyterHub and the Java deployment https://github.com/openworm/org.geppetto.frontend.jupyter/pull/57 https://github.com/openworm/org.geppetto.frontend/pull/859
  3. [ ] Remove hardcode of org.geppetto.frontend from jupyterGeppetto reading it from the GeppettoConfiguration.json instead
  4. [ ] geppetto should be served at the contextPath even for jupyter/python deployments while now it always comes from the root
  5. [ ] When in JupyterHub we have /user/asofsfoja/ that is currently also treated as the contextPath. This overcomplicates the logic because whatever is in GeppettoConfiguration.json is not "for sure" the contextPath anymore (as there might be something else afterwards, e.g. "/user/aofiafh/") and in the code we have string manipulations to identify the last slash and similar. A way to solve this might be to have something like a static cotextPath, i.e. what we find in the configuration, and a "dynamic" one that might or might not exist depending on the deployment and we should have a linear way to fetch whether this exists or not.
  6. [ ] The logic in the client to figure out where to get resources from is probably overcomplicated due to the two points above.
  7. [ ] Reconsider all the above under the light that maybe it shouldn't be the application (ie GeppettoConfiguration.json) the single source of truth for where things like the contextPath are configured but it could be argued that that should really just match the deployment. In that case how can we have a single source of truth deployment wise?
tarelli commented 5 years ago

Things I don't like

Geppetto.Main.js, line 106. String concatenation, checking for slash and in that case replacing the port??

                var host = GEPPETTO.MessageSocket.protocol + window.location.host + '/' + GEPPETTO_CONFIGURATION.contextPath + '/GeppettoServlet';
                if (GEPPETTO_CONFIGURATION.contextPath == "/") {
                    host = GEPPETTO.MessageSocket.protocol + window.location.host.replace("8081", "8080") + '/GeppettoServlet';
                }

Update Another thing I don't like, in Jupyter Hub (eg HNN): "contextPath": "org.geppetto.frontend/",

in Java "contextPath": "org.geppetto.frontend" (eg VFB),

Why the difference? Are they both valid now?

filippomc commented 5 years ago

Some thoughts after some merging of the above commits within a Jupyter application.

With this premises I think that it's best to get rid of contextPath into the application configuration and any other host parameters given to the application.

Proposal:

tarelli commented 5 years ago

Flavours that need to be tested:

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.