Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
08c5c9e
Update DEVELOPMENT.md
entlein Apr 27, 2025
e40aed6
Update DEVELOPMENT.md
entlein Apr 27, 2025
17b9d5b
adding the build cache entry for bazel
entlein Apr 27, 2025
652265e
adding the compile mode into vizier skaffold
entlein Apr 27, 2025
ef467a8
these should be the most important steps
entlein Apr 27, 2025
6730d7e
more text
entlein Apr 27, 2025
1124c1f
comments unaligned fixed
entlein Apr 27, 2025
889de79
should be all now
entlein Apr 27, 2025
4036120
should be all now
entlein Apr 27, 2025
6ee0c1b
review development.md, and add extra comments
mebegu May 2, 2025
b01f03e
chore: cosmetic beautification
entlein May 3, 2025
eb762e3
chore: comment out the cache dir for bazel and explain how to use it …
entlein May 4, 2025
e9858af
PR resolve: seperating the 24.04 specifics from the overall description
entlein May 7, 2025
37ca63d
PR resolve: seperating the 24.04 specifics from the overall description
entlein May 7, 2025
aa134b9
PR resolve: referencing upstream doc for cli install and cleaning up …
entlein May 7, 2025
a6568b4
PR resolve: markdown numbering got confused
entlein May 7, 2025
859063a
feature: moving the minikube ubuntu dependencies into chef rather tha…
entlein May 7, 2025
1c1bb8c
Update DEVELOPMENT.md
entlein May 7, 2025
9f31d5f
Update DEVELOPMENT.md
entlein May 7, 2025
61ffd7e
Update DEVELOPMENT.md
entlein May 7, 2025
f7fab71
Fixing the numbering and removing empty quotes
entlein May 7, 2025
77d82f0
newline added
entlein May 7, 2025
3d95116
Fixed -R for recursive setgid bit
entlein May 7, 2025
085e27b
Adding the missing kernel header warning explanation for minikube
entlein May 7, 2025
6b325cb
chore: amend text to resolve PR comments: highlight that minikube is …
entlein May 8, 2025
e078ae7
chore: revert skaffold_visizer but add comments
entlein May 8, 2025
94dd78b
chore: amend text to resolve PR comments: highlight that minikube is …
entlein May 8, 2025
29b5314
Update tools/chef/cookbooks/px_dev/recipes/linux.rb
entlein May 8, 2025
e3588fa
Update DEVELOPMENT.md
entlein May 8, 2025
c616e66
Update DEVELOPMENT.md
entlein May 8, 2025
c846a4d
chore: apply Dom s suggested edit
entlein May 8, 2025
11e0519
chore: adding the compilation mode explanation to the docs
entlein May 8, 2025
c124e0d
Remove trailing whitespace linux.rb
entlein May 8, 2025
a4674d7
Remove trailing whitespace from skaffold_vizier.yaml
entlein May 8, 2025
5b407ff
linting: removing lots of whitespaces at the EOL
entlein May 8, 2025
fd7d4ea
linting: file must end on a newline
entlein May 8, 2025
9401a69
Update DEVELOPMENT.md
entlein May 12, 2025
0ff4301
fix documentation: as requested reverting skaffold yaml to original
entlein May 12, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Global bazelrc file, see https://docs.bazel.build/versions/master/guide.html#bazelrc.

# Use local Cache directory if building on a VM:
# On Chef VM, create a directory and comment in the following line:
# build --disk_cache=</tmp/bazel/> # Optional for multi-user cache: Make this directory owned by a group name e.g. "bazelcache"

# Use strict action env to prevent leaks of env vars.
build --incompatible_strict_action_env

Expand Down
160 changes: 160 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,166 @@ This document outlines the process for setting up the development environment fo

## Setting up the Environment

Decide first if you'd like a full buildsystem (on a VM) or a containerized dev environment.

### VM as buildsystem

This utilizes `chef` to setup all dependencies and is based on `ubuntu`.
> [!Important]
> The below description defaults to using a `minikube` on this VM for the developer to have an `all-in-one` setup. The VM type must support nested virtualization for `minikube` to work. Please confirm that the nested virtualization really is turned on before you continue, not all VM-types support it.
> If you `bring-your-own-k8s`, you may disregard this.

```yaml
advancedMachineFeatures:
enableNestedVirtualization: true
```

