Environment
This document outlines the development environment requirements for this
project. These requirements are necessary to execute the commands defined in the
justfile.
Requirements
- Rust: The project uses Rust, and the
cargocommand is used for building, testing, and running the Rust code. It's also used for generating documentation and formatting the Rust code. - Docker: Docker is used to manage services that the application depends on.
The
docker compose up -dcommand is used to start these services, anddocker compose down -vis used to stop them.
Optional Requirements
The following tools are optional for some workflows but recommended for development:
Probe
- Python: Python is used for the
probescript. You need to have Python installed to run this script. - Poetry: Poetry is used for managing Python dependencies.
Formatting
- Yapf: Yapf is used for formatting Python code in the project.
- Prettier: Prettier is used for formatting and checking the format of the code in the project.
- shfmt: shfmt is used for formatting shell scripts in the project.
Linting
- ShellCheck: ShellCheck is used for linting shell scripts.
- cspell: cspell is used for spell checking in the project.
- Ruff: Ruff is used for checking Rust code in the project.
- Clippy: Clippy is a Rust linter that's used in the project.
- Pyright: Pyright is used for type checking Python code.
Documentation
- mdbook: mdbook is used for building the documentation.
Stress testing
- GNS3: GNS3 is used to simulated networks.
Development Workflow
The development workflow is managed by just, a command runner that's similar
to make. The justfile at the root of the repository defines various commands
for building, testing, running, and managing the project.
Here are the steps to set up the development environment and use just:
-
Install Dependencies: Install all the required tools listed in this chapter.
-
Prepare the Environment: Run
just prepareto install Python dependencies, start Docker services, and run database migrations. -
Run the Application: Use
just runto run the application. You can pass arguments to the application by appending them to the command, likejust run --arg. -
Run the Probe Script: Use
just probeto run the probe script. You can pass arguments to the script in the same way as the run command. -
Format the Code: Use
just formatto format the code in the project using various formatters. -
Lint the Code: Use
just lintto lint the code in the project using various linters. -
Test the Code: Use
just testto run the tests for the project. -
Build the Project: Use
just buildto build the project. This will create a release build of the project and move the output to theartifactsdirectory. -
Generate Documentation: Use
just docsto generate the project's documentation. This will build the documentation and move the output to theartifactsdirectory.
Remember to run just prepare whenever you pull new changes from the
repository, to ensure your environment is up-to-date.