This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git


The following commit(s) were added to refs/heads/master by this push:
     new ee50b20  docs: add APISIX&OpenWhisk Blog (#824)
ee50b20 is described below

commit ee50b20e00c1bd477aa4c9563877ab0bcd3d903d
Author: Sylvia <[email protected]>
AuthorDate: Fri Dec 24 13:54:08 2021 +0800

    docs: add APISIX&OpenWhisk Blog (#824)
---
 .../12/24/apisix-integrate-openwhisk-plugin.md     | 187 +++++++++++++++++++++
 .../12/24/apisix-integrate-openwhisk-plugin.md     | 186 ++++++++++++++++++++
 2 files changed, 373 insertions(+)

diff --git a/website/blog/2021/12/24/apisix-integrate-openwhisk-plugin.md 
b/website/blog/2021/12/24/apisix-integrate-openwhisk-plugin.md
new file mode 100644
index 0000000..8395616
--- /dev/null
+++ b/website/blog/2021/12/24/apisix-integrate-openwhisk-plugin.md
@@ -0,0 +1,187 @@
+---
+title: "Coming soon!Apache APISIX Integrate with Apache OpenWhisk"
+authors:
+  - name: "Zeping Bai"
+    title: "Author"
+    url: "hhttps://github.com/bzp2010";
+    image_url: "https://avatars.githubusercontent.com/u/8078418?v=4";
+  - name: "Sylvia"
+    title: "Technical Writer"
+    url: "https://github.com/SylviaBABY";
+    image_url: "https://avatars.githubusercontent.com/u/39793568?v=4";
+keywords: 
+- Apache APISIX
+- Apache OpenWhisk
+- Serverless
+- Plugin
+description: This article introduces the feature prospect and usage steps of 
the `openwhisk` plug-in, which is combined with a variety of identity 
authentication plug-ins provided by Apache APISIX to achieve authentication and 
authorization and other functions.
+tags: [Technology]
+---
+
+> This article introduces the feature prospect and usage steps of the 
`openwhisk` plug-in, which is combined with a variety of identity 
authentication plug-ins provided by Apache APISIX to achieve authentication and 
authorization and other functions.
+
+<!--truncate-->
+
+In this article, we will introduce `openwhisk`, a new plug-in for Apache 
APISIX, and show you how to integrate OpenWhisk service with Apache APISIX to 
enjoy the benefits of serverless computing with detailed steps. This plugin is 
expected to go live in Apache APISIX 2.12, so stay tuned!
+
+![APISIX&OpenWhisk](https://static.apiseven.com/202108/1640313816872-b2c018be-5433-4baf-ba6a-8330e160866a.png)
+
+## Project Introduction
+
+### Apache APISIX
+
+[Apache APISIX](https://apisix.apache.org/) is a dynamic, real-time, 
high-performance API gateway that provides rich traffic management features 
such as load balancing, dynamic upstream, grayscale publishing, service fusion, 
authentication, observability, etc. Apache APISIX not only supports plug-in 
dynamic changes and hot-plugging, but also has many useful plug-ins.
+
+### Apache OpenWhisk
+
+[Apache OpenWhisk](https://openwhisk.apache.org/) is an open source 
distributed serverless platform that can respond to any scale of time by 
executing functions. It uses Docker containers to manage infrastructure, 
servers, and scale to help users build great and efficient applications.
+
+In OpenWhisk developers can use multiple programming languages to write 
functions (called Actions) that will be dynamically dispatched and processed by 
OpenWhisk in response to events (via triggers) or external requests (via HTTP 
requests).
+
+## Integration Principle
+
+Apache APISIX provides plug-in support for easy integration with Apache 
OpenWhisk. Users can define a route that includes a serverless plug-in and 
combine it with various authentication plug-ins provided by Apache APISIX to 
implement authentication and authorization functions.
+
+The general principle of operation is as follows: users can use the openwhisk 
plugin to define a "dynamic upstream" in the route, and when the route matches 
a request, it will abort the request to the original upstream and send a 
request to the API Host endpoint of OpenWhisk.
+
+> The request will contain the Namespace, Action, Service Token and raw HTTP 
request body data configured by the user for the plugin, and will return the 
response content obtained from OpenWhisk to the client.
+
+## How to use
+
+### Step 1: Set up Apache OpenWhisk test environment
+
+1. First, you need to ensure that you are using a Linux system with Docker 
software installed on it. Execute the following command.
+
+```shell
+docker run --rm -d \
+  -h openwhisk --name openwhisk \
+  -p 3233:3233 -p 3232:3232 \
+  -v /var/run/docker.sock:/var/run/docker.sock \
+  openwhisk/standalone:nightly
+
+docker exec openwhisk waitready
+```
+
+2. Wait for the command execution to complete and the following will be output.
+
+```
+ok: whisk auth set. Run 'wsk property get --auth' to see the new value.
+ok: whisk API host set to http://openwhisk:3233
+ok: updated action testme
+server initializing...
+server initializing...
+    "ready": true
+ok: deleted action testme
+```
+
+3. Create the following file `test.js` to be used as a test function.
+
+```java
+function main(args) {
+    return {
+        "hello": args.name || "",
+    };
+}
+```
+
+4. Register the above functions in OpenWhisk
+
+```shell
+# Set API Host and authentication information for the OpenWhisk CLI tool,you 
can download from https://s.apache.org/openwhisk-cli-download
+wsk property set \
+  --apihost 'http://localhost:3233' \
+  --auth 
'23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP'
+
+# Create a test function
+wsk action create test test.js
+```
+
+### Step 2: Create a route and enable OpenWhisk plugin
+
+Next we will create a route and add the openwhisk plugin to it. Execute the 
following command.
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "plugins": {
+        "openwhisk": {
+            "api_host": "http://localhost:3233";,
+            "service_token": 
"23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP",
+            "namespace": "guest",
+            "action": "test"
+        }
+    },
+    "uri": "/openwhisk"
+}'
+```
+
+### Step 3: Testing the request
+
+In the following we will use cURL for testing.
+
+```shell
+# Request and send data using POST
+curl http://127.0.0.1:9080/openwhisk -i -X POST -d '{
+    "name": "world"
+}'
+
+HTTP/1.1 200 OK
+Content-Type: application/json
+Content-Length: 17
+Server: APISIX/2.10.2
+
+{"hello":"world"}
+
+# Request using GET
+curl http://127.0.0.1:9080/openwhisk -i
+
+HTTP/1.1 200 OK
+Content-Type: application/json
+Content-Length: 12
+Server: APISIX/2.10.2
+
+{"hello":""}
+```
+
+### Step 4: Test complex responses
+
+1. Create and update the `test.js` test function
+
+```java
+function main(args) {
+    return {
+        "status": "403",
+        "headers": {
+            "test": "header"
+        },
+        "body": "A test body"
+    };
+}
+```
+
+2. Conducting test requests
+
+```shell
+# Request using GET
+curl http://127.0.0.1:9080/openwhisk -i
+
+HTTP/1.1 403 FORBIDDEN
+Content-Type: application/json
+Content-Length: 12
+test: header
+Server: APISIX/2.10.2
+
+A test body
+```
+
+### Addendum: Turning off the plugin
+
+If you are done using the OpenWhisk plug-in, simply remove the 
OpenWhisk-related configuration from the route configuration and save it to 
close the OpenWhisk plug-in on the route. At this point you can open other 
Serverless-like plug-ins or add upstream and other subsequent operations.
+
+Thanks to the dynamic advantage of Apache APISIX, the process of turning on 
and off plug-ins does not require restarting Apache APISIX, which is very 
convenient.
+
+## Summary
+
+In this article, we have introduced the feature preview and usage steps of 
`openwhisk` plugin. For more information about `openwhisk` plugin description 
and full configuration list, please refer to the [official 
documentation](https://apisix.apache.org/docs/apisix/next/plugins/openwhisk).
+
+Currently, we are also developing other Serverless plugins to integrate with 
more cloud services. If you're interested in such integration projects, feel 
free to start a discussion in [GitHub 
Discussions](https://github.com/apache/apisix/discussions) or communicate via 
the [mailing list](https://apisix.apache.org/docs/general/subscribe-guide/).
diff --git 
a/website/i18n/zh/docusaurus-plugin-content-blog/2021/12/24/apisix-integrate-openwhisk-plugin.md
 
b/website/i18n/zh/docusaurus-plugin-content-blog/2021/12/24/apisix-integrate-openwhisk-plugin.md
new file mode 100644
index 0000000..f232169
--- /dev/null
+++ 
b/website/i18n/zh/docusaurus-plugin-content-blog/2021/12/24/apisix-integrate-openwhisk-plugin.md
@@ -0,0 +1,186 @@
+---
+title: "生态丰富持续进行中,Apache OpenWhisk 集成闪亮登场"
+authors:
+  - name: "白泽平"
+    title: "Author"
+    url: "hhttps://github.com/bzp2010";
+    image_url: "https://avatars.githubusercontent.com/u/8078418?v=4";
+  - name: "苏钰"
+    title: "Technical Writer"
+    url: "https://github.com/SylviaBABY";
+    image_url: "https://avatars.githubusercontent.com/u/39793568?v=4";
+keywords: 
+- Apache APISIX
+- Apache OpenWhisk
+- Serverless
+- 插件
+description: 本文为大家介绍了关于 `openwhisk` 插件的功能前瞻与使用步骤,结合 Apache APISIX 
提供的多种身份认证插件来实现认证与授权等功能。
+tags: [Technology]
+---
+
+> 本文为大家介绍了关于 `openwhisk` 插件的功能前瞻与使用步骤,结合 Apache APISIX 提供的多种身份认证插件来实现认证与授权等功能。
+
+<!--truncate-->
+
+本文将介绍 Apache APISIX 中新增插件——`openwhisk`,并通过详细步骤向大家展示如何将 OpenWhisk 服务与 Apache 
APISIX 进行集成,来享受无服务器计算的优势。此插件预计在 Apache APISIX 2.12 版本中正式上线,敬请期待!
+
+![APISIX&OpenWhisk](https://static.apiseven.com/202108/1640313816872-b2c018be-5433-4baf-ba6a-8330e160866a.png)
+
+## 项目介绍
+
+### Apache APISIX
+
+[Apache APISIX](https://apisix.apache.org/) 是一个动态、实时、高性能的 API 
网关,提供负载均衡、动态上游、灰度发布、服务熔断、身份认证、可观测性等丰富的流量管理功能。Apache APISIX 
不仅支持插件动态变更和热插拔,而且拥有众多实用的插件。
+
+### Apache OpenWhisk
+
+[Apache OpenWhisk](https://openwhisk.apache.org/) 
是一个开源的分布式无服务器平台,可以通过执行函数响应任何规模的时间。它使用 Docker 容器管理基础设施、服务器和规模扩展,助力用户构建出色且高效的应用程序。
+
+在 OpenWhisk 中开发者可以使用多种编程语言来编写函数(称为 Action),这些函数将由 OpenWhisk 负责动态调度并处理来自事件(通过 
trigger)或外部请求(通过 HTTP 请求)的响应。
+
+## 集成原理
+
+Apache APISIX 为便捷集成 Apache OpenWhisk 提供了插件支持,用户可以定义一个包含无服务器插件的路由,并结合 Apache 
APISIX 提供的多种身份认证插件来实现认证与授权功能。
+
+大体操作原理如下:用户可以使用openwhisk插件在路由中定义一个“动态上游”,当路由匹配到请求时,它将中止到原上游的请求,并向 OpenWhisk 的 
API Host 端点发送请求。
+
+> 请求中将包含用户为插件配置的 Namespace、Action、Service Token 以及原始 HTTP 请求体数据,并将从 OpenWhisk 
中获取到的响应内容返回至客户端。
+
+## 如何使用
+
+### 步骤一:搭建 Apache OpenWhisk 测试环境
+
+1. 首先,您需要确保使用 Linux 系统,并且系统中已经安装了 Docker 软件。执行以下命令:
+
+```shell
+docker run --rm -d \
+  -h openwhisk --name openwhisk \
+  -p 3233:3233 -p 3232:3232 \
+  -v /var/run/docker.sock:/var/run/docker.sock \
+  openwhisk/standalone:nightly
+
+docker exec openwhisk waitready
+```
+
+2. 等待命令执行完成后,将输出以下内容:
+
+```
+ok: whisk auth set. Run 'wsk property get --auth' to see the new value.
+ok: whisk API host set to http://openwhisk:3233
+ok: updated action testme
+server initializing...
+server initializing...
+    "ready": true
+ok: deleted action testme
+```
+
+3. 创建以下文件 `test.js` 用作测试函数。
+
+```java
+function main(args) {
+    return {
+        "hello": args.name || "",
+    };
+}
+```
+
+4. 在 OpenWhisk 中注册以上函数。
+
+```shell
+# 为 OpenWhisk CLI 工具设置 API Host 和鉴权信息,您可以从这里 
https://s.apache.org/openwhisk-cli-download 下载它
+wsk property set \
+  --apihost 'http://localhost:3233' \
+  --auth 
'23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP'
+
+# 创建测试函数
+wsk action create test test.js
+```
+
+### 步骤二:创建路由并开启 `openwhisk` 插件
+
+下面我们将创建一个路由,并为其添加 `openwhisk` 插件。执行以下命令:
+
+```shell
+curl http://127.0.0.1:9080/apisix/admin/routes/1 -H 'X-API-KEY: 
edd1c9f034335f136f87ad84b625c8f1' -X PUT -d '
+{
+    "plugins": {
+        "openwhisk": {
+            "api_host": "http://localhost:3233";,
+            "service_token": 
"23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP",
+            "namespace": "guest",
+            "action": "test"
+        }
+    },
+    "uri": "/openwhisk"
+}'
+```
+
+### 步骤三:测试请求
+
+下面我们将使用 cURL 进行测试。
+
+```shell
+# 使用 POST 请求并发送数据
+curl http://127.0.0.1:9080/openwhisk -i -X POST -d '{
+    "name": "world"
+}'
+
+HTTP/1.1 200 OK
+Content-Type: application/json
+Content-Length: 17
+Server: APISIX/2.10.2
+
+{"hello":"world"}
+
+# 使用 GET 请求
+curl http://127.0.0.1:9080/openwhisk -i
+
+HTTP/1.1 200 OK
+Content-Type: application/json
+Content-Length: 12
+Server: APISIX/2.10.2
+
+{"hello":""}
+```
+
+### 步骤四:测试复杂响应
+
+1. 创建并更新 `test.js` 测试函数
+
+```java
+function main(args) {
+    return {
+        "status": "403",
+        "headers": {
+            "test": "header"
+        },
+        "body": "A test body"
+    };
+}
+
+2. 进行测试请求
+
+```shell
+# 使用 GET 请求
+curl http://127.0.0.1:9080/openwhisk -i
+
+HTTP/1.1 403 FORBIDDEN
+Content-Type: application/json
+Content-Length: 12
+test: header
+Server: APISIX/2.10.2
+
+A test body
+```
+
+### 补充:关闭插件
+
+如使用完毕,只需移除路由配置中 OpenWhisk 相关配置并保存,即可关闭路由上的 OpenWhisk 插件。此时您可以开启其他 Serverless 
类插件或添加上游等后续操作。
+
+得益于 Apache APISIX 的动态化优势,开启关闭插件的过程都不需要重启 Apache APISIX,十分方便。
+
+## 总结
+
+本文为大家介绍了关于 `openwhisk` 插件的功能前瞻与使用步骤,更多关于 `openwhisk` 
插件说明和完整配置列表,可以参考[官方文档](https://apisix.apache.org/docs/apisix/next/plugins/openwhisk)。
+
+目前,我们也在开发其他 Serverless 插件以便与更多云服务进行集成。如果您对此类集成项目感兴趣,也欢迎随时在 [GitHub 
Discussions](https://github.com/apache/apisix/discussions) 
中发起讨论,或通过[邮件列表](https://apisix.apache.org/zh/docs/general/subscribe-guide)进行交流。

Reply via email to