The following specifics were tested on GCP on a Ubuntu 24.04 (May 2025). Please see the latest [packer file](https://github.com/pixie-io/pixie/blob/main/tools/chef/Makefile#L56) for the current supported Ubuntu version: The initial compilation is CPU intense and `16vcpu` were a good trade-off, a balanced disk of 500 GB seems convenient and overall `n2-standard-16` works well.

> [!Warning]
> The first `full build` takes several hours and at least 160 Gb of space
> The first `vizier build` on these parameters takes approx. 1 hr and 45 Gb of space.





#### 1) Install chef and some dependencies

First, install `chef` to cook your `recipies`:

```bash
curl -L https://chefdownload-community.chef.io/install.sh | sudo bash
```
You may find it helpful to use a terminal manager like `screen` or `tmux`, esp to detach the builds.
```bash
sudo apt install -y screen git
```

In order to very significantly speed up your work, you may opt for a local cache directory. This can be shared between users of the VM, if both are part of the same group.
Create a cache dir under <directory-path> such as e.g. /tmp/bazel
```sh
sudo groupadd bazelcache
sudo usermod -aG bazelcache $USER
sudo mkdir -p <directory-path>
sudo chown -R :bazelcache <directory-path>
sudo chmod -R 2775 <directory-path>
```


Now, on this VM, clone pixie (or your fork of it)

```bash
git clone https://github.com/pixie-io/pixie.git
cd pixie/tools/chef
sudo chef-solo -c solo.rb -j node_workstation.json
sudo usermod -aG libvirt $USER
```

Make permanent the env loading via your bashrc
```sh
echo "source /opt/px_dev/pxenv.inc " >> ~/.bashrc
```


#### 2) If using cache, tell bazel about it

Edit the `<directory-path>` into the .bazelrc and put it into your homedir:
```
# Global bazelrc file, see https://docs.bazel.build/versions/master/guide.html#bazelrc.

# Use local Cache directory if building on a VM:
# On Chef VM, create a directory and comment in the following line:
build --disk_cache=/tmp/bazel/ # Optional for multi-user cache: Make this directory owned by a group name e.g. "bazelcache"
```

```sh
cp .bazelrc ~/.
```

#### 3) Create/Use a registry you control and login

```sh
docker login ghcr.io/<myregistry>
```

#### 4) Prepare your kubernetes

> [!Important]
> The below description defaults to using a `minikube` on this VM for the developer to have an `all-in-one` setup.
> If you `bring-your-own-k8s`, please prepare your preferred setup and go to Step 5

If you added your user to the libvirt group (`sudo usermod -aG libvirt $USER`), starting the development environment on this VM will now work (if you did this interactively: you need to refresh your group membership, e.g. by logout/login). The following command will, amongst other things, start minikube
```sh
make dev-env-start
```

#### 5) Deploy a vanilla pixie

First deploy the upstream pixie (`vizier`, `kelvin` and `pem`) using the hosted cloud. Follow [these instructions](https://docs.px.dev/installing-pixie/install-schemes/cli) to install the `px` command line interface and Pixie:
```sh
px auth login
```

Once logged in to pixie, we found that limiting the memory is useful, thus after login, set the deploy option like so:
```sh
px deploy -p=1Gi
```
For reference and further information https://docs.px.dev/installing-pixie/install-guides/hosted-pixie/cosmic-cloud.

Optional on `minikube`:

You may encounter the following WARNING, which is related to the kernel headers missing on the minikube node (this is not your VM node). This is safe to ignore if Pixie starts up properly and your cluster is queryable from Pixie's [Live UI](https://docs.px.dev/using-pixie/using-live-ui). Please see [pixie-issue2051](https://github.com/pixie-io/pixie/issues/2051) for further details.
```
ERR: Detected missing kernel headers on your cluster's nodes. This may cause issues with the Pixie agent. Please install kernel headers on all nodes.
```

#### 6) Skaffold deploy your changes

Once you make changes to the source code, or switch to another source code version, use Skaffold to deploy (after you have the vanilla setup working on minikube)

Ensure that you have commented in the bazelcache-directory into the bazel config (see Step 2).


Review the compilation-mode suits your purposes:
```
cat skaffold/skaffold_vizier.yaml
# Note: You will want to stick with a sysroot based build (-p x86_64_sysroot or -p aarch64_sysroot),
# but you may want to change the --compilation_mode setting based on your needs.
# opt builds remove assert/debug checks, while dbg builds work with debuggers (gdb).
# See the bazel docs for more details https://bazel.build/docs/user-manual#compilation-mode
- name: x86_64_sysroot
patches:
- op: add
path: /build/artifacts/context=./bazel/args
value:
- --config=x86_64_sysroot
- --compilation_mode=dbg
# - --compilation_mode=opt
```

Optional: you can make permanent your <default-repo> in the skaffold config:
```sh
skaffold config set default-repo <myregistry>
skaffold run -f skaffold/skaffold_vizier.yaml -p x86_64_sysroot
```

Check that your docker login token is still valid, then

```sh
skaffold run -f skaffold/skaffold_vizier.yaml -p x86_64_sysroot --default-repo=<myregistry>
```



#### 7) Golden Image

Once all the above is working and the first cache has been built, bake an image of your VM for safekeeping.




### Containerized Devenv
To set up the developer environment required to start building Pixie's components, run the `run_docker.sh` script. The following script will run the Docker container and dump you out inside the docker container console from which you can run all the necessary tools to build, test, and deploy Pixie in development mode.

1. Since this script runs a Docker container, you must have Docker installed. To install it follow these instructions [here](https://docs.docker.com/get-docker/).
Expand Down
10 changes: 10 additions & 0 deletions tools/chef/cookbooks/px_dev/recipes/linux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,16 @@
'qemu-system-x86',
'qemu-user-static',
'qemu-utils',

# Minikube dependencies for kvm
'libnss3-tools',
'libvirt-daemon-system',
'libvirt-clients',
'qemu-kvm',
'virt-manager',

# Pixie dependencies
'mkcert',
]

apt_package apt_pkg_list do
Expand Down
Loading