Git Product home page Git Product logo

runtime-nodejs's Introduction

#IBM Functions runtimes for nodejs Build Status

Work in progress**

This repository is work in progress, braking changes might occur

The runtime provides nodejs v8 with a set of npm packages The images provides the following npm packages for IBM Services/Products

Give it a try today

To use as a docker action

bx wsk action update myAction myAction.js --docker ibmfunctions/action-nodejs-ibm-v8

This works on any deployment of Apache OpenWhisk

Future: IBM Functions (Apache OpenWhisk on IBM Cloud)

To use as a special nodejs kind action

bx wsk action update myAction myAction --kind nodejs-ibm:8

Local development

Prerequisite: Export OPENWHISK_HOME to point to your incubator/openwhisk cloned directory.

./gradlew nodejs8:distDocker

This will produce the image whisk/action-nodejs-ibm-v8

Build and Push image

docker login
./gradlew nodejs8:distDocker -PdockerImagePrefix=$prefix-user -PdockerRegistry=docker.io

Deploy OpenWhisk using ansible environment that adds the new king nodejs-ibm:8 Assuming you have OpenWhisk already deploy localy and OPENWHISK_HOME pointing to root directory of OpenWhisk core repository.

Set ROOTDIR to the root directory of this repository.

Redeploy OpenWhisk

cd $OPENWHISK_HOME/ansible
ANSIBLE_CMD="ansible-playbook -i ${ROOTDIR}/ansible/environments/local"
$ANSIBLE_CMD setup.yml
$ANSIBLE_CMD couchdb.yml
$ANSIBLE_CMD initdb.yml
$ANSIBLE_CMD wipe.yml
$ANSIBLE_CMD openwhisk.yml

To use as docker action push to your own dockerhub account

docker tag whisk/action-nodejs-ibm-v8 $user_prefix/action-nodejs-ibm-v8
docker push $user_prefix/action-nodejs-ibm-v8

Then create the action using your the image from dockerhub

wsk action update myAction myAction.js --docker $user_prefix/action-nodejs-ibm-v8

The $user_prefix is usually your dockerhub user id.

Testing

To run all tests: ./gradlew tests:test this include tests depending on credentials

To run all tests except those which do not rely on credentials ./gradlew tests:testWithoutCredentials

To run a single test-class: ./gradlew tests:test --tests <SomeGradleTestFilter>

For example, in order to execute the tests in /tests/src/test/scala/actionContainers/IBMNodeJSActionDB2Tests.scala, run: ./gradlew tests:test --tests *IBMNodeJsActionDB2Tests

Note: If you're running all tests locally with credentials like ./gradlew tests:test or ./gradlew tests:test --tests *CredentialsIBMNodeJsActionWatsonTests you need to set up a tests/credentials.json file containing Watson credentials in the format of:

{  
  "language_translation":[  
    {
      "credentials": {  
        "url": "",  
        "password": "",  
        "username": ""  
      }  
    }  
  ],  
  "cloudantNoSQLDB":[
    {
      "name":"",  
      "label":"",  
      "plan":"",  
      "credentials": {  
        "url": "",  
        "host": "",  
        "port": "" ,  
        "password": "",  
        "username": ""  
      }  
    }
  ]
}  

Then update the whisk.properties file located in the directory $OPENWHISK_HOME, using the variable vcap.services.file

License

Apache 2.0

runtime-nodejs's People

Contributors

aml2732 avatar csantanapr avatar

Watchers

 avatar

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.