Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Create a serverless, event-driven application with Apache OpenWhisk on IBM Cloud Functions that executes code in response to ...

License

Notifications You must be signed in to change notification settings

IBM/ibm-cloud-functions-refarch-template

Repository files navigation

Serverless reference architecture with IBM Cloud Functions (powered by Apache OpenWhisk)

Build Status

This reference architecture shows how serverless, event-driven architectures can execute code that scales automatically in response to demand from [...]. No code runs until [...] When that happens, application instances are started to match the load needed by each [...] exactly.

In addition to using cloud resources efficiently, this means that developers can build and deploy applications more quickly. You can learn more about the benefits of building a serverless architecture for this use case in the accompanying IBM Code Pattern.

This repository provides a template skeleton for IBM Cloud Functions reference architectures. You can deploy it right away using the IBM Cloud Functions user interface, or setup and deploy using command line tools on your own system.

If you haven't already, sign up for an IBM Cloud account and go to the Cloud Functions dashboard to explore other reference architecture templates and download command line tools, if needed.

Included components

  • IBM Cloud Functions (powered by Apache OpenWhisk)
  • Service A (Powered by open source project A)
  • Service B (Powered by open source project B)

The application demonstrates two IBM Cloud Functions (based on Apache OpenWhisk) that [...]. The use case demonstrates how actions work with data services and execute logic in response to [...] events.

One function, or action, is triggered by [...]. These [...] are piped to another action in a sequence (a way to link actions declaratively in a chain). The second action aggregates the [...] and [...].

Sample Architecture

Prerequisite

You should have a basic understanding of the OpenWhisk programming model. If not, try the action, trigger, and rule demo first.

Also, you'll need XXX

Steps

  1. Install X
  2. Configure X
  3. Verify X
  4. Run Y
  5. etc.

Deploy through the IBM Cloud Functions console user interface

Choose "Start Creating" and select "Deploy template" then [This template] from the list. A wizard will then take you through configuration and connection to event sources step-by-step.

Behind the scenes, the UI uses wskdeploy, which you can also use directly from the CLI by following the steps in the next section.

Deploy using the wskdeploy command line tool

This approach deploy the Cloud Functions with one command driven by the runtime-specific manifest file available in this repository.

  • Download the latest bx CLI and Cloud Functions plugins and log into the IBM Cloud.
  • Download the latest wskdeploy from the release page of the openwhisk-wskdeploy project.
  • Provision a Service instance.
  • Copy template.local.env to a new file named local.env and update the SERVICE_HOSTNAME, SERVICE_USERNAME, SERVICE_PASSWORD and SERVICE_DATABASE for your Service instance.

Deployment

# Get a local copy of this repository
git clone https://github.com/IBM/ibm-cloud-functions-refarch-template.git
cd ibm-cloud-functions-refarch-template

# Make service credentials available to your environment
source local.env
wsk package refresh

# Deploy the packages, actions, triggers, and rules using your preferred language
cd runtimes/nodejs # Or runtimes/[php|python|swift]
wskdeploy

Undeploy

# Deploy the packages, actions, triggers, and rules
wskdeploy undeploy

Alternative deployment methods

Deploy manually with the bx wsk command line tool

This approach shows you how to deploy individual the packages, actions, triggers, and rules with CLI commands. It helps you understand and control the underlying deployment artifacts.

Deploy with IBM Continuous Delivery

This approach sets up a continuous delivery pipeline that redeploys on changes to a personal clone of this repository. It may be of interest to setting up an overall software delivery lifecycle around Cloud Functions.

License

Apache 2.0