Skip to content

Remote debugging of openlibrary site in docker#2097

Merged
mekarpeles merged 1 commit intointernetarchive:masterfrom
cdrini:feature/remote-debugging
May 23, 2019
Merged

Remote debugging of openlibrary site in docker#2097
mekarpeles merged 1 commit intointernetarchive:masterfrom
cdrini:feature/remote-debugging

Conversation

@cdrini
Copy link
Collaborator

@cdrini cdrini commented Apr 25, 2019

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):
ezgif-3-dd6048656c11

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:

  1. docker-compose up -d as usual and login as admin. Then docker-compose down.
  2. Open the repo in VS Code
  3. Edit the last line of docker/ol-docker-start.sh to say workers 1 instead of 4
  4. docker-compose up -d
  5. Edit .vscode/launch.json:
    a. if using a docker machine (or docker toolbox), update host (run docker-machine ip)
    b. on Windows, I had to change localRoot to be c:/Users/MyUser/openlibrary/; if you get "file not found" errors, you might have to do the same.
  6. Go to http://localhost:8080/admin/attach_debugger (or whatever your docker ip is) and click "Start"
  7. Go to the debug panel (Ctrl+Shift+D) in VS Code, and click "Python: Attach"
  8. Debug!

@cdrini cdrini added the devops label Apr 25, 2019
@cdrini cdrini requested a review from hornc April 25, 2019 02:47
@brad2014
Copy link

Before merging/closing this, can we find a home in the wiki or in a repo md file to document this feature?

@brad2014 brad2014 added the Theme: Development Issues related to the developer experience and the dev environment. [managed] label May 14, 2019
@brad2014 brad2014 added Affects: Configuration Related to the configuration of the dev/staging/prod environments, CI, docker, etc. [managed] and removed devops labels May 14, 2019
@cdrini
Copy link
Collaborator Author

cdrini commented May 14, 2019

Added a page here/to the sidebar: https://github.com/internetarchive/openlibrary/wiki/Debugger

@mekarpeles mekarpeles merged commit 70c9795 into internetarchive:master May 23, 2019
@cdrini cdrini deleted the feature/remote-debugging branch June 7, 2019 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Affects: Configuration Related to the configuration of the dev/staging/prod environments, CI, docker, etc. [managed] Theme: Development Issues related to the developer experience and the dev environment. [managed]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow debugging of local docker Open Library site

3 participants