diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..8bd4e7f --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +thuburrow.com. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 027f01b..12fd15f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -22,7 +22,13 @@ Follow the official [naming convention](https://rust-lang.github.io/api-guidelin ## Building Mitosis -Mitosis builds on stable Rust, if you want to build mdBook from source, here are the steps to follow: +### Dependencies + +You have to install pkg-config, libssl-dev if you want to build the binary from source. + +### Building + +Mitosis builds on stable Rust, if you want to build it from source, here are the steps to follow: 1. Navigate to the directory of your choice 2. Clone this repository with git. diff --git a/README.md b/README.md index 1684fbe..f4b0360 100644 --- a/README.md +++ b/README.md @@ -2,18 +2,18 @@ **Mitosis** is a Rust library and a command line tool to run distributed platforms for transport research. -This guide is an example of how to use Mitosis to run a simple distributed platform to parallelize your tasks. +This guide is an example of how to use **Mitosis** to run a simple distributed platform to parallelize your tasks. It is designed for transport-layer research, but it can be used for any other purpose. ## Usage -Please check our [User Guide](https://stack.rs/mitosis/guide) for how to use Mitosis. +Please check our [User Guide](https://docs.stack.rs/mitosis) for how to use **Mitosis**. ## Contributing -Mitosis is free and open source. You can find the source code on +**Mitosis** is free and open source. You can find the source code on [GitHub](https://github.com/stack-rs/mitosis) and issues and feature requests can be posted on -the [GitHub issue tracker](https://github.com/stack-rs/mitosis/issues). Mitosis relies on the community to fix bugs and +the [GitHub issue tracker](https://github.com/stack-rs/mitosis/issues). **Mitosis** relies on the community to fix bugs and add features: if you'd like to contribute, please read the [CONTRIBUTING](https://github.com/stack-rs/mitosis/blob/master/CONTRIBUTING.md) guide and consider opening a [pull request](https://github.com/stack-rs/mitosis/pulls). diff --git a/guide/src/README.md b/guide/src/README.md index d3ab9a1..100d457 100644 --- a/guide/src/README.md +++ b/guide/src/README.md @@ -5,6 +5,18 @@ This guide is an example of how to use Mitosis to run a simple distributed platform to parallelize your tasks. It is designed for transport-layer research, but it can be used for any other purpose. +## Basic Workflow + +The Mitosis CLI tool is a single binary that provides subcommands for starting the Coordinator, Worker and Client processes. + +Users function as units for access control, while groups operate as units for tangible resource control. +Every user has an identically named group but also has the option to create or join additional groups. + +Users can delegate tasks to various groups via the Client, which are then delivered to the Coordinator and subsequently executed by the corresponding Worker. +Each Worker can be configured to permit specific groups and carry tags to denote its characteristics. + +Tasks, once submitted, are distributed to different Workers based on their groups and tags. Every task is assigned a unique UUID, allowing users to track the status and results of their tasks. + ## Contributing Mitosis is free and open source. You can find the source code on diff --git a/guide/src/client/sdk.md b/guide/src/client/sdk.md index c49ec3d..03f8a69 100644 --- a/guide/src/client/sdk.md +++ b/guide/src/client/sdk.md @@ -11,7 +11,7 @@ netmito = "0.1" Here is a simple example of how to create a new user using the SDK: -```rust +```rust,ignore # use netmito::client::MitoClient; # use netmito::config::client::{ClientConfig, CreateUserArgs}; # diff --git a/guide/src/guide/client.md b/guide/src/guide/client.md index 28142e0..e0127eb 100644 --- a/guide/src/guide/client.md +++ b/guide/src/guide/client.md @@ -1,24 +1,30 @@ # Running a Client -A Client is a process that interact with the Coordinator. It is responsible for creating tasks, querying their results, and managing workers or groups. The Client is a short-lived process that is typically run on-demand. +A Client is a process that interact with the Coordinator. +It is responsible for creating tasks, querying their results, and managing workers or groups. +The Client is a short-lived process that is typically run on-demand. ## Starting a Client -While it's possible to provide a TOML configuration file to the client, it's often unnecessary given the limited number of configuration items, all of which pertain to login procedures. +While it's possible to provide a TOML configuration file to the client, +it's often unnecessary given the limited number of configuration items, all of which pertain to login procedures. Typically, to start a Client, we can simply run the following command to enter interactive mode: -```sh +```bash mito client -i ``` -If a user has never logged in or if his/her session has expired, the Client will prompt them to re-input their username and password for authentication. Alternatively, they can directly specify their username (`-u`) or password (`-p`) during execution. Once authenticated, the Client will retain their credentials in a file for future use. +If a user has never logged in or if his/her session has expired, the Client will prompt them to re-input their username and password for authentication. +Alternatively, they can directly specify their username (`-u`) or password (`-p`) during execution. +Once authenticated, the Client will retain their credentials in a file for future use. We recommend using the interactive mode for most operations, as it provides a more user-friendly experience. -We can also directly run a command without entering interactive mode by specifying the command as an argument. For example, to create a new user, we can run: +We can also directly run a command without entering interactive mode by specifying the command as an argument. +For example, to create a new user, we can run: -```sh +```bash mito client create user -u new_user -p new_password ``` @@ -49,7 +55,8 @@ Options: -V, --version Print version ``` -To know how each subcommand works, you can run `mito client --help`. For example, to know how to create a new user, you can run `mito client create user --help`: +To know how each subcommand works, you can run `mito client --help`. +For example, to know how to create a new user, you can run `mito client create user --help`: ```txt Create a new user diff --git a/guide/src/guide/coordinator.md b/guide/src/guide/coordinator.md index 4dc857d..82898dd 100644 --- a/guide/src/guide/coordinator.md +++ b/guide/src/guide/coordinator.md @@ -1,12 +1,39 @@ # Running a Coordinator -A Coordinator is a process that manages the execution of a workflow. It is responsible for scheduling tasks, tracking their progress, and handling failures. The Coordinator is a long-running process that is typically deployed as a service. +A Coordinator is a process that manages the execution of a workflow. +It is responsible for scheduling tasks, tracking their progress, and handling failures. +The Coordinator is a long-running process that is typically deployed as a service. + +## External Requirements + +The Coordinator requires access to several external services. +It needs a PostgreSQL database to store data, an S3-compatible storage service to store task artifacts or group attachments. +The Redis server is an optional service that acts as a pub/sub provider, +enabling clients to subscribe to and query more comprehensive details regarding the execution status of tasks. + +For those services, you can use the docker-compose file provided in the repository. +First, Copy `.env.example` to `.env` and set the variables in it. +And then, run the following command to start the services: + +```bash +docker-compose up -d +``` + +The Coordinator also requires a private and public key pair to sign and verify access tokens. +For the private and public keys, you can generate them using the following commands: + +```bash +openssl genpkey -algorithm ed25519 -out private.pem +openssl pkey -in private.pem -pubout -out public.pem +``` ## Starting a Coordinator -To start a Coordinator, you need to provide a TOML file that configures the Coordinator. The TOML file specifies the Coordinator's configuration, such as the address it binds to, the URL of the postgres database, and token expiry settings. All configuration options are optional and have default values. +To start a Coordinator, you need to provide a TOML file that configures the Coordinator. +The TOML file specifies the Coordinator's configuration, such as the address it binds to, the URL of the postgres database, and token expiry settings. +All configuration options are optional and have default values. -Here is an example of a Coordinator configuration file: +Here is an example of a Coordinator configuration file (you can also refer to `config.example.toml` in the repository): ```toml [coordinator] @@ -28,16 +55,9 @@ file_log = false # log_path is not set. It will use the default rolling log file path if file_log is set to true ``` -For the private and public keys, you can generate them using the following commands: - -```sh -openssl genpkey -algorithm ed25519 -out private.pem -openssl pkey -in private.pem -pubout -out public.pem -``` - To start a Coordinator, run the following command: -```sh +```bash mito coordinator --config /path/to/coordinator.toml ``` @@ -47,7 +67,7 @@ We can also override the configuration settings using command-line arguments. Note that the names of command-line arguments may not be the same as those in the configuration file. For example, to change the address the Coordinator binds to, you can run: -```sh +```bash mito coordinator --config /path/to/coordinator.toml --bind 0.0.0.0:8000 ``` diff --git a/guide/src/guide/installation.md b/guide/src/guide/installation.md index 79bcafe..c433b83 100644 --- a/guide/src/guide/installation.md +++ b/guide/src/guide/installation.md @@ -6,6 +6,8 @@ and a SDK library (named `netmito`) that you can use to create your own client. There are multiple ways to install the Mitosis CLI tool. Choose any one of the methods below that best suit your needs. +> **ATTENTION**: As we are still in the early stages of development without a released version, we only support building from source currently. + ## Pre-compiled binaries Executable binaries are available for download on the [GitHub Releases page][releases]. @@ -13,7 +15,7 @@ Download the binary and extract the archive. The archive contains an `mito` executable which you can run to start your distributed platform. To make it easier to run, put the path to the binary into your `PATH` or install it in a directory that is already in your `PATH`. -For example, do `sudo install mito /usr/local/bin/mito` on Linux. +For example, do `sudo install -m 755 mito /usr/local/bin/mito` on Linux. [releases]: https://github.com/stack-rs/mitosis/releases @@ -23,14 +25,14 @@ For example, do `sudo install mito /usr/local/bin/mito` on Linux. You have to install pkg-config, libssl-dev if you want to build the binary from source. -### Building +### Installing with Cargo To build the `mito` executable from source, you will first need to install Rust and Cargo. Follow the instructions on the [Rust installation page]. Once you have installed Rust, the following command can be used to build and install mito: -```sh +```bash cargo install mito ``` @@ -44,28 +46,29 @@ To uninstall, run the command `cargo uninstall mito`. [Rust installation page]: https://www.rust-lang.org/tools/install [crates.io]: https://crates.io/ -### Installing the latest master version +### Installing the latest git version with Cargo The version published to crates.io will ever so slightly be behind the version hosted on GitHub. If you need the latest version you can build the git version of mito yourself. Cargo makes this ***super easy***! -```sh +```bash cargo install --git https://github.com/stack-rs/mitosis.git mito ``` Again, make sure to add the Cargo bin directory to your `PATH`. -## Basic Workflow - -The Mitosis CLI tool is a single binary that provides subcommands for starting the Coordinator, Worker and Client processes. +### Building from source -Users function as units for access control, while groups operate as units for tangible resource control. -Every user has an identically named group but also has the option to create or join additional groups. +If you want to build the binary from source, you can clone the repository and build it using Cargo. -Users can delegate tasks to various groups via the Client, which are then delivered to the Coordinator and subsequently executed by the corresponding Worker. Each Worker can be configured to permit specific groups and carry tags to denote its characteristics. +```bash +git clone https://github.com/stack-rs/mitosis.git +cd mitosis +cargo build --release +``` -Tasks, once submitted, are distributed to different Workers based on their groups and tags. Every task is assigned a unique UUID, allowing users to track the status and results of their tasks. +Then you can find the binary in `target/release/mito` and install or run it as you like. ## Modifying and contributing diff --git a/guide/src/guide/worker.md b/guide/src/guide/worker.md index a3c15ac..1d79d92 100644 --- a/guide/src/guide/worker.md +++ b/guide/src/guide/worker.md @@ -1,12 +1,16 @@ # Running a Worker -A Worker is a process that executes tasks. It is responsible for fetching tasks from the Coordinator, executing them, and reporting the results back to the Coordinator. The Worker is a long-running process that is typically deployed as a service. +A Worker is a process that executes tasks. +It is responsible for fetching tasks from the Coordinator, executing them, and reporting the results back to the Coordinator. +The Worker is a long-running process that is typically deployed as a service. ## Starting a Worker -To start a Worker, you need to provide a TOML file that configures the Worker. The TOML file specifies the Worker's configuration, such as the polling (fetching) interval, the URL of the Coordinator, and the the groups allowed to submit tasks to it. All configuration options are optional and have default values. +To start a Worker, you need to provide a TOML file that configures the Worker. +The TOML file specifies the Worker's configuration, such as the polling (fetching) interval, the URL of the Coordinator, and the the groups allowed to submit tasks to it. +All configuration options are optional and have default values. -Here is an example of a Worker configuration file: +Here is an example of a Worker configuration file (you can also refer to `config.example.toml` in the repository): ```toml [worker] @@ -26,7 +30,7 @@ file_log = false To start a Worker, run the following command: -```sh +```bash mito worker --config /path/to/worker.toml ``` @@ -36,7 +40,7 @@ We can also override the configuration settings using command-line arguments. Note that the names of command-line arguments may not be the same as those in the configuration file. For example, to change the polling interval, you can run: -```sh +```bash mito worker --config /path/to/worker.toml --polling-interval 5m ```