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

Use history mode instead of hash mode (remove hash from GUI URL) #997

Merged
merged 4 commits into from
Apr 8, 2022

Conversation

jjnesbitt
Copy link
Member

Closes #785

@jjnesbitt jjnesbitt requested a review from mvandenburgh April 5, 2022 14:52
@satra
Copy link
Member

satra commented Apr 5, 2022

@AlmightyYakob - the current redirector does a few things that only a server can do. e.g. https://github.com/dandi/redirector/blob/master/serve.py#L132 (search for other HEAD requests and also the sitemap generation). if this is something that netlify could do, we can simply make netlfiy be the canonical source for dandiarchive.org and staging.dandiarchive.org.

would you be able to look into whether netlify can do those things?

if netlify cannot do that we can copy over this change to the redirector and serve the compiled js from the redirector. netlify can continue to do deployment previews, but it won't serve gui.dandiarchive.org.

we will want to integrate the redirector deployment into terraform and perhaps rewrite that server with fastapi instead of sanic.

@jjnesbitt
Copy link
Member Author

@AlmightyYakob - the current redirector does a few things that only a server can do. e.g. https://github.com/dandi/redirector/blob/master/serve.py#L132 (search for other HEAD requests and also the sitemap generation). if this is something that netlify could do, we can simply make netlfiy be the canonical source for dandiarchive.org and staging.dandiarchive.org.

would you be able to look into whether netlify can do those things?

if netlify cannot do that we can copy over this change to the redirector and serve the compiled js from the redirector. netlify can continue to do deployment previews, but it won't serve gui.dandiarchive.org.

we will want to integrate the redirector deployment into terraform and perhaps rewrite that server with fastapi instead of sanic.

I don't think Netlify would be able to do this, since to my knowledge it can't do programmatic redirection, just that defined in the Netlify.toml. However, I'd urge strongly against trying to replace Netlify with the redirector for serving the GUI, as Netlify provides us a lot of benefits, deploy previews just being one of them.

@waxlamp
Copy link
Member

waxlamp commented Apr 5, 2022

@AlmightyYakob - the current redirector does a few things that only a server can do. e.g. https://github.com/dandi/redirector/blob/master/serve.py#L132 (search for other HEAD requests and also the sitemap generation). if this is something that netlify could do, we can simply make netlfiy be the canonical source for dandiarchive.org and staging.dandiarchive.org.
would you be able to look into whether netlify can do those things?
if netlify cannot do that we can copy over this change to the redirector and serve the compiled js from the redirector. netlify can continue to do deployment previews, but it won't serve gui.dandiarchive.org.
we will want to integrate the redirector deployment into terraform and perhaps rewrite that server with fastapi instead of sanic.

I don't think Netlify would be able to do this, since to my knowledge it can't do programmatic redirection, just that defined in the Netlify.toml. However, I'd urge strongly against trying to replace Netlify with the redirector for serving the GUI, as Netlify provides us a lot of benefits, deploy previews just being one of them.

I agree with Jake on replacing Netlify with the redirector. We would be embracing wholesale many known and unknown costs by doing so. I'm planning to pull together a meeting where we can really dig into the problems we're facing so we can develop the right solution here.

@satra
Copy link
Member

satra commented Apr 5, 2022

i wouldn't replace netlify with the redirector for anything other than serving the instance project. if netlify pushes the compiled js somewhere, we would simply use that. or even use netlify as a proxy. we want to continue having it do deploy previews.

the main goal here is to remove gui.dandiarchive.org as a target. so only that bit would be removed from netlify.

let's go through a few options:

  1. keep netlify and let it serve from dandiarchive.org as the base url:

this would require understanding that any server side requests being done by the redirector has to come from the api server (which is ok). we would need to ensure that we turn on all the pieces of server side rendering in netlify such that our pages get indexed, etc.,. i believe there was an issue to this effect.

what we lose in this mode is to respond to anything at dandiarchiv.org, since it becomes a client side app. we need to ensure that the CLI understands this and only makes requests to the api. i.e. anyone developing tools has to understand that the web app is not a server, and needs to know what the server is.

  1. keep redirector and simply serve the netlify compiled code.

allows us to provide responses to requests and we simply serve the js code for the instance.

i'm ok with implementing 1, but conveying that tools should be built against api will be important.

@jjnesbitt
Copy link
Member Author

we would need to ensure that we turn on all the pieces of server side rendering in netlify such that our pages get indexed, etc.,. i believe there was an issue to this effect.

As of now I'd say this is out of scope, since currently our GUI is a Singe Page App (SPA), and thus doesn't really play nice with search engines (since mainly JS is returned from netlify, which is then rendered and injected into the html). The topic of SEO and search engine indexing is a separate discussion IMO, as it would be a much larger change.

@satra
Copy link
Member

satra commented Apr 5, 2022

As of now I'd say this is out of scope, since currently our GUI is a Singe Page App (SPA), and thus doesn't really play nice with search engines (since mainly JS is returned from netlify, which is then rendered and injected into the html).

there is a separate issue open about this. netlify has settings that automatically help with search that can be enabled. but the current role of the sitemap generator is related to search and is done by the redirector service at present.

@yarikoptic
Copy link
Member

i.e. anyone developing tools has to understand that the web app is not a server, and needs to know what the server is.

agree, and let's keep https://dandiarchive.org/server-info providing that information so in principle client could "ask" a server about what API server to talk to. BUT also /api could be proxied (or redirected?) to https://api.dandiarchive.org/api .

Overall -- in addition to #997 (comment) I still see a possible 3. in making "redirector" into a reverse proxy to "serve" at least the web UI from its respective underlying netflify, and otherwise not seen/visited directly by the users (don't know yet if possible to enforce redirection for direct access to https://gui.dandiarchive.org to the reverse proxy - should probably be possible).

Copy link
Contributor

@dchiquito dchiquito left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outside of the larger deployment discussion, I think removing the hash from the URL is a UX improvement and should be done now regardless.

@satra
Copy link
Member

satra commented Apr 6, 2022

I think removing the hash from the URL is a UX improvement and should be done now regardless.

how will existing urls in papers that have the # be redirected?

@jjnesbitt
Copy link
Member Author

how will existing urls in papers that have the # be redirected?

Wouldn't this just be a simple update to the redirector, to remove the # from the url to redirect to?

@satra
Copy link
Member

satra commented Apr 6, 2022

Wouldn't this just be a simple update to the redirector, to remove the # from the url to redirect to?

the redirector serves the domain dandiarchive.org not gui.dandiarchive.org. the # is only in the gui urls that people have copied and pasted into their papers.

@jjnesbitt
Copy link
Member Author

jjnesbitt commented Apr 6, 2022

the redirector serves the domain dandiarchive.org not gui.dandiarchive.org. the # is only in the gui urls that people have copied and pasted into their papers.

Oh, I didn't realize people were using the GUI URL with the # included. I thought the whole point of the redirector was so people could use stable dandiset URLs and not need to use GUI URLs directly.. It might be possible to check for that on the client.

@satra
Copy link
Member

satra commented Apr 6, 2022

I thought the whole point of the redirector was so people could use stable dandiset URLs and not need to use GUI URLs directly.

that was indeed the hope, the reality is people prefer copying from browser url bar rather than the share icon.

@jjnesbitt
Copy link
Member Author

that was indeed the hope, the reality is people prefer copying from browser url bar rather than the share icon.

Did some quick experimenting with the UI, and I think I could include a change to this PR that would automatically redirect those old URLs to the correct ones.

@satra
Copy link
Member

satra commented Apr 6, 2022

I think I could include a change to this PR that would automatically redirect those old URLs to the correct ones.

that would be great.

@jjnesbitt jjnesbitt requested a review from dchiquito April 6, 2022 21:59
@jjnesbitt
Copy link
Member Author

@satra 07dc0f0 contains the change I mentioned. I'd encourage you to play around with the deploy preview to make sure it redirects things as you expect. It's pretty simple but from what I can tell it seems to perform exactly as expected.

@satra
Copy link
Member

satra commented Apr 6, 2022

I can tell it seems to perform exactly as expected.

yup. seems to do the right thing.

Copy link
Member

@mvandenburgh mvandenburgh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jjnesbitt jjnesbitt merged commit b47f730 into master Apr 8, 2022
@jjnesbitt jjnesbitt deleted the 785-history-mode branch April 8, 2022 19:59
@dandibot
Copy link
Member

🚀 PR was released in v0.2.8 🚀

@dandibot dandibot added the released This issue/pull request has been released. label Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Web UI (vue): switch from "hash" to "history" mode?
7 participants