Skip to content

Commit

Permalink
chore(doc): add quick-launch instructions
Browse files Browse the repository at this point in the history
Closes #28
  • Loading branch information
graelo committed Sep 20, 2024
1 parent 82747ec commit d381fc6
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,41 @@ $ sudo pumas run --json | jq '.metrics.e_clusters[0].cpus[2].active_ratio'
The JSON schema and an example are available in the [schema](./schema) directory.
### Quick Launch
Some users reported they want a shorter way to launch Pumas. A quick way to do that is to
give your user the ability to sudo run without password the `pumas` command (and only that
command, for security reasons).
To achieve this, let's create a "drop-in" file `/etc/sudoers.d/pumas`
```sh
sudo visudo -f /etc/sudoers.d/pumas
```
Add the following line to the file, replacing `username` with your username:
```sudoers
username ALL=(ALL) NOPASSWD: /opt/homebrew/bin/pumas
```
If you later remove `pumas`, you just have to delete this file. It's not a great practice to
modify `/etc/sudoers` directly.
Now you can run `sudo pumas run` without being asked your password. You're free to add an alias
to your shell, such as
```sh
alias pumas='sudo pumas run'
```
Thanks to user @woshiniming007 for the suggestion!
#### Security considerations
- You should limit the commands you allow to run without password to the minimum necessary.
- You should use a drop-in file to avoid modifying `/etc/sudoers` directly.
## Source of metrics
`sysinfo` crate is used to measure the following:
Expand Down
35 changes: 35 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,41 @@
//!
//! The JSON schema and an example are available in the [schema](./schema) directory.
//!
//! ### Quick Launch
//!
//! Some users reported they want a shorter way to launch Pumas. A quick way to do that is to
//! give your user the ability to sudo run without password the `pumas` command (and only that
//! command, for security reasons).
//!
//! To achieve this, let's create a "drop-in" file `/etc/sudoers.d/pumas`
//!
//! ```sh
//! sudo visudo -f /etc/sudoers.d/pumas
//! ```
//!
//! Add the following line to the file, replacing `username` with your username:
//!
//! ```sudoers
//! username ALL=(ALL) NOPASSWD: /opt/homebrew/bin/pumas
//! ```
//!
//! If you later remove `pumas`, you just have to delete this file. It's not a great practice to
//! modify `/etc/sudoers` directly.
//!
//! Now you can run `sudo pumas run` without being asked your password. You're free to add an alias
//! to your shell, such as
//!
//! ```sh
//! alias pumas='sudo pumas run'
//! ```
//!
//! Thanks to user @woshiniming007 for the suggestion!
//!
//! #### Security considerations
//!
//! - You should limit the commands you allow to run without password to the minimum necessary.
//! - You should use a drop-in file to avoid modifying `/etc/sudoers` directly.
//!
//! ## Source of metrics
//!
//! `sysinfo` crate is used to measure the following:
Expand Down

0 comments on commit d381fc6

Please sign in to comment.