Code Monkey home page Code Monkey logo

collector's Introduction

Collector

Collector development

Cloning the repo

Since the collector repo uses a submodule for the sysdig source, use the following command to clone.

git clone --recurse-submodules [email protected]:stackrox/collector.git

Development with an IDE (CLion)

Setup

These instructions are for using the JetBrains C/C++ IDE CLion, but should be adaptable to any IDE that supports development over ssh/sftp.

  • If running CLion IDE for the first time:
  • Create the collector builder container if not already running, or if the builder image has changed.
    • make start-dev
      • (Optional) Local builder images can used by setting the environment variable before execution using BUILD_BUILDER_IMAGE=true make start-dev. Or, builder images from a PR by with COLLECTOR_BUILDER_TAG=<circle-build-id> make start-dev.

Instructions for Mac OS

  • In the CLion->Preferences window, add a new Toolchain entry in settings under Build, Execution, Deployment as a Remote Host type.
  • Then, click in the Credentials section and fill out the SSH credentials used in the builder Dockerfile.
    • Host: localhost, Port: 2222, User name: remoteuser, Password: c0llectah
  • Next, select Deployment under Build, Execution, Deployment, and then Mappings. Set Deployment path to /tmp.
  • Finally, add a CMake profile that uses the Remote Host toolchain and change Build directory/Generation Path to cmake-build.

Instructions for Linux

  • In the File->Settings->Build, Execution, Deployment->Toolchains window, add a new Toolchain entry as a Remote Host type.
  • Then, click in the Credentials section and fill out the SSH credentials used in the builder Dockerfile.
    • Host: localhost, Port: 2222, User name: remoteuser, Password: c0llectah
  • In the File->Setting->Build, Execution, Deployment->Deployment window click on the Mappings tab. Set Deployment path to /tmp.
  • In the File->Settings->Build, Execution, Deployment->CMake window add a CMake profile that uses the Remote Host toolchain and change Build directory/Generation Path to cmake-build.

Teardown

  • Run make teardown-dev to remove the builder container and associated ephemeral ssh keys from $HOME/.ssh/known_hosts
  • After restarting, you may need click Resync with Remote Hosts under the Tools menu in CLion.

Compilation and Testing

  • To build the sysdig wrapper libary and collector binary: select the collector configuration from the Run... menu and then Build.
  • To run unit tests, select the runUnitTests configuration and then select Run.

Development with Visual Studio Code

Setup for C++ using devcontainers

Visual Studio Code can be used as a development environment by leveraging its devcontainers feature.

  • Install the remote-containers extension.
  • Create a .devcontainer.json file under collector and set the image attribute to quay.io/stackrox-io/collector-builder:cache
{
  "name": "collector-dev",
  "image": "quay.io/stackrox-io/collector-builder:cache"
}
  • Open the collector/ directory in a new instance of Visual Studio Code and when prompted select Reopen In Container, a new container should be created and the workspace directory will be mounted inside of it.

Teardown

Closing the Visual Studio Code instance will stop the container.

Important note on performance

Even though development containers is a supported feature of Docker for Desktop, there is a bug that tanks performance when running containers with mounted volumes. A possible workaround is to setup docker to run inside a VM and mounting the work directories using NFS.

Building collector image(s) from the command-line

  • make image will create the Red Hat based collector image.
  • make image-dev will create a collector image based on CentOS Stream, the package manager in this image is available so additional developer tools can be installed.
  • make image-dev-full will extend the image-dev target and also compile and embed the kernel module and eBPF probes in the final image, making it easier to test changes in these components.

Setting up git hooks

Git hooks are configured in the .pre-commit-config.yaml file using pre-commit In order to use them install pre-commit, and run git config core.hooksPath ./githooks/ from the collector root directory.

collector's People

Contributors

roxbot avatar ldegio avatar gianlucaborello avatar robbycochran avatar aleks-f avatar ret2libc avatar samuelepilleri avatar mstemm avatar molter73 avatar misberner avatar henridf avatar kristopolous avatar evgeni avatar joukovirtanen avatar dkogan avatar joshdk avatar jarun avatar bwolmarans avatar stringy avatar 03cranec avatar gregkh avatar ltagliamonte avatar luca3m avatar srudi88 avatar etown avatar gavin-stackrox avatar erthalion avatar hefeweizen avatar arossert avatar mattpag avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.