Skip to content
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

Added a new optional section for VS Code specific debugging #461

Merged
merged 8 commits into from Oct 6, 2021
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
89 changes: 89 additions & 0 deletions distributed-calculator/.vscode/launch.json
@@ -0,0 +1,89 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Add App",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}/go/app.go",
"preLaunchTask": "daprd-debug-go",
"postDebugTask": "daprd-down-go"
},
{
"type": "pwa-node",
"request": "launch",
"name": "Divide App",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/node/app.js",
"preLaunchTask": "daprd-debug-node",
"postDebugTask": "daprd-down-node"
},
{
"type": "pwa-node",
"request": "launch",
"name": "Fronetend Calculator App",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/react-calculator/server.js",
"preLaunchTask": "daprd-debug-calculator",
"postDebugTask": "daprd-down-calculator"
},
{
"name": "Multiply App",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/python/app.py",
"console": "integratedTerminal",
"preLaunchTask": "daprd-debug-python",
"postDebugTask": "daprd-down-python"
},
{
"name": "Subtract App",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceFolder}/csharp/bin/Debug/netcoreapp3.1/Subtract.dll",
"args": [],
"cwd": "${workspaceFolder}/csharp",
"stopAtEntry": false,
"serverReadyAction": {
"action": "openExternally",
"pattern": "\\bNow listening on:\\s+(https?://\\S+)"
},
"env": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"sourceFileMap": {
"/Views": "${workspaceFolder}/Views"
},
"postDebugTask": "daprd-down-csharp"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach"
},
{
"name": "Add App with Dapr",
"type": "go",
"request": "launch",
"mode": "debug",
"program": "${workspaceFolder}/go/app.go",
"preLaunchTask": "daprd-debug",
"postDebugTask": "daprd-down"
}
],
"compounds": [
{
"name": "Full Dapr App",
"configurations": ["Add App", "Divide App","Subtract App","Multiply App","Fronetend Calculator App" ]
}
]
}
128 changes: 128 additions & 0 deletions distributed-calculator/.vscode/tasks.json
@@ -0,0 +1,128 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build",
"command": "dotnet",
"type": "process",
"args": [
"build",
"${workspaceFolder}/csharp/Subtract.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile",
"dependsOn": [
"daprd-debug-csharp"
]
},
{
"label": "publish",
"command": "dotnet",
"type": "process",
"args": [
"publish",
"${workspaceFolder}/csharp/Subtract.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"label": "watch",
"command": "dotnet",
"type": "process",
"args": [
"watch",
"run",
"${workspaceFolder}/csharp/Subtract.csproj",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
"problemMatcher": "$msCompile"
},
{
"appId": "addapp",
"appPort": 6000,
"httpPort": 3503,
"metricsPort": 9092,
"grpcPort": 50006,
"label": "daprd-debug-go",
"type": "daprd"
},
{
"appId": "addapp",
"label": "daprd-down-go",
"type": "daprd-down"
},
{
"appId": "subtractapp",
"appPort": 7000,
"httpPort": 3504,
"metricsPort": 9091,
"grpcPort": 50015,
"label": "daprd-debug-csharp",
"type": "daprd"
},
{
"appId": "subtractapp",
"label": "daprd-down-csharp",
"type": "daprd-down"
},
{
"appId": "divideapp",
"appPort": 4000,
"httpPort": 3502,
"metricsPort": 9090,
"grpcPort": 50004,
"label": "daprd-debug-node",
"type": "daprd"
},
{
"appId": "divideapp",
"label": "daprd-down-node",
"type": "daprd-down"
},
{
"appId": "multiplyapp",
"appPort": 5000,
"httpPort": 3501,
"metricsPort": 9093,
"grpcPort": 50003,
"label": "daprd-debug-python",
"type": "daprd"
},
{
"appId": "multiplyapp",
"label": "daprd-down-python",
"type": "daprd-down"
},
{
"appId": "frontendapp",
"appPort": 8080,
"httpPort": 3500,
"metricsPort": 9094,
"grpcPort": 50002,
"label": "daprd-debug-calculator",
"type": "daprd"
},
{
"appId": "frontendapp",
"label": "daprd-down-calculator",
"type": "daprd-down"
},
{
"appId": "app",
"appPort": 80,
"label": "daprd-debug",
"type": "daprd",
"dependsOn": "daprd-debug-go"
},
{
"appId": "app",
"label": "daprd-down",
"type": "daprd-down",
"dependsOn": "daprd-down-go"
}
]
}
11 changes: 11 additions & 0 deletions distributed-calculator/README.md
Expand Up @@ -658,6 +658,17 @@ Our client persists state by simply POSTing JSON key-value pairs (see `react-cal
});
```

## [Optional Steps] VS Code Debugging

If you are using Visual Studio Code, you can debug this application using the preconfigured launch.json and task.json files in the .vscode folder.
The .vscode folder has already been modified in the project to allow users to launch a compound configuration called "Full Dapr App" which will run all applications and allow you to debug in VS Code.

For more information on how to configure the files visit [How-To: Debug multiple Dapr applications](https://docs.dapr.io/developing-applications/ides/vscode/vscode-how-to-debug-multiple-dapr-apps/)

> **Note**: You still need to edit your environment variables for Flask and ASPNETCORE_URLS
**Note**: Dapr offers a preview [Dapr Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-dapr) for local development which enables users a variety of features related to better managing their Dapr applications and debugging of your Dapr applications for all supported Dapr languages which are .NET, Go, PHP, Python and Java.


jasonviviano marked this conversation as resolved.
Show resolved Hide resolved
## Next Steps

- Explore additional [quickstarts](../README.md#quickstarts).
34 changes: 34 additions & 0 deletions hello-world/.vscode/launch.json
@@ -0,0 +1,34 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-node",
"request": "launch",
"name": "Nodeapp with Dapr",
"skipFiles": [
"<node_internals>/**"
],
"program": "${workspaceFolder}/app.js",
"preLaunchTask": "daprd-debug-node",
"postDebugTask": "daprd-down-node"
},
{
"type": "python",
"request": "launch",
"name": "Pythonapp with Dapr",
"program": "${workspaceFolder}/app.py",
"console": "integratedTerminal",
"preLaunchTask": "daprd-debug-python",
"postDebugTask": "daprd-down-python"
}
],
"compounds": [
{
"name": "Node/Python Dapr",
"configurations": ["Nodeapp with Dapr","Pythonapp with Dapr"]
}
]
}
31 changes: 31 additions & 0 deletions hello-world/.vscode/tasks.json
@@ -0,0 +1,31 @@
{
"version": "2.0.0",
"tasks": [
{
"appId": "nodeapp",
"appPort": 3000,
"httpPort": 3500,
"metricsPort": 9090,
"label": "daprd-debug-node",
"type": "daprd"
},
{
"appId": "nodeapp",
"label": "daprd-down-node",
"type": "daprd-down"
},
{
"appId": "pythonapp",
"httpPort": 53109,
"grpcPort": 53317,
"metricsPort": 9091,
"label": "daprd-debug-python",
"type": "daprd"
},
{
"appId": "pythonapp",
"label": "daprd-down-python",
"type": "daprd-down"
}
]
}
9 changes: 9 additions & 0 deletions hello-world/README.md
Expand Up @@ -422,6 +422,15 @@ dapr stop --app-id pythonapp

To see that services have stopped running, run `dapr list`, noting that your services no longer appears!

## [Optional Steps] VS Code Debugging

If you are using Visual Studio Code, you can debug this application using the preconfigured launch.json and task.json files in the .vscode folder.
The .vscode folder has already been modified in the project to allow users to launch a compound configuration called "Node/Python Dapr" which will run both applications and allow you to debug in VS Code.

For more information on how to configure the files visit [How-To: Debug multiple Dapr applications](https://docs.dapr.io/developing-applications/ides/vscode/vscode-how-to-debug-multiple-dapr-apps/)

**Note**: Dapr offers a preview [Dapr Visual Studio Code extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-dapr) for local development which enables users a variety of features related to better managing their Dapr applications and debugging of your Dapr applications for all supported Dapr languages which are .NET, Go, PHP, Python and Java.

## Next steps

Now that you've gotten Dapr running locally on your machine, consider these next steps:
Expand Down