Skip to content

Commit

Permalink
Merge branch 'main' into anders/env_var_run_sh
Browse files Browse the repository at this point in the history
  • Loading branch information
adschwartz authored Feb 5, 2024
2 parents aaa8903 + ffa3519 commit 603f765
Show file tree
Hide file tree
Showing 39 changed files with 1,129 additions and 628 deletions.
6 changes: 6 additions & 0 deletions .run/APIC-remote-debug.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="APIC-remote-debug" type="GoRemoteDebugConfigurationType" factoryName="Go Remote" port="50103">
<option name="disconnectOption" value="ASK" />
<method v="2" />
</configuration>
</component>
67 changes: 59 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -228,21 +228,21 @@ sudo apt update
sudo apt install goreleaser
```

#### Node (16.14 or above) and Yarn
#### Node (20.* or above) and Yarn

On MacOS, using `NVM`:
```bash
brew install nvm
mkdir ~/.nvm
nvm install 16.14.0
nvm install 20.11.0
npm install -g yarn
```

On Ubuntu, using `NVM`:
```bash
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
source ~/.bashrc
nvm install 16.14.0
nvm install 20.11.0
npm install -g yarn
```

Expand Down Expand Up @@ -428,10 +428,10 @@ ktdev engine start --debug-mode
4. Then choose the "Engine-remote-debug" run configuration in the "run panel"
5. Press the "debug" button
<img src="./readme-static-files/goland-engine-debug-button.png" />
6. Use the debug panel to inspect the variables value and continue with the debug flow
<img src="./readme-static-files/goland-debug-panel.png" />
7. Make a call to the engine's server (you can use the Kurtosis CLI or Postman) in order to reach out the breakpoint in the code
8. You can debug the CLI and the Kurtosis engine's server at the same time by running it with `ktdebug` instead of `ktdev` mentioned in a previous step, remember to run both remote debug configuration in the Goland IDE.
6. Make a call to the engine's server (you can use the Kurtosis CLI or Postman) in order to reach out the breakpoint in the code
7. Use the debug panel to inspect the variables value and continue with the debug flow
<img src="./readme-static-files/goland-debug-panel.png" />
8. You can debug the CLI and the Kurtosis engine's server at the same time by running it with `ktdebug` instead of `ktdev` mentioned in a previous step, remember to run both remote debug configurations in the Goland IDE.
```bash
source ./scripts/set_kt_alias.sh
ktdebug engine start
Expand All @@ -453,6 +453,57 @@ scripts/port-forward-engine-debug.sh
ktdev gateway
```

For running Kurtosis APIC with Golang remote debug:
1. Run the main build script with the first argument `debug_mode` as true. This will generate a new Kurtosis APIC container image which will contain the `debug` suffix in the name.
```bash
scripts/build.sh true
```
2. Add the breakpoint in the line where you want to stop the cursor.
<img src="./readme-static-files/goland-apic-breakpoint.png" />
3. Run the Kurtosis engine in debug more or not depending on if you want to also debug the engine.
```bash
source ./scripts/set_kt_alias.sh
ktdev engine start --debug-mode

OR

ktdev engine start # you will have to build the engine in the regular way `engine/scripts/build.sh` if you choose this version
```
4. Add a new enclave in debug mode with the `enclave add` command and passing the `debug-mode` flag. This will create a new APIC container with the debug server port bounded and waiting for a connection.
IMPORTANT: You can only run one enclave in debug mode so far, if you want to run another one it will fail due the debug port is already in use,
```bash
ktdev enclave add --debug-mode
```
5. Then choose the "APIC-remote-debug" run configuration in the "run panel"
6. Press the "debug" button
<img src="./readme-static-files/goland-apic-debug-button.png" />
7. Find the APIC's GRPC server port in the host machine (you can check it in Docker Desktop or using the Docker CLI, it's the one bounded with the container's 7443 port)
8. Make a call to the APIC's server (you can use the Kurtosis CLI or Postman) in order to reach out the breakpoint in the code
9. Use the debug panel to inspect the variables value and continue with the debug flow
<img src="./readme-static-files/goland-debug-panel.png" />
10. You can debug the CLI, the Kurtosis engine's server and the Kurtosis APIC's server at the same time by running it with `ktdebug` instead of `ktdev` mentioned in a previous step, remember to run the three remote debug configurations in the Goland IDE.
```bash
source ./scripts/set_kt_alias.sh
ktdev engine start --debug-mode
ktdebug enclave add
```

Additional steps if you are debugging Kurtosis engine in K8s:

1. Upload the APIC's image for debug to the K8s cluster
```bash
# for example:
k3d image load kurtosistech/core:5ec6eb-dirty-debug
```
2. Run the port-forward script before pressing the debug button in Golang (in another terminal instance) to bind the host's port to the container's debug server port
```bash
scripts/port-forward-apic-debug.sh enclave-name
```
3. Do not forget to run the Kurtosis gateway after calling the APIC's server (in another terminal instance also)
```bash
ktdev gateway
```

</details>

<!-------- ONLY LINKS BELOW THIS POINT -------->
Expand All @@ -465,4 +516,4 @@ ktdev gateway
[twitter]: https://twitter.com/KurtosisTech
[starlark-explanation]: https://docs.kurtosis.com/explanations/starlark
[stackoverflow-2022-developer-survey--other-tools]: https://survey.stackoverflow.co/2022/#most-popular-technologies-tools-tech-prof
[delve-docs]: https://github.com/go-delve/delve/blob/master/Documentation/cli/README.md
[delve-docs]: https://github.com/go-delve/delve/blob/master/Documentation/cli/README.md
Loading

0 comments on commit 603f765

Please sign in to comment.