If you have mask installed, you can use it to quickly perform these common operations. If not, consider installing it to further oxidize your life.
For example, from here in the root of the project, try running mask build agents to quickly build the cargo workspace with nix.
this will give you all the binaries we have defined for the project.
Our team primarily uses podman as a container runtime. So feel free to alias it for your favorite/compatible runtime.
Builds the Polar Dev image. A contaienrized Rust development environment in case you don't want to do local development.
echo "Building the Polar development environment. This may take a moment."
export def greet [] {
print "Current Weather"
print $env.WEATHER_INFO
} nix build .#containers.devContainer --show-trace
echo "Loading the development image."
podman load < resultBuild's cassini's container image
echo "building cassini image..."
nix build .#polarPkgs.cassini.cassiniImage -o cassini
echo "loading image..."
podman load < cassini builds the gitlab agents and their images
echo "Building gitlab agent images..."
nix build .#polarPkgs.gitlabAgent.observerImage -o gitlab-observer
nix build .#polarPkgs.gitlabAgent.consumerImage -o gitlab-consumer
echo "loading images..."
podman load < gitlab-observer
podman load < gitlab-consumerbuilds the kube agents and their images
echo "Building kubernetes agent images..."
nix build .#polarPkgs.kubeAgent.observerImage -o kube-observer
nix build .#polarPkgs.kubeAgent.consumerImage -o kube-consumer
echo "loading images..."
podman load < kube-observer
podman load < kube-consumerEnters the Polar Dev container.
This command mounts your project directory into the
container at the /workspace directory, allowing you to work on your
project files within the container.
podman run --it \
--user 0 --userns=keep-id \
-v ./:/workspace:rw \
-p 2222:2223 \
-e CREATE_USER="$USER" \
-e CREATE_UID="$(id -u)" \
-e CREATE_GID="$(id -g)" \
-e DROPBEAR_ENABLE=1 \
-e DROPBEAR_PORT=2223 \
-e AUTHORIZED_KEYS_B64="$(base64 -w0 $public_key)" \
polar-dev:latest
Starts the docker compose file to start up the docker compose for local testing. Runs in background
podman compose -f src/conf/docker-compose.yml up -dBuilds all of the polar agents and outputs their binaries
nix build .#default -o polarBuilds all of the polar agents and outputs their binaries
nix build .#polarPkgs.cassini.cassini .#polarPkgs.cassini.harnessProducer .#polarPkgs.cassini.harnessSinkRuns the nix derivation to generate TLS certificates for testing.
nix build .#tlsCerts -o certs
ls -alh certsUses the
render-manifests.shscript to render all manifests in the polar/deploy repository, ensure you have the proper environment variables set. See the deployment docs for details.
sh $MASKFILE_DIR/scripts/render-manifests.sh "$MASKFILE_DIR/src/deploy/$environment" $MASKFILE_DIR/$output_diruses the
static-tools.shscript to run various static analysis tools on the rust source code.
sh scripts/static-tools.sh --manifest-path src/agents/Cargo.tomlRuns the
gitlab-ci.shscript to run the CI/CD job locally on your machine. NOTE: You will need to set all of the environment variables appropriately.' See our example.env and the Gitlab Documentation for details.
podman run --rm \
--name polar-dev \
--env-file=ci.env \
--env CI_COMMIT_REF_NAME=$(git symbolic-ref --short HEAD) \
--env CI_COMMIT_SHORT_SHA=$(git rev-parse --short=8 HEAD) \
--env SSL_CERT_FILE="./src/conf/certs/proxy-ca.pem" \
--user 0 \
--userns=keep-id \
-v $(pwd):/workspace:rw \
-p 2222:2223 \
polar-dev:0.1.0 \
bash -c "start.sh; chmod +x scripts/gitlab-ci.sh; chmod +x scripts/static-tools.sh ; scripts/gitlab-ci.sh"