You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bd...@apache.org on 2019/07/26 12:15:30 UTC
[sling-whiteboard] branch master updated: README
This is an automated email from the ASF dual-hosted git repository.
bdelacretaz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-whiteboard.git
The following commit(s) were added to refs/heads/master by this push:
new 3f3a893 README
3f3a893 is described below
commit 3f3a893cc78b78ed9af27c76e0a9fc7e7cc32d24
Author: Bertrand Delacretaz <bd...@apache.org>
AuthorDate: Fri Jul 26 14:15:20 2019 +0200
README
---
serverless-microsling/README.md | 54 +++++++++++++++++++++++++++++++++++------
1 file changed, 46 insertions(+), 8 deletions(-)
diff --git a/serverless-microsling/README.md b/serverless-microsling/README.md
index 77cc2fb..0c75b79 100644
--- a/serverless-microsling/README.md
+++ b/serverless-microsling/README.md
@@ -7,25 +7,63 @@ Its name comes from the [historical microsling project](https://grep.codeconsult
Status
----
-Work in progress - stay tuned
+At [commit 38794912](https://github.com/apache/sling-whiteboard/commit/387949128e32557aac796da4543346e73288f49c), dynamic selection of renderers
+implemented by independent OpenWhisk functions (in the same namespace) works. See _playing with the dynamic renderers selection_ below for how to experiment with that.
-How to run this on Apache OpenWhisk
+Prerequisite: Apache OpenWhisk
---
-Assuming `wsk` is setup as per the [OpenWhisk docs](openwhisk.apache.org), the
-`install` script installs this code as an OpenWhisk action named `microsling`.
+To run this prototype you'll need the OpenWhisk `wsk` command to be is setup as per
+the [OpenWhisk docs](openwhisk.apache.org).
+
+A simple way to play with OpenWhisk is to use its [standalone runnable jar](https://github.com/apache/incubator-openwhisk/pull/4516). That's not released as I write
+this but you can download a build from [Chetan's repository](https://github.com/chetanmeh/incubator-openwhisk/releases/tag/v0.10), which has been tested with this code.
+
+Running the examples
+---
+Run the `install` script to install this code as an OpenWhisk action named `microsling`, along with a
+few rendering actions that demonstrate dynamic bindings of renderers.
The script outputs the URL at which the action is available:
Microsling is available at at https://openwhisk.example.com/YOURNAME/default/microsling
-To which you need to append the path of the content that you want to read (from `./content` for now) so for example:
+Along with a set of URLs of test documents.
+
+Playing with the dynamic renderers selection
+---
+The non-default renderers are separate OpenWhisk actions selected based on annotations prefixed
+with `sling:`.
+
+These action annotations are set by the `install` script but you can change them later as in these examples:
- https://openwhisk.example.com/YOURNAME/default/microsling/demo/index.json
+ # Vintage! switch to the `htm` extension for the `microsling/somedoc` resource type.
+ # html will be handled by the default renderer
+ wsk action update somedoc-html -a sling:extensions htm \
+ -a sling:resourceType microsling/somedoc \
+ -a sling:contentType text/html
+ # More vintage! Use the `somedoc-html` renderer for all resource types, with the `htm` extension:
+ wsk action update somedoc-html -a sling:extensions htm \
+ -a sling:resourceType '*' \
+ -a sling:contentType text/html
+
+ # Back to normal for this `somedoc-html` rendering action
+ wsk action update somedoc-html rendering-actions/somedoc-html.js \
+ -a sling:resourceType microsling/somedoc \
+ -a sling:contentType text/html -a sling:extensions html
+
+To create new renderers see the examples in the [rendering-actions](.rendering-actions/) folder and how
+they are setup by the [install](./install) script.
+
+Troubleshooting
+---
To see what happened after executing the action you can use:
wsk -i activation get --last
-and
+Or `wsk activation list` to see what was executed and `wsk activation get <ID>` to get the
+data of a specific action activation.
+
+The `wsk activation logs` command outputs just the logs.
- wsk -i activation logs --last
+See the [Apache OpenWhisk documentation](http://openwhisk.apache.org/) for more information.
\ No newline at end of file