Skip to content

Commit

Permalink
docs: Documents usage on README
Browse files Browse the repository at this point in the history
  • Loading branch information
andyquinterom committed Dec 1, 2023
1 parent fa2b616 commit 89fd98d
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "faucet-server"
version = "0.2.2"
version = "0.2.3"
edition = "2021"
authors = ["Andrés F. Quintero <afquinteromoreano@gmail.com>"]
description = "Welcome to Faucet, your go-to solution for deploying Plumber APIs and Shiny Applications with blazing speed and efficiency. Faucet is a high-performance server built with Rust, offering Round Robin and Round Robin + IP Hash load balancing for seamless scaling and distribution of your R applications. Whether you're a data scientist, developer, or DevOps enthusiast, Faucet streamlines the deployment process, making it easier than ever to manage replicas and balance loads effectively."
Expand Down
84 changes: 79 additions & 5 deletions README.md
Expand Up @@ -14,21 +14,95 @@ Welcome to Faucet, your go-to solution for deploying Plumber APIs and Shiny Appl

- **Asynchronous & Concurrent:** Faucet leverages asynchronous and concurrent processing, ensuring optimal utilization of resources and responsive handling of requests.

## Usage

### Get some help

To display the help message, run the following command:

```bash
faucet --help
```

### Start a Plumber API

To start a plumber API, you will simply need to specify the directory containing the `'plumber.R'` file. Faucet will automatically detect the file and start the API.

```bash
faucet --dir /path/to/plumber/api
```

The server will automatically listen on port `3838` by default. To change the host and port, use the `--host` flag to specify the socket address to bind to the service.

```bash
faucet --dir /path/to/plumber/api --host 0.0.0.0:3000
```

By default Faucet will start as many workers as there are logical cores on the machine. To specify the number of workers, use the `--workers` flag.

```bash
faucet --dir /path/to/plumber/api --workers 4
```

### Start a Shiny Application

To start a Shiny Application, you will simply need to specify the directory containing the `'app.R'` file. Faucet will automatically detect the file and start the application.

```bash
faucet --dir /path/to/shiny/app
```

The server will automatically listen on port `3838` by default. To change the host and port, use the `--host` flag to specify the socket address to bind to the service.

```bash
faucet --dir /path/to/shiny/app --host 0.0.0.0:3000
```

By default Faucet will start as many workers as there are logical cores on the machine. To specify the number of workers, use the `--workers` flag.

```bash
faucet --dir /path/to/shiny/app --workers 4
```

> **Note:** On Shiny applications, Faucet will be forced to use Round Robin + IP Hash load balancing. This is because Shiny applications require a persistent connection between the client and the server. If Round Robin load balancing is used, the client will be redirected to a different instance on each request, causing the connection to be lost.
### Pick a Load Balancing Strategy for Plumber APIs

Faucet supports two load balancing strategies for Plumber APIs: Round Robin and Round Robin + IP Hash.
By default, Faucet will use Round Robin load balancing. To change the strategy, use the `--strategy` flag.

```bash
faucet --dir /path/to/plumber/api --strategy round-robin-ip-hash
```

### Explicitly set the type of application

By default, Faucet will try to detect the type of application based on the files in the specified directory. If you want to explicitly set the type of application, use the `--type` flag.

```bash
faucet --dir /path/to/plumber/api --type plumber
```

```bash
faucet --dir /path/to/shiny/app --type shiny
```

## Installation

### Option 1: Binary Download (Linux)

Download the latest release of Faucet for Linux from the [GitHub Releases page](https://github.com/yourusername/faucet/releases).
Download the latest release of Faucet for Linux from the [GitHub Releases page](https://github.com/andyquinterom/faucet/releases). This should work with most Linux distributions.

```bash
# Replace "vX.X.X" with the latest version number
$ wget https://github.com/yourusername/faucet/releases/download/vX.X.X/faucet-linux-x86_64 -O faucet
FAUCET_VERSION="v0.2.3"

wget https://github.com/andyquinterom/Faucet/releases/download/$FAUCET_VERSION/faucet-x86_64-unknown-linux-musl -O faucet

# Make the binary executable
$ chmod +x faucet
chmod +x faucet

# Move the binary to a directory in your PATH (e.g., user local bin)
$ mv faucet ~/.local/bin/
mv faucet ~/.local/bin
```

### Option 2: Install with Cargo (Linux, macOS, Windows)
Expand Down

0 comments on commit 89fd98d

Please sign in to comment.