2022-05-18 13:08:31 -04:00
# debug daemon (debugd)
2022-09-06 08:49:13 -04:00
Debugd is a tool we built to allow for shorter iteration cycles during development.
2022-10-21 04:16:44 -04:00
The debugd gets embedded into OS images at the place where the bootstrapper normally sits.
2022-09-06 08:49:13 -04: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 06:13:23 -04:00
## Build cdbg
2022-05-18 13:08:31 -04:00
2022-06-10 09:05:09 -04:00
```shell
2022-05-18 13:08:31 -04:00
mkdir -p build
2022-05-23 06:13:23 -04:00
cmake ..
make cdbg
2022-05-18 13:08:31 -04:00
```
## debugd & cdbg usage
2022-09-06 08:49:13 -04:00
Before continuing, remeber 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 13:08:31 -04:00
With `cdbg` and `yq` installed in your path:
1. Run `constellation config generate` to create a new default configuration
2022-06-10 09:05:09 -04:00
2022-12-30 04:27:03 -05:00
2. Locate the latest debugd images by running `(cd internal/versionsapi/cli && go build -o versionsapi . && ./versionsapi latest --ref main --stream debug)`
2022-06-10 09:05:09 -04:00
2022-05-18 13:08:31 -04:00
3. Modify the `constellation-conf.yaml` to use an image with the debugd already included and add required firewall rules:
2022-06-10 09:05:09 -04:00
2022-05-18 13:08:31 -04:00
```shell-session
2022-08-05 06:28:57 -04:00
# Set full reference of cloud provider image name
export IMAGE_URI=
```
2022-05-18 13:08:31 -04:00
2022-08-05 06:28:57 -04:00
```shell-session
2022-05-18 13:08:31 -04:00
yq -i \
2022-08-05 06:28:57 -04:00
"(.provider | select(. | has(\"azure\")).azure.image) = \"${IMAGE_URI}\"" \
constellation-conf.yaml
2022-05-18 13:08:31 -04:00
yq -i \
2022-08-05 06:28:57 -04:00
"(.provider | select(. | has(\"gcp\")).gcp.image) = \"${IMAGE_URI}\"" \
2022-05-18 13:08:31 -04:00
constellation-conf.yaml
yq -i \
2022-09-06 04:38:14 -04:00
"(.debugCluster) = true" \
2022-05-18 13:08:31 -04:00
constellation-conf.yaml
```
2022-06-10 09:05:09 -04:00
2022-05-18 13:08:31 -04:00
4. Run `constellation create […]`
2022-06-10 09:05:09 -04:00
2022-05-23 06:13:23 -04:00
5. Run `./cdbg deploy`
2022-05-18 13:08:31 -04:00
2022-08-31 06:25:27 -04: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 09:05:09 -04:00
6. Run `constellation init […]` as usual
2022-05-18 13:08:31 -04:00
2022-11-30 04:43:09 -05: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 05:03:41 -05:00
On AWS, attach the `SecretManagerE2E` policy to your control-plane and worker node role.
2022-11-30 04:43:09 -05: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 06:25:27 -04:00
2022-12-01 01:59:28 -05:00
You will also need to increase the memory size of QEMU to 4GB.