Commit 91c95c63 by John Eskew Committed by Brian Beggs

Add Makefile targets and README for easier PDB debugging.

parent a57e010c
......@@ -82,12 +82,18 @@ restore: ## Restore all data volumes from the host. WARNING: THIS WILL OVERWRIT
credentials-shell: ## Run a shell on the credentials container
docker exec -it edx.devstack.credentials env TERM=$(TERM) bash
credentials-attach: ## Attach to the credentials container process to use the debugger & see logs.
docker attach `docker ps -aqf "name=edx.devstack.credentials"`
e2e-shell: ## Start the end-to-end tests container with a shell
docker run -it --network=devstack_default -v ${DEVSTACK_WORKSPACE}/edx-e2e-tests:/edx-e2e-tests -v ${DEVSTACK_WORKSPACE}/edx-platform:/edx-e2e-tests/lib/edx-platform --env-file ${DEVSTACK_WORKSPACE}/edx-e2e-tests/devstack_env edxops/e2e env TERM=$(TERM) bash
lms-shell: ## Run a shell on the LMS container
docker exec -it edx.devstack.lms env TERM=$(TERM) /edx/app/edxapp/devstack.sh open
lms-attach: ## Attach to the LMS container process to use the debugger & see logs.
docker attach `docker ps -aqf "name=edx.devstack.lms"`
studio-shell: ## Run a shell on the Studio container
docker exec -it edx.devstack.studio env TERM=$(TERM) /edx/app/edxapp/devstack.sh open
......@@ -105,6 +111,9 @@ studio-static: ## Rebuild static assets for the Studio container
static: | credentials-static discovery-static ecommerce-static lms-static studio-static ## Rebuild static assets for all service containers
studio-attach: ## Attach to the Studio container process to use the debugger & see logs.
docker attach `docker ps -aqf "name=edx.devstack.cms"`
healthchecks: ## Run a curl against all services' healthcheck endpoints to make sure they are up. This will eventually be parameterized
./healthchecks.sh
......@@ -137,4 +146,3 @@ build-courses: ## NOTE: marketing course creation is not available for those out
check-memory:
@if [ `docker info --format '{{json .}}' | python -c "from __future__ import print_function; import sys, json; print(json.load(sys.stdin)['MemTotal'])"` -lt 2147483648 ]; then echo "\033[0;31mWarning, System Memory is set too low!!! Increase Docker memory to be at least 2 Gigs\033[0m"; fi || exit 0
\ No newline at end of file
......@@ -389,6 +389,42 @@ PyCharm Integration
See the `Pycharm Integration documentation`_.
Debugging using PDB
-------------------
It's possible to debug any of the containers' Python services using PDB. To do so,
start up the containers as usual with:
.. code:: sh
make dev.up
This command starts each relevant container with the equivalent of the '--it' option,
allowing a developer to attach to the process once the process is up and running.
To attach to the LMS/Studio containers and their process, use either:
.. code:: sh
make lms-attach
make studio-attach
Set a PDB breakpoint anywhere in the code using:
.. code:: sh
import pdb;pdb.set_trace()
and your attached session will offer an interactive PDB prompt when the breakpoint is hit.
To detach from the container, you'll need to stop the container with:
.. code:: sh
make stop
or a manual Docker command to bring down the container.
Running LMS and Studio Tests
----------------------------
......
......@@ -80,6 +80,9 @@ services:
depends_on:
- mysql
- memcached
# Allows attachment to the credentials service using 'docker attach <containerID>'.
stdin_open: true
tty: true
environment:
CACHE_LOCATION: edx.devstack.memcached:12211
DB_HOST: edx.devstack.mysql
......@@ -96,6 +99,9 @@ services:
- mysql
- elasticsearch
- memcached
# Allows attachment to the discovery service using 'docker attach <containerID>'.
stdin_open: true
tty: true
environment:
TEST_ELASTICSEARCH_URL: "http://edx.devstack.elasticsearch:9200"
ENABLE_DJANGO_TOOLBAR: 1
......@@ -109,6 +115,9 @@ services:
depends_on:
- mysql
- memcached
# Allows attachment to the ecommerce service using 'docker attach <containerID>'.
stdin_open: true
tty: true
environment:
ENABLE_DJANGO_TOOLBAR: 1
image: edxops/ecommerce:devstack
......@@ -122,6 +131,9 @@ services:
- mysql
- memcached
- mongo
# Allows attachment to the LMS service using 'docker attach <containerID>'.
stdin_open: true
tty: true
environment:
BOK_CHOY_HOSTNAME: edx.devstack.lms
BOK_CHOY_LMS_PORT: 18003
......@@ -145,6 +157,9 @@ services:
- mysql
- memcached
- mongo
# Allows attachment to the Studio service using 'docker attach <containerID>'.
stdin_open: true
tty: true
environment:
BOK_CHOY_HOSTNAME: edx.devstack.studio
BOK_CHOY_LMS_PORT: 18103
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment