Skip to content

Instantly share code, notes, and snippets.

@jldec
Last active September 19, 2018 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jldec/74396eb72a7b670af61006f1b2cd6b2f to your computer and use it in GitHub Desktop.
Save jldec/74396eb72a7b670af61006f1b2cd6b2f to your computer and use it in GitHub Desktop.
cd ~/riff/hello-node
kubectl apply k8s-config/

install latest Knative

riff system install --manifest latest --node-port

prepare default namespace

riff namespace init default --dockerhub jldec

build square

riff function create node square \
  --git-repo https://github.com/jldec/node-fun-square.git \
  --artifact square.js \
  --image $DOCKER_ID/node-fun-square:v1 \
  --verbose

invoke square

riff service invoke square --text -- -w '\n' -d 7

build hello

cd ~/riff/hello
docker build -t dev.local/hello:v1 .
riff service create hello --image dev.local/hello:v1

watch hello log

kail -d hello-00001-deployment -c user-container

invoke hello

riff service invoke hello --text -- -w '\n' -d london

create random

riff service create random --image jldec/random:v0.0.2

start random

riff service invoke random --json -- -w '\n' \
  -d '{"url":"http://hello.default.svc.cluster.local"}'

create numbers and squares channels

riff channel create numbers --cluster-bus stub
riff channel create squares --cluster-bus stub

create subscriptions

riff subscription create \
  --subscriber square \
  --channel numbers \
  --reply-to squares

riff subscription create \
  --subscriber hello  \
  --channel squares

send random numbers into numbers channel

riff service invoke random --json -- -w '\n' \
  -d '{"url":"http://numbers-channel.default.svc.cluster.local"}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment