-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Remove code replaced by El Proxito and stateless servers #6535
Conversation
* `remove_dirs` is not needed to be executed anymore on webs because all the artifacts are saved on django storage backend now. So, this task is being replaced by `clean_project_resources`. * `move_files` is not needed because we don't need to sync files anymore to the web servers. Everything is uploaded from build servers to the django storage backend now. * broadcast finalization steps are replaced by only a call to `filefy`. The rest are not required anymore. * `update_static_metadata` won't be needed because the redirection done by the Flask app it will be replaced by El Proxito. * Syncers are removed completely. This copying is happening on build servers now and pushing the files to django storage backend.
We are serving documentation from El Proxito now and these middlewares are not required. The ability to server at `/docs/` is removed as well.
dc5448b
to
4d54072
Compare
We still need to run these tasks, no? Just not on the web servers but in cloud storage? |
This is done inside the readthedocs.org/readthedocs/projects/tasks.py Lines 784 to 796 in 0bdfeb6
(there is a call to |
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. |
Let's un-stale this PR for now. We are getting close to be able to remove all this code. We will be pinged back by stale bot in a month or so. |
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. |
…humitos/remove-web-related-tasks
I updated the PR with the latest changes. We are getting closer to be able to remove all this code. |
Yea, I'd like to get the symlink code removed this week if possible. It should make our tests a lot less spammy. |
@humitos looks like CI is unhappy with this, so still some work to do. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excited for this :)
def form_valid(self, form): | ||
broadcast( | ||
type='app', | ||
task=tasks.symlink_subproject, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a lot of the places we were calling symlink code we actually want to bust the cache for the project as well. Something to consider, though maybe we want to add that logic in a new PR after this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. In this particular case it was called when de-activating a version. The following line (which I didn't add) triggers a clean_project_resources
which removes the version from the storage. Seems like someone already thought about this 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems I already added some ones where I found the same case: https://github.com/readthedocs/readthedocs.org/pull/6535/files#diff-6e7074d6dee951393c702a7071bc0f1eR232
@@ -190,8 +185,6 @@ def USE_PROMOS(self): # noqa | |||
'django.contrib.auth.middleware.AuthenticationMiddleware', | |||
'django.contrib.messages.middleware.MessageMiddleware', | |||
'dj_pagination.middleware.PaginationMiddleware', | |||
'readthedocs.core.middleware.SubdomainMiddleware', | |||
'readthedocs.core.middleware.SingleVersionMiddleware', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we replace this in the proxito code, so probably need to update that as well.
@@ -577,7 +561,6 @@ def USE_PROMOS(self): # noqa | |||
GRAVATAR_DEFAULT_IMAGE = 'https://assets.readthedocs.org/static/images/silhouette.png' # NOQA | |||
OAUTH_AVATAR_USER_DEFAULT_URL = GRAVATAR_DEFAULT_IMAGE | |||
OAUTH_AVATAR_ORG_DEFAULT_URL = GRAVATAR_DEFAULT_IMAGE | |||
RESTRICTEDSESSIONS_AUTHED_ONLY = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems unrelated?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hrm... I'm not sure how this ended up here. I could re-add it, but we don't use it anymore, though. It's from https://github.com/mxsasha/django-restricted-sessions
'readthedocs.core.middleware.SubdomainMiddleware' | ||
) | ||
classes[index] = 'readthedocs.proxito.middleware.ProxitoMiddleware' | ||
classes.append('readthedocs.proxito.middleware.ProxitoMiddleware') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
…humitos/remove-web-related-tasks
`ln -nsf` is not called anymore when building docs.
We do not use `/docs/` anymore. We have more similar tests under rtd_tests/tests/test_resolver.py that are better.
Most of these files were migrated to `readthedocs/proxito/tests/test_old_redirects.py` and they are using the new settings and behaves according production. We could remove this file (`readthedocs/rtd_tests/tests/test_redirects.py`) completely probably. For now, I'm just removing the tests that are failing, tho
…humitos/remove-web-related-tasks
I worked on this to fix all the tests. I found and fixed these:
There are only 2 tests that are failing:
|
Yea, we shouldn't support those URL's anymore, so we don't need tests for them 👍 If we can migrate the test to the subdomain URL thats good, if there already is one, delete the |
This was only working on /docs/ paths. Now, with El Proxito we are not respecting the privacy level in community site.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm 👍 on this. We should merge it soon so that it doesn't diverge much from the main codeline. @readthedocs/core, if folks could take a look today, I think it makes sense to try and get this shipped for next week.
The other option I see if to merge it right after deploy next week -- that way we have some time for it to settle in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm in favor of merging this although I don't think I'm fully qualified to review every aspect. I'm glad to see all the syncer code go, however.
@@ -22,7 +21,6 @@ | |||
|
|||
admin.autodiscover() | |||
|
|||
handler404 = server_error_404 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you still want this. This is to handle dashboard 404s too, I believe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the 404, we are using the Django default on dashboard: https://docs.djangoproject.com/en/2.2/ref/views/#django.views.defaults.page_not_found --It keeps showing our custom 404.html
Maze Found.
Our custom handler is not more required because we are not doing any redirect now, just showing the Maze.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just checked that running the code with DEBUG=False still shows the Maze Found page on any 404 page under the dashboard.
@@ -46,8 +44,6 @@ | |||
url(r'^accounts/gold/', include('readthedocs.gold.urls')), | |||
# For redirects | |||
url(r'^builds/', include('readthedocs.builds.urls')), | |||
# For testing the 404's with DEBUG on. | |||
url(r'^404/$', handler404), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These enable the following URLs:
These are pretty useful in debugging and maybe they should be in the debug_urls
. I don't think we should remove just one of them though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't remove 500. That is still working.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/404/
will use the default Django handler and it should keep working normally as any other not found URL.
Showing it when DEBUG=False fails because we are not registering the URLs on DEBUG=False. Also, leaving just the default value does not work because it checks for the IP to be an INTERNAL_IP, which is not the case on Docker.
…humitos/remove-web-related-tasks
This can be removed too
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage actually decreased to 81.2% ha :(
https://codecov.io/gh/readthedocs/readthedocs.org/pull/6535/diff
I'm going to merge this so we have 1 week testing it before deploying. Yay! 🎉 |
After working on #6326 and realizing that PR will introduce a breaking change, I started playing around by removing more code that we know is not going to be needed once El Proxito is fully rolled out. The idea is to make just one breaking change with all of these remotions together if that is possible. This PR removes these,
This PR will introduce a big breaking change and force core team and contributors to use our docker-compose based solution for their development environment.