crystal_openwhisk_function

Version, currently 0.1.01 version
  • 0.1.0latestDec 4, 2018

github.com/TPei/crystal_openwhisk

crystal docker template for openwhisk

3 stars
0 dependents
License: Apache-2.0

Installation

# Add this to your shard.yml
dependencies:
  crystal_openwhisk_function:
    github: TPei/crystal_openwhisk
    version: ~> 0.1.0

Then run:

shards install

shard.yml

This shard.yml declares only a name and a version: no Crystal constraint, no dependencies, no targets and no executables. It is a plain library with nothing to build.

Dependencies

This version declares no dependencies.

README

crystal_openwhisk

crystal docker template for openwhisk

How do I use this?

  1. Download and install the OpenWhisk CLI
  2. add code to main.cr
  3. add dependencies to shard.yml
  4. build and push your image
  5. Test out action with CL

The script buildAndPush.sh is provided for your convenience. The following command sequence runs the included example Docker action container using OpenWhisk.

# build/push, argument is your docker hub user name and a valid docker image name
./buildAndPush <dockerhub username>/docker-crystal

# create docker action
wsk action create dockerCrystal --docker <dockerhub username>/docker-crystal

# invoke created action
wsk action invoke dockerCrystal --blocking

Anything else?

Make sure that you return a dict-compatible json object, so just { key: value, key: value } stuff

Using wskdeploy

Create a manifest.yml

packages:
  some_package:
    actions:
      dockerCrystal:
        docker: username/docker_crystal

Then run wskdeploy