openwhisk-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Carlos Santana <csantan...@gmail.com>
Subject Re: OpenWhisk NodeJS 8 support
Date Tue, 21 Nov 2017 13:34:33 GMT
Hi James

The good thing about open source you can configure it at your hearts
content today.

I'm guessing you referring to when creating action via CLI and using .js
single source file it will default to kind nodejs:default
Then backend will pick nodejs:6 or nodejs:8

It depends how your deploying (kube, compose, etc..) for the main repo
using ansible you can change the runtimeManifest config [1], or create a
new ansible environment [2] with the runtimeManifest you want even a
partial runtimes.

set default to false for nodejs:6 and to true for nodejs:8

I was down that route to set it as default in ansible but I hit something
that nodejs:6 is hardcoded as the prewarm container in Invoker, I have a PR
[3] that is under discussion on how to surface the prewarm config via
ansiible in a way that is extensible for future variations including
memory.

Minimum would like to fix this before starting  to look at defaults, and
also some period to get some feedback/findings from nodejs:8 users before
doing the flip.

I know is not relevant, but for the IBM Cloud Functions there are some
minor CICD config changes we need to flow before we can set it as default.

But this should not stop anyone from using nodejs:8 if they want to use it.

[1]
https://github.com/apache/incubator-openwhisk/blob/master/ansible/group_vars/all#L50
[2]
https://github.com/apache/incubator-openwhisk-runtime-nodejs/blob/master/ansible/environments/local/group_vars/all#L37
[3]https://github.com/apache/incubator-openwhisk/pull/2959




On Tue, Nov 21, 2017 at 5:35 AM James Thomas <jthomas.uk@gmail.com> wrote:

> This is awesome! Great work everyone.
>
> Is there a *rough* timeline for when this version will be the default
> Node.js runtime?
>
> On 20 November 2017 at 20:06, Carlos Santana <csantana23@gmail.com> wrote:
> > Dear OpenWhiskers
> >
> > We merged the PR [1] to add the nodejs 8 runtime in the default
> deployment
> > configuration.
> >
> > This allows you now to specify the kind nodejs:8 [2]
> >
> > Node.js 6 already has good support for ES2015, Node.js 8 added a few more
> > like async/await part of the ES2017 spec. You can now use async in the
> main
> > function of the Action, I guess any function :-)
> >
> > This add a 3rd programing style in addition of callbacks and promises
> like
> > this:
> >
> > const { promisify } = require('util');
> > const request = promisify(require('request'));
> >
> > async function main({
> >   location='San Juan',
> >   url=`https://query.yahooapis.com/v1/public/yql?q=select item.condition
> > from weather.forecast where woeid in (select woeid from geo.places(1)
> where
> > text="'${location}'")&format=json`
> > }){
> >   let response
> >   try {
> >     response = await request(url)
> >   } catch (err) {
> >     console.error('Http error', err)
> >     return Promise.reject({Error:err});
> >   }
> >   return JSON.parse(response.body).query.results.channel.item.condition;
> > }
> >
> >
> > For now, the default the nodejs kind is set to nodejs:6, the same for
> > pre-warm containers on initialization of invoker.
> >
> > The nodejs 8 runtime only includes pre-installed the openwhisk sdk
> >
> > I added a webpack section [3] to the docs to illustrate how to add npm
> > dependencies to their actions, in addition of using a zip archive.
> >
> > Also want to note that the breakdown of the runtimes into separate repos
> > was a building block for my team to deliver in the downstream IBM Cloud
> > Functions nodejs 8 support, the runtime in IBM includes some
> pre-installed
> > latest npm packages for IBM services such as db2, s3 Object Storage,
> > Watson, Cloudant and others similar set as node:js6 [4]
> >
> > Here is a good post from the Node.js team back when they introduced
> version
> > 8 as current [5]
> >
> > [1] https://github.com/apache/incubator-openwhisk/pull/2958
> > [2]
> >
> https://github.com/apache/incubator-openwhisk/blob/master/docs/reference.md#nodejs-version-8-environment
> > [3]
> >
> https://github.com/apache/incubator-openwhisk/blob/master/docs/actions.md#package-an-action-as-a-single-bundle
> > [4]
> >
> https://console.bluemix.net/docs/openwhisk/openwhisk_reference.html##openwhisk_ref_javascript_environments_8
> > [5] https://nodejs.org/en/blog/release/v8.0.0/
> >
> >
> > Carlos
> >
> > On Tue, Nov 7, 2017 at 11:27 AM Carlos Santana <csantana23@gmail.com>
> wrote:
> >
> >> Hi
> >>   I started looking into nodejs 8 support
> >>
> >> Something cool about nodejs8 it allows native support for async and
> wait,
> >> and the new promisify
> >> here is some good read on this:
> >> http://2ality.com/2017/05/util-promisify.html
> >>
> >> I have a WIP PR with the support here
> >> https://github.com/apache/incubator-openwhisk-runtime-nodejs/pull/5
> >>
> >> There are few things I want to see if we can improve and take the chance
> >> to it since this will be a new kind. I added a list in the PR
> >>
> >> I have no issue opened because the repo is not enable with Issues,
> that's
> >> why I put the details in the PR
> >>
> >> -- Carlos
> >>
> >>
>
>
>
> --
> Regards,
> James Thomas
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message