From 0c52235dea9b527a52c8703c684f497481f2b51f Mon Sep 17 00:00:00 2001 From: Rain Jiang Date: Mon, 27 Nov 2023 13:21:57 -0800 Subject: [PATCH] refine docs --- .gitignore | 1 + LICENSE => LICENSE-APACHE | 0 LICENSE-MIT | 25 +++++++ README.md | 74 ++++++++++++++----- docs/{ => cloudwego}/FAQ/_index.md | 0 .../{ => cloudwego}/Getting Started/_index.md | 0 docs/{ => cloudwego}/Overview/_index.md | 0 docs/{ => cloudwego}/Reference/_index.md | 0 docs/{ => cloudwego}/_index.md | 0 docs/wiki_on_cloudwego.md | 20 +++++ examples/config.toml | 22 +++--- wiki.sh | 19 ----- 12 files changed, 113 insertions(+), 48 deletions(-) rename LICENSE => LICENSE-APACHE (100%) create mode 100644 LICENSE-MIT rename docs/{ => cloudwego}/FAQ/_index.md (100%) rename docs/{ => cloudwego}/Getting Started/_index.md (100%) rename docs/{ => cloudwego}/Overview/_index.md (100%) rename docs/{ => cloudwego}/Reference/_index.md (100%) rename docs/{ => cloudwego}/_index.md (100%) create mode 100644 docs/wiki_on_cloudwego.md delete mode 100644 wiki.sh diff --git a/.gitignore b/.gitignore index f392f1b..1da6252 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ *.pem /examples/certs +/docs/cloudwego.github.io \ No newline at end of file diff --git a/LICENSE b/LICENSE-APACHE similarity index 100% rename from LICENSE rename to LICENSE-APACHE diff --git a/LICENSE-MIT b/LICENSE-MIT new file mode 100644 index 0000000..12911c9 --- /dev/null +++ b/LICENSE-MIT @@ -0,0 +1,25 @@ +Copyright (c) 2023 ihciah, rainj-me and other Monolake Contributors + +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/README.md b/README.md index dea5915..e5eaed7 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,67 @@ # Monolake -Introducing Monolake: a Rust-based proxy with a focus on performance and scale. Leveraging the Monoio runtime and harnessing io-uring, Monolake capitalizes on Rust's efficiency and memory safety. +Monolake is a Rust-based high performance Layer 7 proxy framework which is built on the [Monoio](https://github.com/bytedance/monoio) runtime. -# Generating Wiki +## Quick Start -The docs folder will eventually move to [cloudwego.io](https://www.cloudwego.io/). You'll have to generate them locally for now. +### Preparation -## 1. Install Hugo +```bash +# install rust toolchain +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -- Install a recent release of the Hugo "extended" version. If you install from the [Hugo release page](https://github.com/gohugoio/hugo/releases), make sure you download the `_extended` version which supports SCSS. +# clone repo +git clone https://github.com/cloudwego/monolake.git +cd monolake -- If you have installed the latest version of Go, you can install directly by running the following command: - ``` - go install -tags extended github.com/gohugoio/hugo@latest - ``` +# generate certs +mkdir examples/certs && openssl req -x509 -newkey rsa:2048 -keyout examples/certs/key.pem -out examples/certs/cert.pem -sha256 -days 365 -nodes -subj "/CN=monolake.cloudwego.io" +``` -- Alternatively, you can use the package manager to install Hugo: - - For Linux: `sudo apt install hugo` - - For macOS: `brew install hugo` +### Build -## 2. Run `wiki.sh` +```bash +# build dev binary +cargo build -- Execute the `wiki.sh` script, which performs the following tasks: - - Checks out the [cloudwego/cloudwego.github.io](https://github.com/cloudwego/cloudwego.github.io) repository. - - Copies the local `docs` folder to `content/en/docs/monolake/` within the cloned repository. - - Starts the Hugo server for preview. \ No newline at end of file +# build release binary +cargo build --release + +# build lto release binary +cargo build --profile=release-lto +``` + +### Run examples + +```bash +# run example with debug version +target/debug/monolake -c examples/config.toml + +# enable debug logging level +RUST_LOG=debug target/debug/monolake -c examples/config.toml + +# send https request +curl -kvvv https://localhost:8082/ +``` + +## Limitations + +1. On Linux 5.6+, both uring and epoll are supported +2. On Linux 2.6+, only epoll is supported +3. On macOS, kqueue is used +4. Other platforms are currently not supported + +## Community + +Monoio is a subproject of [CloudWeGo](https://www.cloudwego.io). + +## Dependencies + +- [monoio](https://github.com/bytedance/monoio), Rust runtime +- [monoio-codec](https://github.com/monoio-rs/monoio-codec) +- [monoio-tls](https://github.com/monoio-rs/monoio-tls), tls wrapper for monoio +- [monoio-http](https://github.com/monoio-rs/monoio-http), http protocols implementation base monoio + +## License + +Monoio is licensed under the MIT license or Apache license. \ No newline at end of file diff --git a/docs/FAQ/_index.md b/docs/cloudwego/FAQ/_index.md similarity index 100% rename from docs/FAQ/_index.md rename to docs/cloudwego/FAQ/_index.md diff --git a/docs/Getting Started/_index.md b/docs/cloudwego/Getting Started/_index.md similarity index 100% rename from docs/Getting Started/_index.md rename to docs/cloudwego/Getting Started/_index.md diff --git a/docs/Overview/_index.md b/docs/cloudwego/Overview/_index.md similarity index 100% rename from docs/Overview/_index.md rename to docs/cloudwego/Overview/_index.md diff --git a/docs/Reference/_index.md b/docs/cloudwego/Reference/_index.md similarity index 100% rename from docs/Reference/_index.md rename to docs/cloudwego/Reference/_index.md diff --git a/docs/_index.md b/docs/cloudwego/_index.md similarity index 100% rename from docs/_index.md rename to docs/cloudwego/_index.md diff --git a/docs/wiki_on_cloudwego.md b/docs/wiki_on_cloudwego.md new file mode 100644 index 0000000..e9885bc --- /dev/null +++ b/docs/wiki_on_cloudwego.md @@ -0,0 +1,20 @@ +# Overview + +The cloudwego folder contains all the wiki content host on [CloudWeGo](https://www.cloudwego.io). + +## Preview Wiki + +``` bash +# install hugo +brew install hugo + +# clone the cloudwego repo +git clone https://github.com/cloudwego/cloudwego.github.io + +# sync the content to cloudwego folder +rsync -a cloudwego cloudwego.github.io/content/en/docs/monolake + +# run hugo server +cd cloudwego.github.io +hugo server --bind ::1 -D +``` diff --git a/examples/config.toml b/examples/config.toml index 5530dcd..9e0c7ac 100644 --- a/examples/config.toml +++ b/examples/config.toml @@ -5,14 +5,12 @@ entries = 1024 [servers.server_basic] -name = "proxy.monolake.rs" +name = "monolake.cloudwego.io" listener = { type = "socket", value = "0.0.0.0:8080" } [[servers.server_basic.routes]] path = '/' -upstreams = [ - { endpoint = { type = "uri", value = "http://127.0.0.1:9080" }, version = "HTTP2" }, -] +upstreams = [{ endpoint = { type = "uri", value = "http://127.0.0.1:9080" } }] [[servers.server_basic.routes]] path = '/*p' @@ -20,8 +18,8 @@ upstreams = [{ endpoint = { type = "uri", value = "http://127.0.0.1:9080" } }] [servers.server_tls] -tls = { chain = "examples/certs/server.crt", key = "examples/certs/server.pkcs8" } -name = "proxy.monolake.rs" +tls = { chain = "examples/certs/cert.pem", key = "examples/certs/key.pem" } +name = "monolake.cloudwego.io" listener = { type = "socket", value = "0.0.0.0:8081" } [[servers.server_tls.routes]] @@ -34,7 +32,7 @@ upstreams = [{ endpoint = { type = "uri", value = "http://127.0.0.1:8080" } }] [servers.server_uds] -name = "proxy.monolake.rs" +name = "monolake.cloudwego.io" listener = { type = "unix", value = "/tmp/monolake.sock" } [[servers.server_uds.routes]] @@ -54,8 +52,8 @@ path = '/*p' [servers.server3] -tls = { chain = "examples/certs/server.crt", key = "examples/certs/server.pkcs8", stack = "rustls" } -name = "proxy.monolake.rs" +tls = { chain = "examples/certs/cert.pem", key = "examples/certs/key.pem", stack = "rustls" } +name = "monolake.cloudwego.io" listener = { type = "socket", value = "0.0.0.0:8082" } [[servers.server3.routes]] @@ -66,10 +64,10 @@ upstreams = [ [servers.server4] -tls = { chain = "examples/certs/server.crt", key = "examples/certs/server.pkcs8", stack = "native_tls" } -name = "proxy.monolake.rs" +tls = { chain = "examples/certs/cert.pem", key = "examples/certs/key.pem", stack = "native_tls" } +name = "monolake.cloudwego.io" listener = { type = "socket", value = "0.0.0.0:8083" } [[servers.server4.routes]] -upstreams = [{ endpoint = { type = "uri", value = "https://rsproxy.cn" } }] +upstreams = [{ endpoint = { type = "uri", value = "https://www.wikipedia.org" } }] path = '/' diff --git a/wiki.sh b/wiki.sh deleted file mode 100644 index 1f6066a..0000000 --- a/wiki.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# Function to print progress logs -function log_progress { - echo "[$(date +'%Y-%m-%d %H:%M:%S')] $1" -} - -# Clone cloudwego.github.io repository -log_progress "Cloning cloudwego.github.io repository..." -git clone https://github.com/cloudwego/cloudwego.github.io - -# Copy contents of docs folder to cloudwego.github.io/content/en/docs/monolake/ -log_progress "Copying contents to cloudwego.github.io..." -cp -R docs cloudwego.github.io/content/en/docs/monolake - -# Start Hugo server for preview -log_progress "Starting Hugo server for preview..." -cd cloudwego.github.io -hugo server -D