-
Notifications
You must be signed in to change notification settings - Fork 68
Debugging options #1157
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
base: dev
Are you sure you want to change the base?
Debugging options #1157
Changes from 3 commits
ae2eac4
36a23d5
faf9714
1a804cd
f082df1
db1973c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -101,6 +101,37 @@ web: | |||||||||
--network delphi-net --name delphi_web_epidata \ | ||||||||||
delphi_web_epidata >$(LOG_WEB) 2>&1 & | ||||||||||
|
||||||||||
.PHONY=web_debug | ||||||||||
web_debug: | ||||||||||
@# Stop container if running | ||||||||||
@if [ $(WEB_CONTAINER_ID) ]; then\ | ||||||||||
docker stop $(WEB_CONTAINER_ID);\ | ||||||||||
fi | ||||||||||
|
||||||||||
@# Setup virtual network if it doesn't exist | ||||||||||
@docker network ls | grep delphi-net || docker network create --driver bridge delphi-net | ||||||||||
|
||||||||||
@# Build the web_epidata image | ||||||||||
@cd repos/delphi/delphi-epidata; \ | ||||||||||
docker build -t delphi_web_epidata \ | ||||||||||
$(M1) \ | ||||||||||
-f ./devops/Dockerfile .;\ | ||||||||||
cd - | ||||||||||
|
||||||||||
@# Run the web server | ||||||||||
@# MODULE_NAME specifies the location of the `app` variable, the actual WSGI application object to run. | ||||||||||
@# see https://github.com/tiangolo/meinheld-gunicorn-docker#module_name | ||||||||||
@docker run --rm -p 127.0.0.1:5000:5000 -p 127.0.0.1:5678:5678 \ | ||||||||||
$(M1) \ | ||||||||||
--mount type=bind,source=$(CWD)repos/delphi/delphi-epidata/devops/start.sh,target=/start.sh,readonly \ | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
to support renaming the local There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually, im not sure that bash "trick" i used to add an in-line comment will work inside the makefile... |
||||||||||
--mount type=bind,source=$(CWD)repos/delphi/delphi-epidata/src/server,target=/app/delphi/epidata/server \ | ||||||||||
--env "MODULE_NAME=delphi.epidata.server.main" \ | ||||||||||
--env "SQLALCHEMY_DATABASE_URI=$(sqlalchemy_uri)" \ | ||||||||||
--env "FLASK_SECRET=abc" --env "FLASK_PREFIX=/epidata" --env "LOG_DEBUG" \ | ||||||||||
--network delphi-net --name delphi_web_epidata \ | ||||||||||
delphi_web_epidata >$(LOG_WEB) 2>&1 & | ||||||||||
|
||||||||||
|
||||||||||
.PHONY=db | ||||||||||
db: | ||||||||||
@# Stop container if running | ||||||||||
|
@@ -139,6 +170,9 @@ py: | |||||||||
.PHONY=all | ||||||||||
all: db web py | ||||||||||
|
||||||||||
.PHONY=debug | ||||||||||
debug: db web_debug py | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
.PHONY=test | ||||||||||
test: | ||||||||||
@docker run -i --rm --network delphi-net \ | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#! /usr/bin/env sh | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. rename this file to |
||
set -e | ||
|
||
# If there's a prestart.sh script in the /app directory, run it before starting | ||
PRE_START_PATH=/app/prestart.sh | ||
echo "Checking for script in $PRE_START_PATH" | ||
if [ -f $PRE_START_PATH ] ; then | ||
echo "Running script $PRE_START_PATH" | ||
. "$PRE_START_PATH" | ||
else | ||
echo "There is no script $PRE_START_PATH" | ||
fi | ||
|
||
export FLASK_APP=delphi.epidata.server.main | ||
|
||
pip install debugpy | ||
|
||
python -m debugpy --listen 0.0.0.0:5678 --wait-for-client -m flask run -h 0.0.0.0 -p 5000 |
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.
rename so its clear that this is specifically for vscode
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.
you should also include a link to your presentation here