2022-05-18 19:08:31 +02:00
# debug daemon (debugd)
2022-09-06 14:49:13 +02:00
Debugd is a tool we built to allow for shorter iteration cycles during development.
2022-10-21 10:16:44 +02:00
The debugd gets embedded into OS images at the place where the bootstrapper normally sits.
2022-09-06 14:49:13 +02:00
Therefore, when a debug image is started, the debugd starts executing instead of the bootstrapper.
The debugd will then wait for a request from the `cdbg` tool to upload a bootstrapper binary.
Once the upload is finished debugd will start the bootstrapper.
Subsequently you can initialize your cluster with `constellation init` as usual.
2022-05-23 12:13:23 +02:00
## Build cdbg
2022-05-18 19:08:31 +02:00
2022-06-10 15:05:09 +02:00
```shell
2022-05-18 19:08:31 +02:00
mkdir -p build
2022-05-23 12:13:23 +02:00
cmake ..
make cdbg
2022-05-18 19:08:31 +02:00
```
## debugd & cdbg usage
2023-06-19 17:39:43 +02:00
Before continuing, remember to [set up ](https://docs.edgeless.systems/constellation/getting-started/install#set-up-cloud-credentials ) your cloud credentials for the CLI to work.
2022-05-18 19:08:31 +02:00
With `cdbg` and `yq` installed in your path:
1. Run `constellation config generate` to create a new default configuration
2022-06-10 15:05:09 +02:00
2023-05-25 17:43:44 +01:00
2. Locate the latest debugd images by running `(cd internal/api/versionsapi/cli && go build -o versionsapi . && ./versionsapi latest --ref main --stream debug)`
2022-06-10 15:05:09 +02:00
2022-05-18 19:08:31 +02:00
3. Modify the `constellation-conf.yaml` to use an image with the debugd already included and add required firewall rules:
2022-06-10 15:05:09 +02:00
2022-05-18 19:08:31 +02:00
```shell-session
2022-08-05 12:28:57 +02:00
# Set full reference of cloud provider image name
export IMAGE_URI=
```
2022-05-18 19:08:31 +02:00
2022-08-05 12:28:57 +02:00
```shell-session
2022-05-18 19:08:31 +02:00
yq -i \
2023-01-20 15:41:33 +01:00
".image = \"${IMAGE_URI}\" | \
.debugCluster = true" \
2022-05-18 19:08:31 +02:00
constellation-conf.yaml
```
2022-06-10 15:05:09 +02:00
2022-05-18 19:08:31 +02:00
4. Run `constellation create […]`
2022-06-10 15:05:09 +02:00
2022-05-23 12:13:23 +02:00
5. Run `./cdbg deploy`
2022-05-18 19:08:31 +02:00
2022-08-31 03:25:27 -07:00
By default, `cdbg` searches for the bootstrapper in the current path (`./bootstrapper` ). You can define a custom path by appending the argument `--bootstrapper <path to bootstrapper>` to `cdbg deploy` .
2022-06-10 15:05:09 +02:00
6. Run `constellation init […]` as usual
2022-05-18 19:08:31 +02:00
2022-11-30 10:43:09 +01:00
### Logcollection to Opensearch
You can enable the logcollection of debugd to send logs to Opensearch.
On Azure, ensure your user assigned identity has the `Key Vault Secrets User` role assigned on the key vault `opensearch-creds` .
2022-12-13 11:03:41 +01:00
On AWS, attach the `SecretManagerE2E` policy to your control-plane and worker node role.
2022-11-30 10:43:09 +01:00
When deploying with cdbg, enable by setting the `logcollect=true` and your name `logcollect.admin=yourname` .
```shell-session
./cdbg deploy --info logcollect=true,logcollect.admin=yourname
# OR
./cdbg deploy --info logcollect=true --info logcollect.admin=yourname
```
Other available fields can be found in [the filed list ](/debugd/internal/debugd/logcollector/fields.go )
For QEMU, the credentials for Opensearch must be parsed via the info flag as well:
```shell-session
./cdbg deploy \
--info logcollect=true \
--info logcollect.admin=yourname \
--info qemu.opensearch-pw='xxxxxxx'
```
Remember to use single quotes for the password.
2022-08-31 03:25:27 -07:00
2022-12-01 07:59:28 +01:00
You will also need to increase the memory size of QEMU to 4GB.