-
Notifications
You must be signed in to change notification settings - Fork 31
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
Allow proper debugging of the Python Server #3056
base: main
Are you sure you want to change the base?
Conversation
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.
PR Type: Enhancement
PR Summary: The pull request introduces a new Docker Compose configuration and a debug entrypoint script aimed at improving the debugging experience for the Python server component of the project. It configures multiple services, including a Flask application, Nginx, ArangoDB, Swagger UI, and a frontend service, setting up an environment conducive to debugging with mapped volumes, environment variables, and exposed ports. Additionally, the entrypoint script for the Flask service includes steps to wait for ArangoDB to start, perform database migrations, install debugpy, and eventually start the Flask application with debugpy for enhanced debugging capabilities.
Decision: Comment
📝 Type: 'Enhancement' - not supported yet.
- Sourcery currently only approves 'Typo fix' PRs.
✅ Issue addressed: this change correctly addresses the issue or implements the desired feature.
No details provided.
📝 Complexity: the changes are too large or complex for Sourcery to approve.
- Unsupported files: the diff contains files that Sourcery does not currently support during reviews.
General suggestions:
- Consider evaluating the Docker Compose file version to ensure you're leveraging the most up-to-date features that could benefit your debugging environment, such as improved networking or volume configurations.
- Review the overall structure and configuration of the Docker Compose setup to ensure it aligns with best practices for service dependencies, especially in a debugging context where service availability and startup order can impact the debugging experience.
- Ensure that the installation of debugpy and other debug-related configurations do not inadvertently make their way into production environments, potentially exposing sensitive information or impacting performance.
Thanks for using Sourcery. We offer it for free for open source projects and would be very grateful if you could help us grow. If you like it, would you consider sharing Sourcery on your favourite social media? ✨
version: '3' | ||
|
||
services: | ||
|
||
sc-flask: | ||
command: bash docker/entrypoint.debug.sh | ||
env_file: | ||
- server/env/.dev.env | ||
volumes: | ||
- ./server/:/opt/sc/sc-flask | ||
- ./client/:/opt/sc/frontend | ||
ports: | ||
- '5000:5000' | ||
- '5679:5679' | ||
|
||
sc-nginx: | ||
volumes: | ||
- ./client/:/opt/sc/static | ||
command: bash entry-point.dev.sh | ||
|
||
sc-arangodb: | ||
env_file: | ||
- server/env/.dev.env | ||
ports: | ||
- '8529:8529' | ||
|
||
sc-swagger: | ||
ports: | ||
- '8080:8080' | ||
|
||
sc-frontend: | ||
command: npm run dev | ||
volumes: | ||
- ./client/elements:/opt/sc/frontend/elements | ||
- ./client/utils:/opt/sc/frontend/utils | ||
- ./client/img:/opt/sc/frontend/img | ||
- ./client/localization:/opt/sc/frontend/localization | ||
- ./client/index.html:/opt/sc/frontend/index.html | ||
- ./client/redux-store.js:/opt/sc/frontend/redux-store.js | ||
- ./client/webpack.config.js:/opt/sc/frontend/webpack.config.js | ||
- ./client/localization/elements:/opt/sc/frontend/localization/elements | ||
ports: | ||
- '3000:3000' |
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.
suggestion (llm): Using Docker Compose version 3 is a good choice for compatibility, but consider if features from newer versions, such as 3.8 or even the latest in the version 3 series, could offer enhancements or needed functionalities for your project, especially in terms of networking and volume options.
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.
NOT WORKING YET. Help appreciated :)
- ./client/:/opt/sc/frontend | ||
ports: | ||
- '5000:5000' | ||
- '5679:5679' |
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.
We will need to expose a port for the debugger
services: | ||
|
||
sc-flask: | ||
command: bash docker/entrypoint.debug.sh |
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.
Point to a new debug entrypoint
@@ -59,6 +59,16 @@ server { | |||
} | |||
|
|||
include "/etc/nginx/configurations/sc.nginx.conf"; | |||
|
|||
location /api/ { |
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.
Moved in from sc.* because the dev (/debug?) config will have to be different.
@@ -12,4 +11,8 @@ server { | |||
proxy_set_header Upgrade $http_upgrade; | |||
proxy_set_header Connection "Upgrade"; | |||
} | |||
location /api/ { |
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 is broken and I'm not sure why. Any ideas @ihongda?
pip install debugpy | ||
cd .. | ||
touch /tmp/.done.info | ||
python server/wsgi.py # eventually I want this to start a debugpy server |
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.
The main difference here is that I'm trying to call the wsgi.py server file directly with python instead of going through the uwsgi program. This will be necessary to use the python debugger, but I haven't yet figured out how to hook up nginx to this 'raw' python server.
This PR (hopes to eventually) add support for debugging the python server with the VSCode Debugger tools.