Skip to content

Commit

Permalink
chore: reference / advanced (#41)
Browse files Browse the repository at this point in the history
Fixed links ad frontmatter for reference. tbc
  • Loading branch information
d4rkstar authored Oct 30, 2024
1 parent 882bfbc commit 5362b59
Show file tree
Hide file tree
Showing 11 changed files with 82 additions and 55 deletions.
8 changes: 8 additions & 0 deletions .github/.htaccess
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
6 changes: 3 additions & 3 deletions content/en/docs/reference/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 6 additions & 13 deletions content/en/docs/reference/references/_index.md
Original file line number Diff line number Diff line change
@@ -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.
23 changes: 13 additions & 10 deletions content/en/docs/reference/references/actions-actionloop/_index.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 8 additions & 4 deletions content/en/docs/reference/references/actions-new/_index.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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:

Expand Down
8 changes: 6 additions & 2 deletions content/en/docs/reference/references/advanced-cli/_index.md
Original file line number Diff line number Diff line change
@@ -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`.

Expand Down
9 changes: 5 additions & 4 deletions content/en/docs/reference/references/naming-limits/_index.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -55,8 +57,7 @@ entities and their aliases.
</thead>
<tbody>
<tr class="odd">
<td
style="text-align: left;"><p><code>/whisk.system/cloudant/read</code></p></td>
<td style="text-align: left;"><p><code>/whisk.system/cloudant/read</code></p></td>
<td style="text-align: left;"></td>
<td style="text-align: left;"><p><code>/whisk.system</code></p></td>
<td style="text-align: left;"><p><code>cloudant</code></p></td>
Expand Down
24 changes: 14 additions & 10 deletions content/en/docs/reference/references/rest_api/_index.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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`
Expand All @@ -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`
Expand All @@ -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…)
Expand Down
11 changes: 7 additions & 4 deletions content/en/docs/reference/references/scheduler/_index.md
Original file line number Diff line number Diff line change
@@ -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:

Expand All @@ -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:

Expand All @@ -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.

Expand All @@ -57,7 +60,7 @@ Activation: 'scheduled' (ebd532139a464e9d9532139a46ae9d8a)
]
```

# Remarks
## Remarks

The Scheduler executes the action according to the following rules:

Expand Down
15 changes: 10 additions & 5 deletions content/en/docs/reference/runtimes/_index.md
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 5362b59

Please sign in to comment.