Skip to content

Commit

Permalink
Add debugger setup docs
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeljcollinsuk committed May 2, 2024
1 parent 505a225 commit 9aec630
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
35 changes: 35 additions & 0 deletions doc/launch.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"configurations": [
{
"name": "celery",
"type": "debugpy",
"request": "launch",
"module": "celery",
"args": [
"-A",
"controlpanel",
"worker",
"--loglevel=info",
],
},
{
"name": "runserver",
"type": "debugpy",
"request": "launch",
"args": [
"runserver"
],
"django": true,
"autoStartBrowser": false,
"program": "${workspaceFolder}/manage.py",
}
],
"compounds": [
{
"name": "Runserver/Celery",
"configurations": ["runserver", "celery"],
"preLaunchTask": "aws-sso-process",
"stopAll": true
}
]
}
17 changes: 17 additions & 0 deletions doc/running-devcontainer.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,23 @@ Then navigate to `localhost:8000`

On first run of the application, after logging in, you will likely run into a HelmError with the message `UPGRADE FAILED: failed to replace object: Job.batch "config-git-<user>-jupyter" is invalid`. See the troubleshooting section for a workaround to this issue.

### VSCode debugger setup

You can configure VSCode to run the Django server and Celery together, with AWS credentials for the
analytical-platform-development environment sourced. You can configure this and other debugger
configurations yourself following the [VSCode documentation](https://code.visualstudio.com/docs/editor/debugging)
or use the included example files to get started immediately by following these steps:

- In the project root create a `.vscode` folder if it does not already exist.
- Copy the [`launch.json.example`](./launch.json.example) and [`tasks.json.example`](./tasks.json.example)
files to the `.vscode` directory, removing the `.example` suffix.
- In the VSCode sidebar select the "Run and debug" icon, choose the `Runserver/Celery`
configuration and click the start button or use the F5 shortcut. Note: if you are not already logged
in with `aws-sso` check the terminal output for a link to do so.

The Django server and Celery should now both be running, and you can set breakpoints to help debug
your code. [See the VSCode documentation for more details about using the debugger.](https://code.visualstudio.com/docs/editor/debugging#_breakpoints)

### Run the worker of the app
Open another terminal to run the following line

Expand Down
12 changes: 12 additions & 0 deletions doc/tasks.json.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "aws-sso-process",
"type": "shell",
"command": "aws-sso process --sts-refresh --profile analytical-platform-development:AdministratorAccess"
}
]
}

0 comments on commit 9aec630

Please sign in to comment.