标签: faas

生产就绪的Google Cloud功能是什么样的?

我刚开始使用Google Cloud Functions完成整个无服务器的事情,所有的例子基本上都是"Helloworld".

package function

import (
    "net/http"
)

func F(w http.ResponseWriter, r *http.Request) {
    w.Write([]byte("Hello, World!\n"))
}
Run Code Online (Sandbox Code Playgroud)

生产就绪功能是什么样的?

go google-cloud-platform google-cloud-functions faas serverless

10
推荐指数
1
解决办法
880
查看次数

Azure Function App =在本地运行单个Azure Function进行调试

在Visual Studio中,我创建了具有多个功能的Azure功能应用程序。

当我从工具栏启动Function App调试器时,将触发所有功能。

有没有一种方法可以在Visual Studio 2017中从应用程序触发单个功能?

azure visual-studio azure-functions faas

5
推荐指数
3
解决办法
1390
查看次数

从 Azure PowerShell 函数提供 HTML 页面

我尝试从 Azure PowerShell函数提供 HTML 页面。我能够返回 HTML,但我知道在哪里可以将内容类型设置为 text/htm l 以便浏览器解释 HTML。

以下是Anythony Chu 提供的示例,说明如何使用 C# 实现此目的:

public static HttpResponseMessage Run(HttpRequestMessage req, TraceWriter log)
{
    var response = new HttpResponseMessage(HttpStatusCode.OK);
    var stream = new FileStream(@"d:\home\site\wwwroot\ShoppingList\index.html", FileMode.Open);
    response.Content = new StreamContent(stream);
    response.Content.Headers.ContentType = new MediaTypeHeaderValue("text/html");
    return response;
}
Run Code Online (Sandbox Code Playgroud)

但在 PowerShell 函数中,我只是使用 cmdlet 返回文件Out-File,并且没有设置内容类型的选项。这是一个你好世界的例子:

# POST method: $req
$requestBody = Get-Content $req -Raw | ConvertFrom-Json
$name = $requestBody.name

# GET method: each querystring parameter is its own variable …
Run Code Online (Sandbox Code Playgroud)

powershell azure azure-functions faas serverless

2
推荐指数
1
解决办法
564
查看次数

Faasd - 无法从私人注册表中提取映像

我有一个使用 OpenFaaS 的应用程序。

特别是,我使用faasd,因为该函数将在处理能力较差的设备上运行。我有一个私人注册表,上面有一个“X”函数的图像。我想从 faasd 中提取此映像来部署并执行它,但我遇到了一个问题:当我尝试执行该操作时,我似乎没有经过身份验证,但我正确地传递了registryAuth令牌。

这里有一个我正在做的示例(遵循此https://ericstoekl.github.io/faas/operations/managing-images/#deploy-functions-with-private-registries-credentials

邮政

<ip_address>:8080/system/functions
Run Code Online (Sandbox Code Playgroud)

标题:

{
"Authorization": "mytoken"
}
Run Code Online (Sandbox Code Playgroud)

身体:

{
    "service": "functionName",
    "image": "<registry_ip_address>/functions/functionName:<version>",
    "envProcess": "/.../myprocess",
    "registryAuth": <base64 token obtained from 'user:password'>,
    "secrets": [
        "mysecret"
    ]
}
Run Code Online (Sandbox Code Playgroud)

我确认参数全部正确,但收到此错误:

“无法拉取映像 <registry_ip_address>/functions/functionName:: 无法拉取:无法解析引用“<registry_ip_address>/functions/functionName:”:没有为令牌身份验证质询指定范围”

注册表运行良好,因为如果我尝试使用 docker 以经典方式下载映像,我就能够拉取映像。

先感谢您!

docker faas serverless containerd openfaas

1
推荐指数
1
解决办法
1309
查看次数