Skip to content

Secure JDK Flight Recorder management for containerized JVMs

License

Unknown, Apache-2.0 licenses found

Licenses found

Unknown
LICENSE
Apache-2.0
LICENSE.txt
Notifications You must be signed in to change notification settings

cryostatio/cryostat

Repository files navigation

Cryostat3

CI build and push Google Group : Cryostat Development

This project uses Quarkus, the Supersonic Subatomic Java Framework.

If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ .

PREVIEW

This repository is in an active development, early preview state, and will eventually be used for 3.x release versions of Cryostat. See cryostatio/cryostat for the old repository containing the < 3.0 codebase.

CONTRIBUTING

We welcome and appreciate any contributions from our community. Please visit our guide on how you can take part in improving Cryostat3.

See contribution guide →

REQUIREMENTS

Build Requirements:

Run Requirements:

BUILD

Setup Dependencies

Initialize submodules:

$ git submodule init && git submodule update
$ cd src/main/webui
$ yarn install && yarn yarn:frzinstall
$ cd -

Build the application container image

The application image can be created using:

# With Maven
$ ./mvnw package
# Or with Quarkus CLI
$ quarkus build

Build and run the application in dev mode

You can run your application in dev mode that enables live coding using:

# With Maven
$ ./mvnw compile quarkus:dev
# Or with Quarkus CLI
$ quarkus dev

This will run Cryostat as a local JVM process hooked up to its frontend, and required companion services in containers. Any changes made to the backend or frontend sources, application.properties, pom.xml, etc. will trigger automatic rebuilds and live-coding.

NOTE: Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8181/q/dev/.

RUN

Local Smoketesting

Development on this project is primarily done using podman, though things should generally work when using docker as well. For ease and convenience, it is suggested to use podman with the following configurations:

$ systemctl --user enable --now podman.socket

$HOME/.bashrc (or equivalent shell configuration)

export DOCKER_HOST=unix:///run/user/$(id -u)/podman/podman.sock

$HOME/.testcontainers.properties

ryuk.container.privileged=true
docker.client.strategy=org.testcontainers.dockerclient.UnixSocketClientProviderStrategy
testcontainers.reuse.enable=false

Build the container image and run smoketests. This will spin up the cryostat container and its required services.

# build Cryostat container, clean up any dangling references
$ quarkus build ; podman image prune -f
# run a smoketest scenario
$ bash smoketest.bash

To make containers' names DNS-resolvable from the host machine, do:

$ git clone https://github.com/figiel/hosts libuserhosts
$ cd libuserhosts
$ make PREFIX=$HOME/bin all install
$ echo 'export LD_PRELOAD=$HOME/bin/lib/libuserhosts.so' >> ~/.bashrc
$ export LD_PRELOAD=$HOME/bin/lib/libuserhosts.so

(this will require a C compiler toolchain present on your development machine)

You can verify that this setup works by running smoketest.bash, and then in another terminal:

$ LD_PRELOAD=$HOME/bin/libuserhosts.so ping auth
$ LD_PRELOAD=$HOME/bin/libuserhosts.so curl http://auth:8080
$ LD_PRELOAD=$HOME/bin/libuserhosts.so firefox http://auth:8080

Smoketesting in K8s

To run similar smoketest scenarios in a Kubernetes/OpenShift cluster, do:

$ cd smoketest/k8s
$ bash smoketest.bash kind # This launches a kind k8s cluster, otherwise skip this if you have another cluster accessible via kubectl/oc.

If you get an error during the 'ensuring node image' step while creating cluster "kind", manually pull the podman image by running the command podman pull docker.io/kindest/node@IMAGE_DIGEST where IMAGE_DIGEST is the sha256 of the image. Then rerun bash smoketest.bash kind.

Generate k8s yaml configurations and apply them to create k8s objects. You can optionally port-forward to the cluster's services to access the Cryostat application from localhost.

$ bash smoketest.bash generate apply
$ bash smoketest.bash forward # if you need to use port-forwarding to get access to the cluster's services