Remote debugging of openlibrary site in docker #2097
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Feature. Allow for remote debugging the local site. Closes #2076 . Logging in doesn't seem to work with only 1 gunicorn worker (for some reason), so the flow is a bit awks, but I think still useful.
In action (sorry mouse is invisible):
Not crazy over the magic
/attach_debugger
endpoint; ideally I'd like to show a "Dev Tools" button visible on the homepage toolbar if the site is running locally, but not sure how to access configs from the template (if anyone has info on that). I think still this is worth merging as is, BUT WANT SOMEONE TO TRY IT BEFORE IT GETS MERGED. @hornc @mekarpeles One of you would be great candidates :)Technical
This requires VS Code + its Python extension. To use:
docker-compose up -d
as usual and login as admin. Thendocker-compose down
.docker/ol-docker-start.sh
to sayworkers 1
instead of4
docker-compose up -d
.vscode/launch.json
:a. if using a docker machine (or docker toolbox), update
host
(rundocker-machine ip
)b. on Windows, I had to change
localRoot
to bec:/Users/MyUser/openlibrary/
; if you get "file not found" errors, you might have to do the same.