Giter Club home page Giter Club logo

apache / openwhisk-runtime-nodejs Goto Github PK

View Code? Open in Web Editor NEW
59.0 32.0 73.0 17.11 MB

Apache OpenWhisk Runtime NodeJS supports Apache OpenWhisk functions written in JavaScript for NodeJS

Home Page: https://openwhisk.apache.org/

License: Apache License 2.0

JavaScript 53.56% Scala 39.51% Shell 0.97% Dockerfile 5.95%
openwhisk apache serverless faas functions-as-a-service cloud serverless-architectures serverless-functions docker functions

openwhisk-runtime-nodejs's Introduction

Apache OpenWhisk runtimes for Node.js

License Continuous Integration

This repository contains sources files needed to build the Node.js runtimes for Apache OpenWhisk. The build system will produce a series of docker images for each runtime version. These images are used in the platform to execute Node.js actions.

The following Node.js runtime versions (with kind & image labels) are generated by the build system:

  • Node.js 18 (nodejs:18 & openwhisk/action-nodejs-v18)
  • Node.js 20 (nodejs:20 & openwhisk/action-nodejs-v20)

This README documents the build, customisation and testing of these runtime images.

Do you want to learn more about using Node.js actions to build serverless applications? Please see the main project documentation here for that information.

Usage

If the deployment of Apache OpenWhisk includes these images in the runtime manifest, use the --kind parameter to select the Node.js runtime version.

Node.js v20

wsk action update myAction myAction.js --kind nodejs:20

Images

All the runtime images are published by the project to Docker Hub @ https://hub.docker.com/u/openwhisk

These images can be used to execute Node.js actions on any deployment of Apache OpenWhisk, even those without those images defined the in runtime manifest, using the --docker action parameter.

wsk action update myAction myAction.js --docker openwhisk/action-nodejs-v20

If you build a custom version of the images, pushing those an external Docker Hub repository will allow you to use those on the Apache OpenWhisk deployment.

Runtimes Manifest

Available runtimes in Apache OpenWhisk are defined using the runtimes manifest in this file: runtimes.json

Modify the manifest and re-deploy the platform to pick up local images changes.

Development

Dockerfiles for runtime images are defined in the core directory. Each runtime version folder has a custom Dockerfile and package.json. If you need to add extra dependencies to a runtime version - modify these files.

The core/nodejsActionBase folder contains the Node.js app server used to implement the action interface, used by the platform to inject action code into the runtime and fire invocation requests. This common code is used in all runtime versions.

Build

  • Run the distDocker command to generate local Docker images for the different runtime versions.
./gradlew core:nodejs18Action:distDocker
./gradlew core:nodejs20Action:distDocker

This will return the following runtime images with the following names: action-nodejs-v18, and action-nodejs-v20.

Testing

  • Install project dependencies from the top-level Apache OpenWhisk project, which ensures correct versions of dependent libraries are available in the Maven cache.
./gradlew install

This command MUST BE run from the directory containing the main Apache OpenWhisk repository, not this repository's directory.

  • Build the local Docker images for the runtime versions (see the instructions above).
  • Build the custom Docker images used in local testing.
./gradlew tests:dat:docker:nodejs18docker:distDocker
./gradlew tests:dat:docker:nodejs20docker:distDocker
  • Run the project tests.
./gradlew :tests:test

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.