Skip to content

Commit

Permalink
working with debugpy... kinda, going to readonly so there is clearly …
Browse files Browse the repository at this point in the history
…still a path mapping issue, but that is solveable
  • Loading branch information
GondekNP committed Aug 6, 2024
1 parent 5da42a3 commit 9c7598d
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 32 deletions.
5 changes: 2 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,11 @@
"source=${localEnv:HOME}/.aws,target=/root/.aws,type=bind", // AWS credentials
"source=${localEnv:HOME}/.config/gcloud,target=/root/.config/gcloud,type=bind", // GCP credentials
"source=${localEnv:HOME}/.ssh,target=/root/.ssh,type=bind" // SSH keys
// "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" // Docker socket
// "source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind" // Docker socket - now handling with above feature
],
"workspaceFolder": "/workspace",
"containerEnv": {
"LOCAL_ENV_HOME": "${localEnv:HOME}",
"DEVCONTAINER_SERVICE": "burn_backend"
"LOCAL_ENV_HOME": "${localEnv:HOME}"
},
"customizations": {
"vscode": {
Expand Down
19 changes: 0 additions & 19 deletions .devcontainer/start_proper_services.sh

This file was deleted.

4 changes: 2 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"host": "host.docker.internal",
"port": 5678
},
"pathMappings": [
Expand Down Expand Up @@ -53,7 +53,7 @@
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"host": "host.docker.internal",
"port": 8678
},
"pathMappings": [
Expand Down
15 changes: 8 additions & 7 deletions src/burn_backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
# Set up CORS for local development
allowed_origins = [os.getenv("LOCAL_ENDPOINT_TITILER", "http://localhost:8081")]

# Set up debugpy
import debugpy

debugpy.listen(("0.0.0.0", 5678))
print("Waiting for debugger attach...")
debugpy.wait_for_client()
print("Debugger attached")
if os.getenv("DEBUG_SERVICE") == "BURN_BACKEND":
# Set up debugpy
import debugpy

debugpy.listen(("0.0.0.0", 5678))
print("Waiting for debugger attach...")
debugpy.wait_for_client()
print("Debugger attached")

else:
allowed_origins = [os.getenv("GCP_CLOUD_RUN_ENDPOINT_TITILER")]
Expand Down
5 changes: 5 additions & 0 deletions src/burn_backend/routers/check/health.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,10 @@ def health(logger: Logger = Depends(get_cloud_logger)):
Returns:
Tuple[str, int]: A tuple containing the response message and status code.
"""
import debugpy

x = 3
debugpy.breakpoint()

logger.info("Health check endpoint called")
return "Alive", 200
2 changes: 1 addition & 1 deletion src/titiler/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
## LOCAL DEV ##
print(os.getenv("ENV"))

if os.getenv("ENV") == "LOCAL":
if os.getenv("ENV") == "LOCAL" and os.getenv("DEBUG_SERVICE") == "TITILER":
# Set up debugpy
import debugpy

Expand Down

0 comments on commit 9c7598d

Please sign in to comment.