You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/09/26 01:48:47 UTC

[GitHub] [apisix-website] SylviaBABY commented on a diff in pull request #1340: docs: Add Apache APISIX loves Rust

SylviaBABY commented on code in PR #1340:
URL: https://github.com/apache/apisix-website/pull/1340#discussion_r979502794


##########
blog/en/blog/2022/09/28/rust-loves-apisix.md:
##########
@@ -0,0 +1,198 @@
+---
+title: "Apache APISIX loves Rust!"
+authors:
+  - name: Nicolas Fränkel
+    title: Author
+    url: https://github.com/nfrankel
+    image_url: https://avatars.githubusercontent.com/u/752258
+keywords: 
+- API gateway
+- Apache APISIX
+- Rust
+- WebAssembly
+description: This article shows the steps to perform to develop and deploy WebAssembly plugins from Rust.
+tags: [Case Studies]
+---
+
+> This article shows the steps to perform to develop and deploy WebAssembly plugins from Rust.
+
+<!--truncate-->
+
+<head>
+    <link rel="canonical" href="https://blog.frankel.ch/rust-apisix/1/" />
+</head>
+
+Apache APISIX is built upon the shoulders of two giants:
+
+* [NGINX](https://www.nginx.com/), a widespread Open Source reverse-proxy
+* [OpenResty](https://openresty.org/en/), a platform that allows scripting NGINX with the [Lua](https://www.lua.org/) programming language via [LuaJIT](https://luajit.org/)
+
+This approach allows APISIX to provide out-of-the-box Lua plugins that should fit most business requirements. But it always comes a time when generic plugins don't fit your requirements. In this case, you can write your own Lua plugin.
+
+However, if Lua is not part of your tech stack, [diving into a new ecosystem is a considerable investment](https://blog.frankel.ch/on-learning-new-programming-language/). Therefore, Apache APISIX offers developers to write plugins in several other languages. In this post, I'd like to highlight how to write such a plugin with Rust.
+
+## A bit of context
+
+Before I dive into the "how", let me first describe a bit of context surrounding the Rust integration in Apache APISIX. I believe it's a good story because it highlights the power of Open Source.
+
+It starts with the Envoy proxy.
+
+> Envoy is an open source edge and service proxy, designed for cloud-native applications
+>
+> -- https://www.envoyproxy.io/
+
+Around 2019, Envoy's developers realized a simple truth. Since Envoy is a statically compiled binary, integrators who need to extend it must compile it from the modified source instead of using the official binary version. Issues range from supply chains more vulnerable to attacks to a longer drift when a new version is released. For end-users, whose core business is much further, it means having to hire specialized skills for this reason only.
+
+The team considered to solve the issue with C++ extensions, but discarded this approach as neither <abbr title="Application Programmer Interface">API</abbr>s nor <abbr title="Application Binary Interface">ABI</abbr>s were stable. Instead, they chose to provide a stable WebAssembly-based ABI. If you're interested in a more detailed background, you can read the whole piece [on GitHub](https://github.com/proxy-wasm/spec/blob/master/docs/WebAssembly-in-Envoy.md).
+
+The specification is available on [GitHub](https://github.com/proxy-wasm/spec).
+
+* Developers can create SDK for their tech stack
+* Proxy and API Gateway providers can integrate `proxy-wasm` in their product
+
+## Apache APISIX and proxy-wasm
+
+The Apache APISIX project decided to integrate `proxy-wasm` into the product to benefit from the standardization effort. It also allows end-users to start with Envoy, or any other `proxy-wasm`-compatible reverse proxy, to migrate to Apache APISIX when necessary.
+
+APISIX doesn't implement `proxy-wasm` but integrates [wasm-nginx-module](https://github.com/api7/wasm-nginx-module). It's an Apache v2-licensed project provided by [api7.ai](https://api7.ai/), one of the main contributors to Apache APISIX. As its name implies, integration is done at the NGINX level.
+
+![Apache APISIX and WebAssemby architecture overview](https://api7.ai/wp-content/uploads/2022/09/architecture-diagram.png)
+
+## Let's code!
+
+Now that we have explained how everything fits together, it's time to code.
+
+### Preparing Rust for WebAssembly
+
+Before developing the first line of code, we need to give Rust <abbr title="WebAssembly">WASM</abbr> compilation capabilities.
+
+```bash

Review Comment:
   need to change the `bash` code type to `shell` in the rest of the content. Others LGTM



##########
blog/en/blog/2022/09/28/rust-loves-apisix.md:
##########
@@ -0,0 +1,198 @@
+---
+title: "Apache APISIX loves Rust!"
+authors:
+  - name: Nicolas Fränkel
+    title: Author
+    url: https://github.com/nfrankel
+    image_url: https://avatars.githubusercontent.com/u/752258
+keywords: 
+- API gateway
+- Apache APISIX
+- Rust
+- WebAssembly
+description: This article shows the steps to perform to develop and deploy WebAssembly plugins from Rust.
+tags: [Case Studies]
+---
+
+> This article shows the steps to perform to develop and deploy WebAssembly plugins from Rust.
+
+<!--truncate-->
+
+<head>
+    <link rel="canonical" href="https://blog.frankel.ch/rust-apisix/1/" />
+</head>
+
+Apache APISIX is built upon the shoulders of two giants:
+
+* [NGINX](https://www.nginx.com/), a widespread Open Source reverse-proxy
+* [OpenResty](https://openresty.org/en/), a platform that allows scripting NGINX with the [Lua](https://www.lua.org/) programming language via [LuaJIT](https://luajit.org/)
+
+This approach allows APISIX to provide out-of-the-box Lua plugins that should fit most business requirements. But it always comes a time when generic plugins don't fit your requirements. In this case, you can write your own Lua plugin.
+
+However, if Lua is not part of your tech stack, [diving into a new ecosystem is a considerable investment](https://blog.frankel.ch/on-learning-new-programming-language/). Therefore, Apache APISIX offers developers to write plugins in several other languages. In this post, I'd like to highlight how to write such a plugin with Rust.
+
+## A bit of context
+
+Before I dive into the "how", let me first describe a bit of context surrounding the Rust integration in Apache APISIX. I believe it's a good story because it highlights the power of Open Source.
+
+It starts with the Envoy proxy.
+
+> Envoy is an open source edge and service proxy, designed for cloud-native applications
+>
+> -- https://www.envoyproxy.io/
+
+Around 2019, Envoy's developers realized a simple truth. Since Envoy is a statically compiled binary, integrators who need to extend it must compile it from the modified source instead of using the official binary version. Issues range from supply chains more vulnerable to attacks to a longer drift when a new version is released. For end-users, whose core business is much further, it means having to hire specialized skills for this reason only.
+
+The team considered to solve the issue with C++ extensions, but discarded this approach as neither <abbr title="Application Programmer Interface">API</abbr>s nor <abbr title="Application Binary Interface">ABI</abbr>s were stable. Instead, they chose to provide a stable WebAssembly-based ABI. If you're interested in a more detailed background, you can read the whole piece [on GitHub](https://github.com/proxy-wasm/spec/blob/master/docs/WebAssembly-in-Envoy.md).
+
+The specification is available on [GitHub](https://github.com/proxy-wasm/spec).
+
+* Developers can create SDK for their tech stack
+* Proxy and API Gateway providers can integrate `proxy-wasm` in their product
+
+## Apache APISIX and proxy-wasm
+
+The Apache APISIX project decided to integrate `proxy-wasm` into the product to benefit from the standardization effort. It also allows end-users to start with Envoy, or any other `proxy-wasm`-compatible reverse proxy, to migrate to Apache APISIX when necessary.
+
+APISIX doesn't implement `proxy-wasm` but integrates [wasm-nginx-module](https://github.com/api7/wasm-nginx-module). It's an Apache v2-licensed project provided by [api7.ai](https://api7.ai/), one of the main contributors to Apache APISIX. As its name implies, integration is done at the NGINX level.
+
+![Apache APISIX and WebAssemby architecture overview](https://api7.ai/wp-content/uploads/2022/09/architecture-diagram.png)
+
+## Let's code!
+
+Now that we have explained how everything fits together, it's time to code.
+
+### Preparing Rust for WebAssembly
+
+Before developing the first line of code, we need to give Rust <abbr title="WebAssembly">WASM</abbr> compilation capabilities.
+
+```bash

Review Comment:
   ```suggestion
   ```shell
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org