Skip to content

Repository to test the deployment of a typescript serverless service to an OpenWhisk cluster

Notifications You must be signed in to change notification settings

Dalfons0/OpenWhiskTypescript

Repository files navigation

Serverless OpenWhisk Typescript Template

Hello! 😎

This is a template Node.js service for the OpenWhisk platform. Before you can deploy your service, please follow the instructions below…

Setting up a local cluster

Downloading and setting up minikube

First of all, download and install minikube following the instructions of the oficial repository depending on your OS, and install the proper requirements, personally I'm using minikube and kubernetes 1.9.0 on Windows 10 with Hyper-V, using the recommended number of cpus and memory by the OpenWhisk team:

λ  minikube start --vm-driver=hyperv --hyperv-virtual-switch="Primary Virtual Switch" --cpus 2 --memory 4096

Note: Before executing the upper command you have to configure a virtual switch in the Hyper-V manager, in order to grant minikube access to internet.

Important: If you are using minikube in windows with the hyper-v drive, you have to use minikube through an admin powershell, because this is necessary to interact with the hyper-v machine.

Curiosity: You can connect to the minikube VM with the user 'docker' and the password 'tcuser'.

Deploying OpenWhisk

Once you have the minikube running in your local machine you only have to clone this repository and follow the instructions in order to deploy OpenWhisk on it, but if you are working on windows you have to keep in mind some considerations:

  • The repository specified principally make use of unix commands, so be careful if you aren't executing these commands in a bash console (see).
  • In windows the end of line (EOL) differs from Unix-like systems (CRLF vs LF), so it's worth to check the EOL configuration of the both auth files in this step, these files have to be in LF, bacause, in the contrary, some steps after will fail because the carriage return (/r), will be taken as part of the authetification string.

Setup the provider plugin

Using the framework with the OpenWhisk platform needs you to install the provider plugin and link this to your service.

Install the provider plugin

$ npm install --global serverless-openwhisk

Due to an outstanding issue with provider plugins, the OpenWhisk provider must be installed as a global module.

Link provider plugin to service directory

Using npm link will import the provider plugin into the service directory. Running npm install will automatically perform this using a post install script.

$ npm link serverless-openwhisk
or
$ npm install

…and that's it!

Issues encountered

  • The serverless-openwhisk plugin doesn't integrate properly with other plugings, that prevented to integrate webpack with his plugin, but added a script (yarn deploy) and the path to the out compiled sources in the serverless.yml as a workaround.

  • The serverless-openwhisk plugin doesn't deploy the apigateway, despite of working properly with the OpenWhisk CLI.

  • Deploy or create a scheduled trigger (alarm) returning an unauthorized error (403), the other services of the catalog haven't been tested.

  • There is a script that set up OpenWhisk automatically in minikube, but didn't work for me, some parts didn't deploy properly, so it's worth to take a look and try to have this working.

About

Repository to test the deployment of a typescript serverless service to an OpenWhisk cluster

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published