Skip to content

Crates Pro Development Workflow

Yuxuan Dai edited this page Sep 7, 2024 · 1 revision

This guide will help new developers set up their development environment for Crates Pro.

Overview

Crates Pro currently consists of four components:

  1. crates-pro
  2. performance-benchmark
  3. sensleak-rs
  4. crates-pro-frontend

This workflow applies to the first three components. The project uses remote development, where developers connect to an internal server via SSH.

Remote Development Setup

We'll use the "crates-pro" component as an example to demonstrate the remote development process.

Step 1: Connect to the Server via SSH

  1. Edit your local SSH configuration file (~/.ssh/config). Please consult project maintainers for details.

  2. Use Visual Studio Code to connect to the server.

Step 2: Clone and Configure crates-pro-infra

  1. On the remote host, clone the crates-pro-infra repository:

    git clone https://github.com/crates-pro/crates-pro-infra.git
  2. Clone the component you want to develop (e.g., crates-pro) on the remote host.

  3. Replace the crates-pro submodule with the one you just cloned by adding a path mapping in the devcontainer.json file:

    {
        ...
        "workspaceFolder": "/workdir",
        "workspaceMount": "source=${localWorkspaceFolder},target=/workdir,type=bind",
    +   "mounts": [
    +       "source=/path/to/your/crates-pro,target=/workdir/project/crates-pro,type=bind"
    +   ]
        ...
    }

Step 3: Compile Executables

  1. Reopen the crates-pro-infra project directory in the container (devcontainers).

  2. In the container's command line, run:

    ./build.sh

    This will build executables for all components and copy them to the build directory.

Step 4: Generate Image and Deploy Crates Pro

  1. Outside the container, open a command line and navigate to the crates-pro-infra directory.

  2. Run the following command to build a Docker image:

    docker build ./build

    This will use the executables in the ./build directory to generate an image. The image description file is located at ./build/Dockerfile.

  3. Use docker run to run the image and complete the deployment.

Additional Notes

If you encounter any issues or have questions, please reach out to the project maintainers for assistance.