From 5362b5990dbef2b76426a456525593ad1e28629b Mon Sep 17 00:00:00 2001 From: Bruno Salzano Date: Wed, 30 Oct 2024 08:41:13 +0100 Subject: [PATCH] chore: reference / advanced (#41) Fixed links ad frontmatter for reference. tbc --- .github/.htaccess | 8 +++++++ .github/workflows/build.yml | 2 ++ content/en/docs/reference/_index.md | 6 ++--- .../en/docs/reference/references/_index.md | 19 +++++---------- .../references/actions-actionloop/_index.md | 23 ++++++++++-------- .../references/actions-new/_index.md | 12 ++++++---- .../references/advanced-cli/_index.md | 8 +++++-- .../references/naming-limits/_index.md | 9 +++---- .../reference/references/rest_api/_index.md | 24 +++++++++++-------- .../reference/references/scheduler/_index.md | 11 +++++---- content/en/docs/reference/runtimes/_index.md | 15 ++++++++---- 11 files changed, 82 insertions(+), 55 deletions(-) create mode 100644 .github/.htaccess diff --git a/.github/.htaccess b/.github/.htaccess new file mode 100644 index 00000000..a1269230 --- /dev/null +++ b/.github/.htaccess @@ -0,0 +1,8 @@ +RewriteEngine on + +# Redirect HTTP to HTTPS +RewriteCond %{HTTPS} !=on +RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R] + +# Redirect 404 errors to Hugo's 404 page +ErrorDocument 404 /404.html diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 511662a9..68c3f270 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -34,6 +34,8 @@ jobs: npm run build:production - name: Copy .asf.yaml to publish directory run: cp .github/.asf.prod.yaml ${{ env.PUBLISH_DIRECTORY }}/.asf.yaml + - name: Copy .htaccess to publish directory + run: cp .github/.htaccess ${{ env.PUBLISH_DIRECTORY }}/.htaccess - name: Deploy to ASF working-directory: ${{ env.PUBLISH_DIRECTORY }} run: | diff --git a/content/en/docs/reference/_index.md b/content/en/docs/reference/_index.md index bd7665f6..da2a9a9b 100644 --- a/content/en/docs/reference/_index.md +++ b/content/en/docs/reference/_index.md @@ -20,15 +20,15 @@ languages](#index-runtimes.adoc). The list is expanding over the time. See below for documentation related to: -- [OpenWhisk Entities](#index-entities.adoc) +- [OpenWhisk Entities](entities) -- [OpenServerless Runtimes](#index-runtimes.adoc) +- [OpenServerless Runtimes](runtimes) - [OpenServerless `ops` Tools](tools) - [OpenServerless `ops` Tasks](tasks) -- [Advanced Reference Documentation](#index-references) +- [Advanced Reference Documentation](references) There is also a [tutorial and a development kit](#actions-actionloop.adoc) to build your own runtime for your diff --git a/content/en/docs/reference/references/_index.md b/content/en/docs/reference/references/_index.md index 912fccee..d7b820a4 100644 --- a/content/en/docs/reference/references/_index.md +++ b/content/en/docs/reference/references/_index.md @@ -1,16 +1,9 @@ --- -title: Advanced +title: Advanced Reference Guide +description: Advanced documentation +#weight: 60 +draft: false --- -# Advanced Reference Guides +In this section, you can find advanced reference documentations here. -You can find advanced reference documentations here: - -- [Naming and Limits](#reference.adoc) - -- [Advanced CLI](#cli.adoc) - -- [Rest API](#rest_api.adoc) - -- [Runtimes under the hood](#actions-new.adoc) - -- [Building your runtime](#actions-actionloop.adoc) +Please follow the links below. diff --git a/content/en/docs/reference/references/actions-actionloop/_index.md b/content/en/docs/reference/references/actions-actionloop/_index.md index 4f4cdc95..c2327879 100644 --- a/content/en/docs/reference/references/actions-actionloop/_index.md +++ b/content/en/docs/reference/references/actions-actionloop/_index.md @@ -1,7 +1,10 @@ --- title: Building your runtime +description: How to implement your runtime from scratch +weight: 60 +draft: false --- -# Developing a new Runtime with the ActionLoop proxy +## Developing a new Runtime with the ActionLoop proxy The [OpenWhisk and OpenServerless runtime specification](#actions-new.adoc) defines the expected behavior of an OpenWhisk and OpenServerless runtime; you @@ -44,13 +47,13 @@ Offline](https://github.com/apache/openwhisk-runtime-go/blob/master/docs/DEPLOY. which describes how to do this for the Go language, but the approach applies to any language supported by ActionLoop. -# Tutorial - How to write a new runtime with the ActionLoop Proxy +## Tutorial - How to write a new runtime with the ActionLoop Proxy This section contains a stepwise tutorial which will take you through the process of developing a new ActionLoop runtime using the Ruby language as the example. -## General development process +### General development process The general procedure for authoring a runtime with the `ActionLoop proxy` requires the following steps: @@ -64,7 +67,7 @@ The general procedure for authoring a runtime with the - writing some mandatory tests for your language. -## ActionLoop Starter Kit +### ActionLoop Starter Kit To facilitate the process, there is an `actionloop-starter-kit` in the [openwhisk-devtools](https://github.com/apache/openwhisk-devtools/tree/master/actionloop-starter-kit) @@ -96,7 +99,7 @@ Finally, you will need to update the `ActionLoopPythonBasicTests.scala` test file which, although written in the Scala language, only serves as a wrapper that you will use to embed your target language tests into. -## Notation +### Notation In each step of this tutorial, we typically show snippets of either terminal transcripts (i.e., commands and results) or “diffs” of changes @@ -111,7 +114,7 @@ When snippets show changes to existing source files, lines without a prefix should be left “as is”, lines with `-` should be removed and lines with `+` should be added. -## Prerequisites +### Prerequisites - Docker engine - please have a valid [docker engine installed](https://docs.docker.com/install/) that supports @@ -131,7 +134,7 @@ lines with `+` should be added. # The result should be a valid response listing running processes -## Setup the development directory +### Setup the development directory So let’s start to create our own `actionloop-demo-ruby-2.6` runtime. First, check out the `devtools` repository to access the starter kit, @@ -165,7 +168,7 @@ At this point, we have built a new image named internally it still is a `Python` language runtime which we will need to change to one supporting `Ruby` as we continue in this tutorial. -## Preparing the Docker environment +### Preparing the Docker environment Our language runtime’s `Dockerfile` has the task of preparing an environment for executing OpenWhisk and OpenServerless Actions. Using the @@ -185,7 +188,7 @@ ActionLoop approach, we use a multistage Docker build to requests from the OpenWhisk and OpenServerless platform and execute Actions by using the language’s tools and libraries from step \#1. -## Repurpose the renamed Python Dockerfile for Ruby builds +### Repurpose the renamed Python Dockerfile for Ruby builds Let’s edit the `ruby2.6/Dockerfile` to use the official Ruby image on Docker Hub as our base image, instead of a Python image, and add our our @@ -220,7 +223,7 @@ Note that: course, you may choose to rewrite the `compile` script in `Ruby` if you wish to as your own exercise. -## Implementing the ActionLoop protocol +### Implementing the ActionLoop protocol This section will take you through how to convert the contents of `launcher.rb` (formerly `launcher.py`) to the target Ruby programming diff --git a/content/en/docs/reference/references/actions-new/_index.md b/content/en/docs/reference/references/actions-new/_index.md index 5adc4ce4..290664ff 100644 --- a/content/en/docs/reference/references/actions-new/_index.md +++ b/content/en/docs/reference/references/actions-new/_index.md @@ -1,7 +1,11 @@ --- title: Runtimes under the hood +description: How to add new languages to your system +weight: 50 +draft: false --- -# Adding Action Language Runtimes + +## Adding Action Language Runtimes OpenWhisk and OpenServerless supports [several languages and runtimes](#index-runtimes.adoc) but there may be other languages or @@ -21,7 +25,7 @@ python) for the initialization of an action. You are advised to use it for your own runtimes and use the material of this document as reference for the behaviour of a runtime. -## Runtime general requirements +### Runtime general requirements The unit of execution for all functions is a [Docker container](https://docs.docker.com) which must implement a specific @@ -45,7 +49,7 @@ container](https://docs.docker.com) which must implement a specific The specifics of the [Action interface](##action-interface) and its functions are shown below. -## The runtimes manifest +### The runtimes manifest Actions when created specify the desired runtime for the function via a property called `kind`. When using the `nuv` CLI, this is specified as @@ -268,7 +272,7 @@ protocol, ensures the activation context is correctly prepared, and that the logs are properly framed. Your runtime should extend this test suite, and of course include additional tests as needed. -## Runtime proxy tests +### Runtime proxy tests The tests verify that the proxy can handle the following scenarios: diff --git a/content/en/docs/reference/references/advanced-cli/_index.md b/content/en/docs/reference/references/advanced-cli/_index.md index f732ca0e..ad7f24d0 100644 --- a/content/en/docs/reference/references/advanced-cli/_index.md +++ b/content/en/docs/reference/references/advanced-cli/_index.md @@ -1,12 +1,16 @@ --- title: Advanced CLI +description: How to use the advanced features of ops command line +weight: 10 +draft: false --- -# OpenServerless CLI + +## OpenServerless Cli OpenServerless offers a powerful command line interface named `ops` which extends and embeds the OpenWhisk `wsk`. -Download instructions are available [here](/installation/download). +Download instructions are available [here](/docs/installation/download/). Let's see some advanced uses of `ops`. diff --git a/content/en/docs/reference/references/naming-limits/_index.md b/content/en/docs/reference/references/naming-limits/_index.md index df477c38..d21209fb 100644 --- a/content/en/docs/reference/references/naming-limits/_index.md +++ b/content/en/docs/reference/references/naming-limits/_index.md @@ -1,7 +1,9 @@ --- -title: Naming And Limits +title: Naming Limits +description: Details of OpenServerless and OpenWhisk system +weight: 30 +draft: false --- -# System details The following sections provide more details about the OpenWhisk and OpenServerless system. @@ -55,8 +57,7 @@ entities and their aliases. -

/whisk.system/cloudant/read

+

/whisk.system/cloudant/read

/whisk.system

cloudant

diff --git a/content/en/docs/reference/references/rest_api/_index.md b/content/en/docs/reference/references/rest_api/_index.md index 12d2bca1..d11ac9e9 100644 --- a/content/en/docs/reference/references/rest_api/_index.md +++ b/content/en/docs/reference/references/rest_api/_index.md @@ -1,7 +1,11 @@ --- title: Rest API +description: Use OpenServerless with your Rest API calls. +weight: 30 +draft: false --- -# Using REST APIs with OpenWhisk and NuvoOpenServerlesslaris + +## Using REST APIs with OpenWhisk and OpenServerless After your OpenWhisk and OpenServerlesss environment is enabled, you can use it with your web apps or mobile apps with REST API calls. @@ -93,7 +97,7 @@ experiments. Use [Web Actions](#webactions.adoc) to expose your actions to the public and not use the OpenWhisk and OpenServerless authorization key for client applications that require CORS. -## Using the CLI verbose mode +### Using the CLI verbose mode The OpenWhisk and OpenServerless CLI is an interface to the OpenWhisk and OpenServerless REST API. You can run the CLI in verbose mode with the flag @@ -137,7 +141,7 @@ Authorization header `Basic XXXYYYY`. Notice that the authorization value is your base64-encoded OpenWhisk and OpenServerless authorization string. The response is of content type `application/json`. -## Actions +### Actions **Note:** In the examples that follow, `$AUTH` and `$APIHOST` represent environment variables set respectively to your OpenWhisk and OpenServerless @@ -203,7 +207,7 @@ You get the following response: "payload": "hello John" } -## Annotations and Web Actions +### Annotations and Web Actions To create an action as a web action, you need to add an [annotation](#annotations.adoc) of `web-export=true` for web actions. @@ -234,7 +238,7 @@ at the end of the URL. Note that this example source code will not work with `.http`, see [web actions](webactions.md) documentation on how to modify. -## Sequences +### Sequences To create an action sequence, you need to create it by providing the names of the actions that compose the sequence in the desired order, so @@ -253,7 +257,7 @@ Create a sequence with the actions `/whisk-system/utils/split` and Take into account when specifying the names of the actions, they have to be full qualified. -## Triggers +### Triggers To create a trigger, the minimum information you need is a name for the trigger. You could also include default parameters that get passed to @@ -277,7 +281,7 @@ following HTTP request. -X POST -H "Content-Type: application/json" \ -d '{"temperature":60}' -## Rules +### Rules To create a rule that associates a trigger with an action, send a HTTP request with a `PUT` method providing the trigger and action in the body @@ -296,7 +300,7 @@ method. -X POST -H "Content-Type: application/json" \ -d '{"status":"inactive","trigger":null,"action":null}' -## Packages +### Packages To create an action in a package you have to create a package first, to create a package with name `iot` send an HTTP request with a `PUT` @@ -315,7 +319,7 @@ deleted. curl -u $AUTH https://$APIHOST/api/v1/namespaces/_/packages/iot?force=true \ -X DELETE -## Activations +### Activations To get the list of the last 3 activations use a HTTP request with a `GET` method, passing the query parameter `limit=3` @@ -328,7 +332,7 @@ a path parameter curl -u $AUTH https://$APIHOST/api/v1/namespaces/_/activations/f81dfddd7156401a8a6497f2724fec7b -## Limits +### Limits To get the limits set for a namespace (i.e. invocationsPerMinute, concurrentInvocations, firesPerMinute, actionMemoryMax, actionLogsMax…) diff --git a/content/en/docs/reference/references/scheduler/_index.md b/content/en/docs/reference/references/scheduler/_index.md index 94ce1b4a..902d274a 100644 --- a/content/en/docs/reference/references/scheduler/_index.md +++ b/content/en/docs/reference/references/scheduler/_index.md @@ -1,9 +1,12 @@ --- title: Scheduler +description: Use the scheduler to invoke repetitive or one-shot actions +weight: 40 +draft: false --- OpenServerless Operator offers the possibility to deploy a simple "scheduler" to invoke repetitive or one-shot OpenWhisk actions. For example, an action executing a SQL script to create a PostgreSQL Database or inserting reference data, or simply an action that sends notifications with an API call every day at the same time. -# How to Activate the Scheduler +## How to Activate the Scheduler Using the `ops` CLI, you can enable the scheduler with the following command: @@ -20,7 +23,7 @@ ops update apply By default, the internal scheduler executes a job every minute that starts searching for OpenWhisk actions with special annotations. -# How to Deploy a Repetitive Action +## How to Deploy a Repetitive Action Let's assume we want to deploy an OpenWhisk action to be executed every 30 minutes. Suppose it's an action that simply prints something, like this: @@ -40,7 +43,7 @@ To deploy the action and instruct OpenServerless to execute it every 30 minutes, So you can create the action in the usual way and at the end add -a cron yourCronExpression. -# How to Deploy a One-Shot Execution Action +## How to Deploy a One-Shot Execution Action Now suppose we want to execute the same action `scheduled-action.py` only once. @@ -57,7 +60,7 @@ Activation: 'scheduled' (ebd532139a464e9d9532139a46ae9d8a) ] ``` -# Remarks +## Remarks The Scheduler executes the action according to the following rules: diff --git a/content/en/docs/reference/runtimes/_index.md b/content/en/docs/reference/runtimes/_index.md index 1714da81..eebcf819 100644 --- a/content/en/docs/reference/runtimes/_index.md +++ b/content/en/docs/reference/runtimes/_index.md @@ -1,16 +1,21 @@ --- title: Runtimes +description: List of OpenServerless' supported runtimes +#weight: 60 +draft: false --- + +## Supported Runtimes This document is still 🚧 **work in progress** 🚧 The programming languages currently directly supported by OpenServerless are: -- [🚧 Node](#actions-nodejs.adoc) +- [🚧 Node](actions-nodejs) -- [🚧 Python](#actions-python.adoc) +- [🚧 Python](actions-python) -- [🚧 Go](#actions-go.adoc) +- [🚧 Go](actions-go) -- [🚧 Java](#actions-java.adoc) +- [🚧 Java](actions-java) -- [🚧 PHP](#actions-php.adoc) +- [🚧 PHP](actions-php)