Skip to content

Commit

Permalink
refine docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rain Jiang committed Nov 27, 2023
1 parent fec5488 commit 0c52235
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 48 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
*.pem

/examples/certs
/docs/cloudwego.github.io
File renamed without changes.
25 changes: 25 additions & 0 deletions LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -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.
74 changes: 57 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.
# 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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions docs/wiki_on_cloudwego.md
Original file line number Diff line number Diff line change
@@ -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
```
22 changes: 10 additions & 12 deletions examples/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,21 @@ 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'
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]]
Expand All @@ -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]]
Expand All @@ -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]]
Expand All @@ -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 = '/'
19 changes: 0 additions & 19 deletions wiki.sh

This file was deleted.

0 comments on commit 0c52235

Please sign in to comment.