Getting Started with Sail

Sail provides a command-line interface (CLI) tool and web-based admin interface to help you create and manage API gateway configurations. This guide shows you how to install and configure Sail on your system. Sail requires .NET 9.0 SDK.

Before installing Sail, ensure you have the required prerequisites set up.

Install using Docker Compose

The Sail gateway is installed using Docker Compose, which starts all required services including MongoDB, Management API, Proxy Gateway, and Web UI.

Download and install

You can download and run the script in a single command, to install Sail as a containerized service:

git clone https://github.com/lqlive/sail.git
cd sail
docker-compose up -d

The script installs the latest stable release of Sail. After installation, access the Web UI at http://localhost:5173

Alternatively, you can clone the repository and run it as a two-step process:

  1. 1

    Clone the repository:

    git clone https://github.com/lqlive/sail.git
  2. 2

    Navigate to the directory and start services:

    cd sail && docker-compose up -d

Install for local development

For local development, you can run each component separately. This approach gives you more control over the development workflow.

Prerequisites

  • .NET 9.0 SDK or later
  • MongoDB 4.4 or later
  • Node.js 18+ (for Web UI development)

1️⃣ Start MongoDB

docker run -d -p 27017:27017 --name sail-mongodb mongo:latest

2️⃣ Run the Management API

cd src/Sail
dotnet run

The Management API will start on http://localhost:5000

3️⃣ Run the Proxy Gateway

cd src/Sail.Proxy
dotnet run

The Proxy Gateway will start on http://localhost:8080

4️⃣ Run the Web UI

cd web
npm install
npm run dev

The Web UI will start on http://localhost:5173

Create your first configuration

Once Sail is running, you can create your first API gateway configuration through the Web UI or REST API.

Step 1: Create a cluster

A cluster defines a group of backend destinations. Navigate to the Clusters page and create a new cluster:

{
  "id": "my-api-cluster",
  "destinations": {
    "backend-1": {
      "address": "https://api.example.com"
    }
  },
  "loadBalancingPolicy": "RoundRobin"
}

Step 2: Create a route

Routes define how incoming requests are matched and forwarded to clusters:

{
  "routeId": "my-api-route",
  "clusterId": "my-api-cluster",
  "match": {
    "path": "/api/{**catch-all}"
  }
}

Step 3: Test the gateway

Send a request through the gateway to verify the configuration:

curl http://localhost:8080/api/users

The gateway will forward this request to https://api.example.com/api/users

See also