---
title: "Run your NodeEngine or NetManager in debugging mode"
tags: wikidocs
teams:
- maintainers
participants:
- Giovanni (GB)
---
# How do I debug the NodeEngine?
If you're using VSCode, you can use the following [launch.json](https://code.visualstudio.com/docs/editor/debugging#_launch-configurations) configuration to execute the NodeEngine in your local machine or a remote one in debug mode.
```json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Node Engine locally - Unikraft Support",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceRoot}/NodeEngine.go",
"console": "integratedTerminal",
"asRoot": true,
"args": ["-n", "6000", "-p", "10100", "-u"],
"env": {
"PATH": "${env:PATH}:/usr/local/go/bin"
}
},
{
"name": "Debug Node Engine locally - Container Only",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceRoot}/NodeEngine.go",
"console": "integratedTerminal",
"asRoot": true,
"args": ["-n", "6000", "-p", "10100"],
"env": {
"PATH": "${env:PATH}:/usr/local/go/bin"
}
},
{
"name": "Debug Node Engine remotely - Cluster Container Only",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceRoot}/NodeEngine.go",
"console": "integratedTerminal",
"asRoot": true,
"args": ["-n", "6000", "-p", "10100", "-a","${input:enterClusterIp}"],
"env": {
"PATH": "${env:PATH}:/usr/local/go/bin"
}
},
{
"name": "Debug Node Engine remotely - Cluster Unikernel support",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceRoot}/NodeEngine.go",
"console": "integratedTerminal",
"asRoot": true,
"args": ["-n", "6000", "-p", "10100", "-a","${input:enterClusterIp}","-u"],
"env": {
"PATH": "${env:PATH}:/usr/local/go/bin"
}
}
],
"inputs": [
{
"id": "enterClusterIp",
"type": "promptString",
"description": "Cluster Orchestrator IP",
"default": "0.0.0.0"
}
]
}
```
The configuration allows you to start up the NodeEngine with/without `-u` flag to enable kvm/unikraft support. Additionally, you can choose to attach it to a pre-running local cluster orchestrator `Debug Node Engine locally *`, or a remote cluster orchestrator `Debug Node Engine remotely *`. The former expects the cluster orchestrator to run on `0.0.0.0`, the latter asks for an input IP pointing to your remote cluster orchestrator.
# How do I debug the NetManager?
Similarly as the NodeEngine, here a sample json config file for your NetManager
```json
{
"version": "0.2.0",
"configurations": [
{
"name": "Debug Net Manager",
"type": "go",
"request": "launch",
"mode": "auto",
"program": "${workspaceRoot}/NetManager.go",
"console": "integratedTerminal",
"asRoot": true,
"args": ["-p", "6000", "-D", "true"],
"env": {
"PATH": "${env:PATH}:/usr/local/go/bin"
}
}
]
}
```
** The NetManager still expects your netconfig file to be correctly placed and configured under `/etc/netmanager/netcfg.json`.**
# How do I debug any of the Cluster/Root orchestrator containers?
We'll cover an example for the cluster system manager, but the same applies to all the services.
First, create a docker compose override to switch the network mode of the cluster to `host`
>E.g.,`override-host-net.yaml`
```yaml
version: "3.3"
services:
dashboard:
network_mode: "host"
system_manager:
network_mode: "host"
root_service_manager:
network_mode: "host"
resource_abstractor:
network_mode: "host"
cloud_scheduler:
network_mode: "host"
cluster_service_manager:
network_mode: "host"
cluster_manager:
network_mode: "host"
cluster_scheduler:
network_mode: "host"
```
Re-start your cluster and apply this override,
> E.g., `docker compose -f 1-DOC.yaml -f override-host-net.yaml up`
Now, suppose we want to debug the cluster system manager.
If you explore the compose file of the cluster system manager you'll notice that it uses the following environment variables:
```bash
- MY_PORT=10099
- SYSTEM_MANAGER_URL=system_manager
- SYSTEM_MANAGER_PORT=10000
- CLOUD_MONGO_URL=mongo_net
- CLOUD_MONGO_PORT=1000`
```
Then let's use the following debug config file (It runs locally)
```yaml
{
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File with Arguments",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"env": {
"MY_PORT": "10999",
"SYSTEM_MANAGER_URL": "<docker bridge address>",
"SYSTEM_MANAGER_PORT": "10000",
"CLOUD_MONGO_URL": "<docker bridge address>",
"CLOUD_MONGO_PORT": "1000"
}
},
]
}
```
Finally, stop the pre-existing `cluster_manager`, move to `cluster_orchestrator/cluster_manager/cluster_manager.py` and start the debugging.
Enjoy 🤩
# How do I automatically deploy Oakestra, to a pre-defined branch or pre-defined version, in my cluster?
The answer is simple: `ansible`!
- First, clone the [automation repo](https://github.com/oakestra/automation).
- Configure [oak_repo_version and oak_net_repo_version](https://github.com/oakestra/automation/blob/main/ansible/inventories/group_vars/all.yml) to a branch name or version name (E.g., develop, or v0.4.301)
- Finally, follow [this guide](https://github.com/oakestra/automation/tree/main/ansible) to undesrtand how the ansible scripts can be used.