-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
166 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ | |
"resource": [ | ||
{ | ||
"files": [ | ||
"images/**", | ||
"documentation/**.png", | ||
"charts/**" | ||
] | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Create a function | ||
|
||
Install FaasNet template. This utility can be used to generate Function project in C#. | ||
|
||
``` | ||
dotnet new --install FaasNet.Templates | ||
``` | ||
|
||
Create a Function project | ||
|
||
``` | ||
mkdir QuickStart | ||
cd QuickStart | ||
mkdir src | ||
cd src | ||
dotnet new faasnetfn -n Function | ||
``` | ||
|
||
The following files will be created : | ||
|
||
* *Startup.cs* and *Program.cs*: the application entry point. | ||
* *HelloWorldConfiguration.cs*: configuration properties of the function. | ||
* *FunctionHandler.cs*: contains the business logic. This class has one function which accepts one parameter and returns a JSON result. The input parameter has two distinct properties : | ||
|
||
* Configuration: its value is coming from the gateway, it will be used to configure the behavior of the function for example : `ConnectionString` and `SQL Statement`. | ||
* Input: value passed by caller. | ||
|
||
In case the Visual Studio Support is needed, a solution can be created : | ||
|
||
``` | ||
cd .. | ||
dotnet new sln -n QuickStart | ||
``` | ||
|
||
Add the Function project into the solution. | ||
|
||
``` | ||
dotnet sln add ./src/Function/Function.csproj | ||
``` | ||
|
||
# Deploy a function | ||
|
||
> [!WARNING] | ||
> Before you start, Make sure your working environment is properly configured. | ||
When the Function project is ready, it can be deployed to the Gateway API. | ||
|
||
First of all, open a command prompt and execute the following command line to create a Docker file. The `DIRECTORY` variable must be replaced by the directory of the Function.csproj project. | ||
|
||
``` | ||
FaasNet.CLI function -df <DIRECTORY> | ||
``` | ||
|
||
Execute the following instruction to locally build the Docker image. | ||
The `DIRECTORY` variable must be replaced by the directory of the Function.csproj project, and the `IMAGENAME` variable must be replaced by the name of the Docker image for example : localhost:5000/function. | ||
|
||
``` | ||
FaasNet.CLI function -db <DIRECTORY> -t <IMAGENAME> | ||
``` | ||
|
||
Execute the following command line to push the local Docker image into a registry. The `IMAGENAME` variable must be replaced by the name of the Docker Image. | ||
|
||
``` | ||
FaasNet.CLI function -dp <IMAGENAME> | ||
``` | ||
|
||
Finally, execute the latest command line to deploy the function into the Gateway API. Replace the `FUNCTIONNAME` variable by the name of your function and replace the `IMAGENAME` variable by the name of your Docker image. | ||
|
||
``` | ||
FaasNet.CLI function deploy -name <FUNCTIONAME> -image <IMAGENAME> | ||
``` | ||
|
||
# Execute a function | ||
|
||
> [!WARNING] | ||
> Before you start, Make sure you have a function deployed in the Gateway API. | ||
Execute the following command to invoke a function. Replace the `FUNCTIONNAME` variable by the name of your function. | ||
|
||
``` | ||
FaasNet.CLI function invoke <FUNCTIONNAME> -input {} -configuration {'firstName':'coucou'} | ||
``` | ||
|
||
The following message is displayed | ||
|
||
``` | ||
{ | ||
"content": { | ||
"message": "Hello 'coucou'" | ||
} | ||
} | ||
``` |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
# Manage Functions | ||
|
||
> [!WARNING] | ||
> Make sure your working environment is [properly configured](/documentation/gettingstarted/index.html). | ||
A Portal is available at the following [address](http://localhost:30003). It can be used by developers to manage functions. | ||
The following chapters describe how functions can easily be managed. | ||
|
||
# Publish a function | ||
|
||
> [!WARNING] | ||
> Before publishing a function, it should be available in an online store for example DockerHub. For more information please refer to this [chapter](/documentation/functions/create.html#deploy-a-function). | ||
In the website, click on the `Add a function` button and fill in the form with the following information and click on `Create`. | ||
|
||
* **Name** : This parameter is used to uniquely identify a function for example `test`. | ||
* **Image**: Name of the Docker image for example : `simpleidserver/faastransform:0.0.3`. | ||
|
||
 | ||
|
||
The function will be published and displayed in the table. | ||
|
||
 | ||
|
||
# Unpublish a function | ||
|
||
Navigate to the function and click on the `Delete` button present in the `Information` tab. | ||
|
||
The function will be unpublished and removed from the table. | ||
|
||
 | ||
|
||
# Invoke a function | ||
|
||
Navigate to the function and click on the `Invoke` tab. | ||
|
||
There are two types of parameter : | ||
|
||
* **Configuration parameters** : The content is similar to what can be found in configuration files (web.conf or app.conf) for example : mapping rules between Input and Output fields or ConnectionString. | ||
* **Input parameters** : Input parameters directly passed to the function. | ||
|
||
If `faastransform` is published, it can be invoked like this : | ||
|
||
* **Output parameters** : Add a new parameter and set the first field value to `firstname`, and specify `FIRSTNAME` in the second field. | ||
* **Input parameter** : Specify the following JSON content. | ||
|
||
``` | ||
{ "firstname" : "sid" } | ||
``` | ||
|
||
Finally click on the `Launch` button. The JSON object above will be transformed into a new object which looks like to something like this : | ||
|
||
``` | ||
{ "FIRSTNAME": "sid" } | ||
``` | ||
|
||
 | ||
|
||
|
||
# Monitor a function | ||
|
||
Navigate to the function and click on the `Monitoring` tab. | ||
|
||
There are several panels displayed in the UI. Each of them enable developers to follow the performance of the published function for examples : CPU Usage, Memory Usage or Number of request. | ||
|
||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ | |
- name: Portal | ||
items: | ||
- name: Manage functions | ||
href: functions/manage.md | ||
href: portal/manage.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,4 @@ spec: | |
- port: 1433 | ||
protocol: TCP | ||
targetPort: 1433 | ||
nodePort: 30002 | ||
nodePort: 30010 |