Git Product home page Git Product logo

wasmcloud / examples Goto Github PK

View Code? Open in Web Editor NEW
124.0 7.0 43.0 33.48 MB

ARCHIVED: This repository contains examples for pre-1.0 versions of wasmCloud. All examples are now located in the main wasmCloud repository https://github.com/wasmCloud/wasmCloud/tree/main/examples.

Home Page: https://github.com/wasmCloud/wasmCloud/tree/main/examples

Rust 23.40% Makefile 3.27% Go 1.10% JavaScript 23.60% HTML 8.26% CSS 37.70% Shell 0.95% Python 0.05% Smithy 1.07% TypeScript 0.35% Vue 0.23%
examples samples webassembly webassembly-runtime

examples's Introduction

Important

The examples in this repository are WebAssembly modules which consume interfaces defined in Smithy and communicate with providers over the stable ABI. Actors built as WebAssembly components consume interfaces defined using WIT. Examples of actor components can be found in the wasmCloud repo. Note that support for WIT is considered experimental at this time.

wasmCloud Examples

Example actors, capability providers, and other demonstrations

Actors

The following actors run as WebAssembly on wasmCloud hosts.

Example Description OCI Reference
(refer to example for latest version)
animal-image-downloader An actor that receives messages and makes HTTP requests, downloading a picture of an animal to a blobstore wasmcloud.azurecr.io/animal-image-downloader
echo An actor that listens on an HTTP port and returns a JSON payload describing the incoming request wasmcloud.azurecr.io/echo
echo-messaging An actor that listens on a message broker topic and replies wasmcloud.azurecr.io/echo-messaging
hello Canonical "hello world" actor that listens on an HTTP port and replies with a greeting wasmcloud.azurecr.io/hello
kvcounter An actor that uses the key-value store to increment a counter and return a value for every HTTP request it receives wasmcloud.azurecr.io/kvcounter
logging An actor that demonstrates the builtin logging capability provider wasmcloud.azurecr.io/logging
message-pub An actor that demonstrates receiving HTTP requests and publishing the request body as a message wasmcloud.azurecr.io/message-pub
random An actor that demonstrates the builtin random number generation capability provider wasmcloud.azurecr.io/random
todo-sql An todo-application using sql database, https server (with TLS), logging, and numbergen (unpublished)
todo An todo-application using keyvalue store, http server, and logging (unpublished)
xkcd A application that generates xkcd comics wasmcloud.azurecr.io/xkcd
ifconfig A tinygo actor that will return the external IP address of your http client (unpublished)

Interfaces

The following example interfaces are defined by Smithy models.

Example Description Capability contract Rust crate
cron A simple interface for invoking an actor at a specific time wasmcloud:example:cron wasmcloud-interface-cron
payments A simple interface for a payments capability provider (used in the Creating an Interface tutorial) wasmcloud:example:payments wasmcloud-examples-payments
runner A simple interface with a single 'Run' method wasmcloud:example:runner wasmcloud-examples-runner
timing A simple interface for retrieving the current timestamp from the host wasmcloud:timing wasmcloud-interface-timing

Capability providers

Providers of capabilities for wasmCloud actors

Example Description Capability contract OCI Reference
cron A capability provider that uses cron expressions to invoke actors on a timed interval wasmcloud:example:cron wasmcloud.azurecr.io/cron
factorial A capability provider that computes factorial of a number wasmcloud:example:payments wasmcloud.azurecr.io/factorial
fakepay A simple payment provider, used in the Creating a capability provider tutorial wasmcloud:example:fakepay wasmcloud.azurecr.io/fakepay
timing An implementation of the wasmcloud:timing capability contract wasmcloud:timing

Applications

Example Description
petclinic A WebAssembly and wasmCloud-based reimagining of the classic Spring Boot microservices Pet Clinic. The wasmCloud Pet Clinic consists of multiple actors, and uses a relational database capability provider and an http server capability provider.
adsb A FlightAware clone that allows users to take an RTL-SDR and plot airplane data on a map. Users can also cluster many RTL-SDRs from all over the country and visualize them together utilizing the power of the wasmCloud lattice.

examples's People

Contributors

aish-where-ya avatar attriaayush avatar autodidaddict avatar billyoung avatar brooksmtownsend avatar connorsmith256 avatar dependabot[bot] avatar jclmnop avatar jcuffe avatar jordan-rash avatar kamojiro avatar ks2211 avatar lachieh avatar liamrandall avatar matsbror avatar mattwilkinsonn avatar pgray avatar ricochet avatar rovast avatar snnsnn avatar snyk-bot avatar stevelr avatar stuartharris avatar thomastaylor312 avatar vados-cosmonic avatar wasmcloud-automation avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

examples's Issues

[proposal] Adding a dapr-http-provider

background

I am using wasmcloud in the test environment, and I want to put some micro-services running in wasmcloud as actors. But these actors need to communicate with the services running in k8s with the dapr sidecar.
In this way, new micro services can run in wasmcloud and the old services need no change.

design

Add a dapr-http-provider that respects the httpserver interface, and register to consul when the put link is called. When dapr calls wasmcloud actors, dapr will find the address in consul and finally call the dapr-http-provider. When the wasmcloud actor calls dapr services, it calls dapr-http-provider first.
image

need help

I am not sure if httpserver interface is enough for actor calls provider.
I am using go and currently can't find the tools or examples of how a provider calls an actor.

Are you interested in this? Looking forward to your feedback. I will put these codes on GitHub soon.

//cc @jordan-rash In case you are interested as I've found an awesome example of how actors call providers in go from you.

[BUG] actor/random fails simple make commands

[2023-04-30T18:10:48Z ERROR wasmbus_rpc::rpc_client] rpc error response error=Guest call failed for method Run: method not handled _.Run - unknown method

{
  "error": "rpc: Guest call failed for method Run: method not handled _.Run - unknown method",
  "success": false
}

I've been referring to the code in actors/random for another example I've been trying to write and discovered that the simple make targets seem to fail. Hopefully there's something obvious I'm missing or is this broken more generally for the runner interface?

petclinic errors on valid email

Using curl or the UI, the customers actor returns a 500 error when parsing any valid email, e.g. any with an '@'.

  • regex::Regex::new(r"^[-a-zA-Z0-9 ,._/]+$").unwrap()
  • check_safety("email", &arg.email)?;

Suggestions:

  • This example needs unit tests. The only other example with tests is factorial (provider) and none for actors.
  • Use a validator package like https://docs.rs/validator/0.14.0/validator/
  • github action workflow
  • The spring boot petclinic includes support for log4j. Add support for the logging provider. Bonus points for using structured logging.

petclinic owners ui - unused name field becomes the text 'undefined'

If you fill in first name 'Bob' and no last name, then submit, the user entered shows as 'Bob undefined'. Similarly if you enter last name only the user shows up as 'undefined Last'. However, if you click the other field to focus, type a space, and then backspace (erase the space, so the text field is blank), instead of "Bob undefined" you get "Bob".

Fix failing example releases

I recently tagged all actors, interfaces, and providers for release, and some of them failed to release. These should be remediated so we can publish our resources.

Failed at the Rust build step (mostly due to path dependencies in Cargo.toml)

Failed at the AzureCR release step (mostly due to an unexpected artifact name)

"Finish" wasmcloud-chat example

The wasmcloud chat example is currently incomplete, largely due to the fact that we had to record our demo videos for upcoming conferences well in advance of reaching feature completion. The following is a list of what we think should be done before we can consider this sample "complete":

  • - Telnet channel needs to prompt users for their username and password to log in or prompt "new" for new user
  • - NATS channel needs to offer a topic for presenting username and password in exchange for a bearer token, as well as a topic for creating a new user
  • - Internal plumbing needs to require the use of access/bearer tokens to illustrate real-world security in a real app
  • - Presence actor needs to be utilized for reporting and querying "who's online" (e.g. support /who from telnet)
  • - Telnet and NATS channel need to provide mechanisms for joining and removing rooms
  • - Telnet and NATS channel need to provide mechanisms for querying chat history for a given room
  • - NATS channel needs a user-friendly front-end (web app? another CLI? mobile app?)

petclinic ui - on small screen some dialog fields are inaccessible

On a small vertical screen (as I get if I split my screen vertically in half) when the add owner dialog appears, the 'First Name' field is not visible, and I can't move the dialog down to view it. I can slide the dialog up to access all other lower fields and the 'Add Owner' and 'Close' buttons at the bottom of the form. Using firefox 97.0.1 on linux.

add makefiles to build entire examples tree

add top-level and intermediate Makefiles to build all projects in the examples repo - actors, interfaces, and providers.

The makefiles should support the following actions:

  • make all
  • make test
  • make clean
  • make lint
  • make validate
    (the latter two should find any smithy files in the tree and validate those)

add shell test to example makefiles

when run under windows powershell, the example makefiles fail with multi-line commands that use \ for line continuation, but the error given isn't helpful for the user to diagnose. We should build a check into the makefile to test the shell capabilities and display an informative error.
Something like the following (pseudocode) should be added to build/makefiles/*.mk:

if $SHELL != "bash" && $SHELL != "zsh" && $SHELL != "fsh" ; then
    if ! $(multi \
        line \
        command ); then
        echo "this makefile expect a bash-compatible shell. Please start `bash`, `zsh`, or a similar shell before running make commands"
        exit
     fi
fi

the first if only runs the test if the shell isn't a common shell type.

Help with Outdated Example

Hey everyone,

I was working on lessons for WebAssembly and noticed that one of the examples called actor-to-actor no longer existed in this repository.

Do you have files for this example or a replacement example?

Thank you.

examples/animal-image-downloader deadline has elapsed

After following the instructions to try out animal-image-downloader, the lattice seems to be broken:

Error from wash call

$ wash call MDBIB35BEIFT552CBSJXY3TOQYGIDAWZMMX4TKD5AGMRSJUDYSDCDWDF MessageSubscriber.HandleMessage '{"subject": "wasmcloud.animal.dog", "body": []}'
[2023-02-07T11:53:03Z ERROR wasmbus_rpc::rpc_client] sending request error=timeout: deadline has elapsed
[2023-02-07T11:53:03Z ERROR wasmbus_rpc::rpc_client] sending request error=nats: timeout: deadline has elapsed topic=wasmbus.rpc.default.MDBIB35BEIFT552CBSJXY3TOQYGIDAWZMMX4TKD5AGMRSJUDYSDCDWDF

nats: timeout: deadline has elapsed

Logs from wasmcloud via wash up:

20:55:18.574 span_id=050d647f6fbbea35 trace_id=397b4418ba479fc64d51472689ecc7c3 [error] Timeout attempting to perform RPC invocation
20:55:18.575 span_id=073667a3d392c3c1 trace_id=397b4418ba479fc64d51472689ecc7c3 [error] Invocation failure: Guest call failed for method MessageSubscriber.HandleMessage: Host send error Failed to perform RPC call: request timeout
20:55:22.245 [error] Elixir.Gnat got a response for a request, but that is no longer registered

There are also some earlier logs from when the capability providers were registered, which is mostly more of the same:

Starting capability provider VADNMSIML2XGO2X4TPIONTIC55R2UUQGPPDZPAVSC2QD7E76CR77SPW7 instance 319f99ad-8707-4527-b27b-a021cc85cadc with nats url 127.0.0.1:4222
2023-02-07T11:51:36.245366Z ERROR wasmbus_rpc::rpc_client: sending request error=timeout: deadline has elapsed
2023-02-07T11:51:36.245381Z ERROR wasmbus_rpc::rpc_client: sending request error=nats: timeout: deadline has elapsed topic=wasmbus.rpc.default.MDBIB35BEIFT552CBSJXY3TOQYGIDAWZMMX4TKD5AGMRSJUDYSDCDWDF
2023-02-07T11:51:36.245387Z ERROR nats_messaging: Unable to send subscription error=nats: timeout: deadline has elapsed
20:51:36.246 span_id=534876ac9d1a6209 trace_id=c46335a944850f65fc3fb908c99ceae9 [error] Timeout attempting to perform RPC invocation
20:51:36.246 span_id=8913d9d97c27544c trace_id=c46335a944850f65fc3fb908c99ceae9 [error] Invocation failure: Guest call failed for method MessageSubscriber.HandleMessage: Host send error Failed to perform RPC call: request timeout
20:51:39.598 [error] Elixir.Gnat got a response for a request, but that is no longer registered
20:52:09.706 span_id=cf6c470d6480decc trace_id=be7969e04e44a18efeb07b398db796ad [error] Timeout attempting to perform RPC invocation
20:52:09.707 span_id=fcd8c0f0ccceaee2 trace_id=be7969e04e44a18efeb07b398db796ad [error] Invocation failure: Guest call failed for method MessageSubscriber.HandleMessage: Host send error Failed to perform RPC call: request timeout
20:52:14.396 [error] Elixir.Gnat got a response for a request, but that is no longer registered
20:53:04.672 span_id=4590173a371da8e5 trace_id=660a9b8059399704c1fec89eb0c8d14d [error] Timeout attempting to perform RPC invocation
20:53:04.673 span_id=f4293368571774a9 trace_id=660a9b8059399704c1fec89eb0c8d14d [error] Invocation failure: Guest call failed for method MessageSubscriber.HandleMessage: Host send error Failed to perform RPC call: request timeout
20:53:09.631 [error] Elixir.Gnat got a response for a request, but that is no longer registered

Note that restarting wasmcloud itself and re-registering & linking the actors does not seem to solve the issue

HTTP server unreachable.

Hey everyone. I am following the todo-sql example steps. However, the command in step 4 fails to succeed and returns the following:

Failed starting provider wasmcloud.azurecr.io/httpserver:0.17.0 on host NDDS4JBHZK7GSUFRA466263I6M2M7QFTYHSBR73W7WRLT57WPNSUTXEF

Caused by:
    Timed out waiting for applicable event, operation may have failed

Therefore, I am not able to run the tests. I am curious what this hash VAG3QITQQ2ODAOWB5TTQSDJ53XK3SHBEIFNK4AYJ5RKAX2UNSCAPHA5M represents. The ID of the actor, perhaps?

tiny example not working out for me - not sure why.

Hey

Just trying out the tiny example.

please let me knwo what i screwed up:

REPO_NAME=examples

BIN_RUNNER_NAME=wash

print:
	clear
	@echo '$(BIN_RUNNER_NAME):         $(shell which wash)'

dep-git:
	# https://github.com/wasmCloud/examples
	git clone [email protected]:wasmCloud/examples.git
	@echo $(REPO_NAME) >> .gitignore

dep-brew:
	# https://github.com/wasmcloud/wash
	brew tap wasmcloud/wasmcloud
	brew install wasmcloud wash

wash-up:
	# https://wasmcloud.dev/overview/installation/
	wash up
	# uses /Users/apple/.wash
	# starts nats server on  127.0.0.1:4222
	# starts dashboard at: http://localhost:4000

export WASMCLOUD_CLUSTER_SEED=SCACMULU34W5XBQCLELIWRUAATABTKOAHQJIXEBBMONZOQKF7W6R7WHOO4
build:
	@echo 'WASMCLOUD_CLUSTER_SEED:          $(WASMCLOUD_CLUSTER_SEED)'
	cd $(REPO_NAME)/actor/kvcounter-tinygo && $(MAKE) provider
	cd $(REPO_NAME)/actor/kvcounter-tinygo && $(MAKE) link

run:
	# push the signed wasm to your OCI registry
	cd $(REPO_NAME)/actor/kvcounter-tinygo && $(MAKE) push
	# start the actor
	cd $(REPO_NAME)/actor/kvcounter-tinygo && $(MAKE) start


	
	

wash up:

make wash-up 
๐Ÿƒ Running in interactive mode, your host is running at http://localhost:4000
๐Ÿšช Press `CTRL+c` at any time to exit
11:05:26.268 [info] Wrote "./host_config.json"
11:05:26.270 [info] Wrote "/Users/apple/.wash/host_config.json"
11:05:26.270 [info] Connecting to control interface NATS without authentication
11:05:26.270 [info] Connecting to lattice rpc NATS without authentication
11:05:26.271 [info] Host NCMCPMSED4DEV5DCYOLP7ABZSR72FOVIJICSL3MI2FLOJEBAZFDXPQQ5 (rough-hamster-9447) started.
11:05:26.272 [info] Valid cluster signers: CC34SNGG4X3RBU7NHQN2RHODUAIXP7QGSWTY7VS43VHFVLEH2W5ZYVMU
11:05:26.272 [warning] WARNING. You are using an ad hoc generated cluster seed.
For any other host or CLI tool to communicate with this host,
you MUST copy the following seed key and use it as the value
of the WASMCLOUD_CLUSTER_SEED environment variable:

SCACMULU34W5XBQCLELIWRUAATABTKOAHQJIXEBBMONZOQKF7W6R7WHOO4

You must also ensure the following cluster signer is in the list of valid
signers for any new host you start:

CC34SNGG4X3RBU7NHQN2RHODUAIXP7QGSWTY7VS43VHFVLEH2W5ZYVMU


11:05:26.293 [info] Started wasmCloud OTP Host Runtime
11:05:26.306 [info] Running WasmcloudHostWeb.Endpoint with cowboy 2.9.0 at 0.0.0.0:4000 (http)
11:05:26.315 [info] Access WasmcloudHostWeb.Endpoint at http://localhost:4000
11:05:26.395 [info] Lattice cache stream created or verified as existing (0 consumers).
11:05:26.395 [info] Attempting to create ephemeral consumer (cache loader)
11:05:26.396 [info] Created ephemeral consumer for lattice cache loader
11:05:28.831 [info] tzdata release in place is from a file last modified Fri, 22 Oct 2021 02:20:47 GMT. Release file on server was last modified Tue, 29 Nov 2022 17:25:53 GMT.
11:05:30.404 [info] Tzdata has updated the release from 2021e to 2022g
11:05:41.689 request_id=FzADte8NAcinqhQAAAAB [info] GET /
11:05:41.724 request_id=FzADte8NAcinqhQAAAAB [info] Sent 200 in 35ms
11:05:42.599 [info] CONNECTED TO Phoenix.LiveView.Socket in 48ยตs
  Transport: :websocket
  Serializer: Phoenix.Socket.V2.JSONSerializer
  Parameters: %{"_csrf_token" => "IBc1NDgSNRohIBpHKRkbXlsfcDECfxohaCGVJxmlThJrQCv87HGxWGoh", "_mounts" => "0", "_track_static" => %{"0" => "http://localhost:4000/assets/app-b30c30308bb8d054f4ebf7e99d3451a2.css?vsn=d", "1" => "http://localhost:4000/assets/app-8aff8950ba1f64d0c655a939a12ab094.js?vsn=d"}, "vsn" => "2.0.0"}
11:05:59.101 request_id=FzADufzqJFcocLEAAADB [info] GET /metrics
11:05:59.107 request_id=FzADufzqJFcocLEAAADB [info] Sent 200 in 5ms
11:05:59.594 [info] CONNECTED TO Phoenix.LiveView.Socket in 32ยตs
  Transport: :websocket
  Serializer: Phoenix.Socket.V2.JSONSerializer
  Parameters: %{"_csrf_token" => "HjEYBBUGHT43GBZfIgkUMBYCDmQTTAxk_ejfglEHBPFjZSyVzU9-Fty-", "_mounts" => "0", "_track_static" => %{"0" => "http://localhost:4000/assets/app-b30c30308bb8d054f4ebf7e99d3451a2.css?vsn=d", "1" => "http://localhost:4000/assets/app-8aff8950ba1f64d0c655a939a12ab094.js?vsn=d"}, "vsn" => "2.0.0"}
11:06:00.214 request_id=FzADuj81Vr8q4MEAAAEB [info] GET /
11:06:00.216 request_id=FzADuj81Vr8q4MEAAAEB [info] Sent 200 in 2ms
11:06:00.525 [info] CONNECTED TO Phoenix.LiveView.Socket in 38ยตs
  Transport: :websocket
  Serializer: Phoenix.Socket.V2.JSONSerializer
  Parameters: %{"_csrf_token" => "KxgRCTwsAAYlGmVFCjIcIj0kYzxmTkF9jLckNFXpPR5prhqDQsTu3v44", "_mounts" => "0", "_track_static" => %{"0" => "http://localhost:4000/assets/app-b30c30308bb8d054f4ebf7e99d3451a2.css?vsn=d", "1" => "http://localhost:4000/assets/app-8aff8950ba1f64d0c655a939a12ab094.js?vsn=d"}, "vsn" => "2.0.0"}
11:06:23.647 request_id=FzADv7P8TLXulcUAAAGB [info] GET /metrics
11:06:23.651 request_id=FzADv7P8TLXulcUAAAGB [info] Sent 200 in 3ms
11:06:23.980 [info] CONNECTED TO Phoenix.LiveView.Socket in 35ยตs
  Transport: :websocket
  Serializer: Phoenix.Socket.V2.JSONSerializer
  Parameters: %{"_csrf_token" => "BTwLOgQLMU8fHx0ATQUVOR0BWQEndUILDhyXvai9jWM55_x_qVnHrM7B", "_mounts" => "0", "_track_static" => %{"0" => "http://localhost:4000/assets/app-b30c30308bb8d054f4ebf7e99d3451a2.css?vsn=d", "1" => "http://localhost:4000/assets/app-8aff8950ba1f64d0c655a939a12ab094.js?vsn=d"}, "vsn" => "2.0.0"}
11:06:33.895 request_id=FzADwhbHwL-slb8AAABi [info] GET /
11:06:33.897 request_id=FzADwhbHwL-slb8AAABi [info] Sent 200 in 1ms
11:06:34.191 [info] CONNECTED TO Phoenix.LiveView.Socket in 32ยตs
  Transport: :websocket
  Serializer: Phoenix.Socket.V2.JSONSerializer
  Parameters: %{"_csrf_token" => "KgQ6EUtaDzQNJAZYCCA0MjQ4cisbfgN5kPHs90WBxlVmpzYTXoEbNFv0", "_mounts" => "0", "_track_static" => %{"0" => "http://localhost:4000/assets/app-b30c30308bb8d054f4ebf7e99d3451a2.css?vsn=d", "1" => "http://localhost:4000/assets/app-8aff8950ba1f64d0c655a939a12ab094.js?vsn=d"}, "vsn" => "2.0.0"}
11:11:32.532 [info] Starting executable capability provider at  '/var/folders/wp/ff6sz9qs6g71jnm12nj2kbyw0000gp/T/wasmcloudcache/VAG3QITQQ2ODAOWB5TTQSDJ53XK3SHBEIFNK4AYJ5RKAX2UNSCAPHA5M/1646188953/wasmcloud_httpserver_default'
Starting capability provider VAG3QITQQ2ODAOWB5TTQSDJ53XK3SHBEIFNK4AYJ5RKAX2UNSCAPHA5M instance 237d2344-0c92-4211-ab67-483d717402c7 with nats url 127.0.0.1:4222
11:12:45.356 request_id=FzAEGJOTO8NXOgkAAAJh [info] GET /
11:12:45.358 request_id=FzAEGJOTO8NXOgkAAAJh [info] Sent 200 in 2ms
11:12:45.880 [info] CONNECTED TO Phoenix.LiveView.Socket in 209ยตs
  Transport: :websocket
  Serializer: Phoenix.Socket.V2.JSONSerializer
  Parameters: %{"_csrf_token" => "KTkFDBw9NB4fCmcMDywbBQUiBCxnbQwnhmwnnWlhjB79wvvciu3e2Uyn", "_mounts" => "0", "_track_static" => %{"0" => "http://localhost:4000/assets/app-b30c30308bb8d054f4ebf7e99d3451a2.css?vsn=d", "1" => "http://localhost:4000/assets/app-8aff8950ba1f64d0c655a939a12ab094.js?vsn=d"}, "vsn" => "2.0.0"}

build:

make build
WASMCLOUD_CLUSTER_SEED:          SCACMULU34W5XBQCLELIWRUAATABTKOAHQJIXEBBMONZOQKF7W6R7WHOO4
cd examples/actor/kvcounter-tinygo && /Applications/Xcode.app/Contents/Developer/usr/bin/make provider
wash ctl start provider wasmcloud.azurecr.io/httpserver:0.15.0

No suitable hosts found for provider wasmcloud.azurecr.io/httpserver:0.15.0

run:

make run
# push the signed wasm to your OCI registry
cd examples/actor/kvcounter-tinygo && /Applications/Xcode.app/Contents/Developer/usr/bin/make push
wash claims sign build/kvcounter_tinygo.wasm --destination build/kvcounter_tinygo_s.wasm --name kvcounter-tinygo --http_server --keyvalue -v 0.1.0

Wasm Element error: Unknown opcode 252
make[1]: *** [build/kvcounter_tinygo_s.wasm] Error 1
make: *** [run] Error 2

README out of date

The README should be updated to list correct contract IDs, remove references to wascc, and add relevant shields.io badges. If possible, an auto-updating list of actor versions would be beneficial.

Content-Type header

Who's responsibility will it be, actor or provider, to determine the Context-Type of an endpoint? For example, in the new and improved KV counter, content-type is left blank for the CSS, and the browser is left it infer what it is. Depending on the browser I am using, I have had the CSS break...I fixed this by adding a header to any endpoint that ended in .css inside the provider.

Edit: the default provider behavior does take all headers, that are present from the actor, and append them to the response to the originator. The issue here is that there is no Content-Type header

("GET", asset_path) => get_asset(asset_path.join("/")),

Move examples code into wasmcloud/wasmcloud

Multiple community members have expressed confusion akin to "where code?" when they go to our top level repo. Based on community calls, examples made sense as the first thing to see. As part of this, we should be preserving git history when we merge and then it should be presented to the community.

As part of this, we need to make sure the org maintainers sign off on the repo merge before the work is done

Installing via Docker Compose Fails

Hi, I follow the instruction from https://wasmcloud.dev/overview/installation/install-with-docker/ but failed to run a working setup.

Steps to recreate:

  1. Cd into docker/ directory
  2. Run docker compose up command.

Docker version: Docker version 20.10.18, build b40c2f6 (Currently the latest build)
OS: Ubuntu 22.04.1 LTS

Restarting container also returns "OTLP exporter failed to initialize with exception :throw:{:application_either_not_started_or_not_ready, :tls_certificate_check}" error.

Here is the log from the wasmcloud container:

docker logs -f docker-wasmcloud-1 
19:07:48.824 [warning] OTLP exporter failed to initialize with exception :throw:{:application_either_not_started_or_not_ready, :tls_certificate_check}
19:10:00.763 [error] Failed to configure invocation chunking object store (NATS): "Os { code: 110, kind: TimedOut, message: \"Connection timed out\" }". Any chunked invocations will fail.
19:10:00.763 [info] OTLP exporter successfully initialized
19:10:00.764 [info] Wrote configuration file host_config.json
19:10:00.764 [info] Wrote configuration file /root/.wash/host_config.json
19:10:00.764 [info] Connecting to control interface NATS without authentication
19:10:00.765 [info] Connecting to lattice rpc NATS without authentication
19:10:00.767 [info] Host NBJPRKFYNT3PMBIUQKL6KSUTPUDUDFXAVPBNPSLEPJNCN2QM32DS6Z67 (summer-glade-5233) started.
19:10:00.767 [info] Host issuer public key: CCOVHI4XN3QSZAT5MLXXSFMS5MHIWH7LOSTF5OX2JRYH7ECNGYOF4YOJ
19:10:00.767 [info] Valid cluster signers: CCOVHI4XN3QSZAT5MLXXSFMS5MHIWH7LOSTF5OX2JRYH7ECNGYOF4YOJ
19:10:00.767 [warning] WARNING. You are using an ad hoc generated cluster seed.
For any other host or CLI tool to communicate with this host,
you MUST copy the following seed key and use it as the value
of the WASMCLOUD_CLUSTER_SEED environment variable:

SCAACHUDH7UWPPRLZMEZKC3TJMKAEUSAYK4AEF54OU7PQIUGVCBEOK5N5U

You must also ensure the following cluster signer is in the list of valid
signers for any new host you start:

CCOVHI4XN3QSZAT5MLXXSFMS5MHIWH7LOSTF5OX2JRYH7ECNGYOF4YOJ


19:10:03.767 [error] failed to connect :timeout
19:10:03.767 [error] failed to connect :timeout
19:10:03.767 [error] failed to connect :timeout
19:10:03.767 [error] failed to connect :timeout
19:10:03.768 [error] Elixir.Gnat.ConsumerSupervisor unexpected shutdown {:timeout, {GenServer, :call, [#PID<0.2055.0>, {:sub, #PID<0.2061.0>, "_INBOX.6YNvN3r", []}, 5000]}}
19:10:03.768 [error] Elixir.Gnat.ConsumerSupervisor unexpected shutdown {:timeout, {GenServer, :call, [#PID<0.2055.0>, {:sub, #PID<0.2059.0>, "wasmbus.ctl.default.registries.put", []}, 5000]}}
19:10:03.768 [error] GenServer #PID<0.2059.0> terminating
** (stop) exited in: GenServer.call(#PID<0.2055.0>, {:sub, #PID<0.2059.0>, "wasmbus.ctl.default.registries.put", []}, 5000)
    ** (EXIT) time out
    (elixir 1.13.3) lib/gen_server.ex:1030: GenServer.call/3
    (gnat 1.5.2) lib/gnat.ex:168: Gnat.sub/4
    (gnat 1.5.2) lib/gnat/consumer_supervisor.ex:81: anonymous fn/2 in Gnat.ConsumerSupervisor.handle_info/2
    (elixir 1.13.3) lib/enum.ex:1593: Enum."-map/2-lists^map/1-0-"/2
    (gnat 1.5.2) lib/gnat/consumer_supervisor.ex:78: Gnat.ConsumerSupervisor.handle_info/2
    (stdlib 3.17.1) gen_server.erl:695: :gen_server.try_dispatch/4
    (stdlib 3.17.1) gen_server.erl:771: :gen_server.handle_msg/6
    (stdlib 3.17.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: :connect
19:10:03.768 [error] GenServer #PID<0.2061.0> terminating
** (stop) exited in: GenServer.call(#PID<0.2055.0>, {:sub, #PID<0.2061.0>, "_INBOX.6YNvN3r", []}, 5000)
    ** (EXIT) time out
    (elixir 1.13.3) lib/gen_server.ex:1030: GenServer.call/3
    (gnat 1.5.2) lib/gnat.ex:168: Gnat.sub/4
    (gnat 1.5.2) lib/gnat/consumer_supervisor.ex:81: anonymous fn/2 in Gnat.ConsumerSupervisor.handle_info/2
    (elixir 1.13.3) lib/enum.ex:1593: Enum."-map/2-lists^map/1-0-"/2
    (gnat 1.5.2) lib/gnat/consumer_supervisor.ex:78: Gnat.ConsumerSupervisor.handle_info/2
    (stdlib 3.17.1) gen_server.erl:695: :gen_server.try_dispatch/4
    (stdlib 3.17.1) gen_server.erl:771: :gen_server.handle_msg/6
    (stdlib 3.17.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: :connect
19:10:03.769 [error] GenServer #PID<0.2060.0> terminating
** (stop) exited in: GenServer.call(#PID<0.2055.0>, {:sub, #PID<0.2059.0>, "wasmbus.ctl.default.registries.put", []}, 5000)
    ** (EXIT) time out
Last message: {:EXIT, #PID<0.2059.0>, {:timeout, {GenServer, :call, [#PID<0.2055.0>, {:sub, #PID<0.2059.0>, "wasmbus.ctl.default.registries.put", []}, 5000]}}}
19:10:03.769 [error] GenServer #PID<0.2062.0> terminating
** (stop) exited in: GenServer.call(#PID<0.2055.0>, {:sub, #PID<0.2061.0>, "_INBOX.6YNvN3r", []}, 5000)
    ** (EXIT) time out
Last message: {:EXIT, #PID<0.2061.0>, {:timeout, {GenServer, :call, [#PID<0.2055.0>, {:sub, #PID<0.2061.0>, "_INBOX.6YNvN3r", []}, 5000]}}}
19:10:03.770 [info] Started wasmCloud OTP Host Runtime
19:10:03.770 [notice] Application host_core exited: HostCore.start(:normal, []) returned an error: shutdown: failed to start child: HostCore.Host
    ** (EXIT) exited in: GenServer.call(:control_nats, {:pub, "wasmbus.evt.default", "{\"data\":{\"friendly_name\":\"summer-glade-5233\",\"labels\":{\"hostcore.arch\":\"x86_64\",\"hostcore.os\":\"linux\",\"hostcore.osfamily\":\"unix\"}},\"datacontenttype\":\"application/json\",\"id\":\"cc73c69f-84d0-4c10-9058-51d8c41602ec\",\"source\":\"NBJPRKFYNT3PMBIUQKL6KSUTPUDUDFXAVPBNPSLEPJNCN2QM32DS6Z67\",\"specversion\":\"1.0\",\"time\":\"2022-10-03T19:10:00.767560Z\",\"type\":\"com.wasmcloud.lattice.host_started\"}", [headers: []]}, 5000)
        ** (EXIT) time out
{"Kernel pid terminated",application_controller,"{application_start_failure,host_core,{{shutdown,{failed_to_start_child,'Elixir.HostCore.Host',{timeout,{'Elixir.GenServer',call,[control_nats,{pub,<<\"wasmbus.evt.default\">>,<<\"{\\"data\\":{\\"friendly_name\\":\\"summer-glade-5233\\",\\"labels\\":{\\"hostcore.arch\\":\\"x86_64\\",\\"hostcore.os\\":\\"linux\\",\\"hostcore.osfamily\\":\\"unix\\"}},\\"datacontenttype\\":\\"application/json\\",\\"id\\":\\"cc73c69f-84d0-4c10-9058-51d8c41602ec\\",\\"source\\":\\"NBJPRKFYNT3PMBIUQKL6KSUTPUDUDFXAVPBNPSLEPJNCN2QM32DS6Z67\\",\\"specversion\\":\\"1.0\\",\\"time\\":\\"2022-10-03T19:10:00.767560Z\\",\\"type\\":\\"com.wasmcloud.lattice.host_started\\"}\">>,[{headers,[]}]},5000]}}}},{'Elixir.HostCore',start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,host_core,{{shutdown,{failed_to_start_child,'Elixir.HostCore.Host',{timeout,{'Elixir.GenServer',call,[control_nats,{pub,<<"wasmbus.evt.default">>,<<"{\"data\":{\"friendly_name\":\"summer-glade-5233\",\"labels\":{\"hostcore.arch\":\"x86_64\",\"hostcore.os\":\"linux\",\"hostcore.osfamily\":\"unix\"}},\"datacontenttype\":\"application/json\",\"id\":\"cc73c69f-84d0-4c10-9058-51d8c41602ec\",\"source\":\"NBJPRKFYNT3PMBIUQKL6KSUTPUDUDFXAVPBNPSLEPJNCN2QM32DS6Z67\",\"specversion\":\"1.0\",\"time\":\"2022-10-03T19:10:00.767560Z\",\"type\":\"com.wasmcloud.lattice.host_started\"}">>,[{headers,[]}]},5000]}}}},{'Elixir.HostCore',start,[normal,[]]}}})

Crash dump is being written to: erl_crash.dump...19:11:43.939 [warning] OTLP exporter failed to initialize with exception :throw:{:application_either_not_started_or_not_ready, :tls_certificate_check}
19:13:54.235 [error] Failed to configure invocation chunking object store (NATS): "Os { code: 110, kind: TimedOut, message: \"Connection timed out\" }". Any chunked invocations will fail.
19:13:54.235 [info] OTLP exporter successfully initialized
19:13:54.235 [info] Wrote configuration file host_config.json
19:13:54.236 [info] Wrote configuration file /root/.wash/host_config.json
19:13:54.236 [info] Connecting to control interface NATS without authentication
19:13:54.236 [info] Connecting to lattice rpc NATS without authentication
19:13:54.239 [info] Host NC7CVRVBJIOUWBWBVSRBTACVNWEZBC4NIJCBFWPVZQ6INAHS3FALJAO6 (twilight-haze-8374) started.
19:13:54.239 [info] Host issuer public key: CCOVHI4XN3QSZAT5MLXXSFMS5MHIWH7LOSTF5OX2JRYH7ECNGYOF4YOJ
19:13:54.239 [info] Valid cluster signers: CCOVHI4XN3QSZAT5MLXXSFMS5MHIWH7LOSTF5OX2JRYH7ECNGYOF4YOJ
19:13:57.239 [error] failed to connect :timeout
19:13:57.239 [error] failed to connect :timeout
19:13:57.239 [error] failed to connect :timeout
19:13:57.239 [error] failed to connect :timeout
19:13:57.239 [error] Elixir.Gnat.ConsumerSupervisor unexpected shutdown {:timeout, {GenServer, :call, [#PID<0.2052.0>, {:sub, #PID<0.2058.0>, "wasmbus.ctl.default.registries.put", []}, 5000]}}
19:13:57.239 [error] Elixir.Gnat.ConsumerSupervisor unexpected shutdown {:timeout, {GenServer, :call, [#PID<0.2052.0>, {:sub, #PID<0.2060.0>, "_INBOX.8jO7Rba", []}, 5000]}}
19:13:57.239 [error] GenServer #PID<0.2060.0> terminating
** (stop) exited in: GenServer.call(#PID<0.2052.0>, {:sub, #PID<0.2060.0>, "_INBOX.8jO7Rba", []}, 5000)
    ** (EXIT) time out
    (elixir 1.13.3) lib/gen_server.ex:1030: GenServer.call/3
    (gnat 1.5.2) lib/gnat.ex:168: Gnat.sub/4
    (gnat 1.5.2) lib/gnat/consumer_supervisor.ex:81: anonymous fn/2 in Gnat.ConsumerSupervisor.handle_info/2
    (elixir 1.13.3) lib/enum.ex:1593: Enum."-map/2-lists^map/1-0-"/2
    (gnat 1.5.2) lib/gnat/consumer_supervisor.ex:78: Gnat.ConsumerSupervisor.handle_info/2
    (stdlib 3.17.1) gen_server.erl:695: :gen_server.try_dispatch/4
    (stdlib 3.17.1) gen_server.erl:771: :gen_server.handle_msg/6
    (stdlib 3.17.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: :connect
19:13:57.239 [error] GenServer #PID<0.2058.0> terminating
** (stop) exited in: GenServer.call(#PID<0.2052.0>, {:sub, #PID<0.2058.0>, "wasmbus.ctl.default.registries.put", []}, 5000)
    ** (EXIT) time out
    (elixir 1.13.3) lib/gen_server.ex:1030: GenServer.call/3
    (gnat 1.5.2) lib/gnat.ex:168: Gnat.sub/4
    (gnat 1.5.2) lib/gnat/consumer_supervisor.ex:81: anonymous fn/2 in Gnat.ConsumerSupervisor.handle_info/2
    (elixir 1.13.3) lib/enum.ex:1593: Enum."-map/2-lists^map/1-0-"/2
    (gnat 1.5.2) lib/gnat/consumer_supervisor.ex:78: Gnat.ConsumerSupervisor.handle_info/2
    (stdlib 3.17.1) gen_server.erl:695: :gen_server.try_dispatch/4
    (stdlib 3.17.1) gen_server.erl:771: :gen_server.handle_msg/6
    (stdlib 3.17.1) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: :connect
19:13:57.240 [error] GenServer #PID<0.2061.0> terminating
** (stop) exited in: GenServer.call(#PID<0.2052.0>, {:sub, #PID<0.2060.0>, "_INBOX.8jO7Rba", []}, 5000)
    ** (EXIT) time out
Last message: {:EXIT, #PID<0.2060.0>, {:timeout, {GenServer, :call, [#PID<0.2052.0>, {:sub, #PID<0.2060.0>, "_INBOX.8jO7Rba", []}, 5000]}}}
19:13:57.240 [error] GenServer #PID<0.2059.0> terminating
** (stop) exited in: GenServer.call(#PID<0.2052.0>, {:sub, #PID<0.2058.0>, "wasmbus.ctl.default.registries.put", []}, 5000)
    ** (EXIT) time out
Last message: {:EXIT, #PID<0.2058.0>, {:timeout, {GenServer, :call, [#PID<0.2052.0>, {:sub, #PID<0.2058.0>, "wasmbus.ctl.default.registries.put", []}, 5000]}}}
19:13:57.242 [info] Started wasmCloud OTP Host Runtime
19:13:57.242 [notice] Application host_core exited: HostCore.start(:normal, []) returned an error: shutdown: failed to start child: HostCore.Host
    ** (EXIT) exited in: GenServer.call(:control_nats, {:pub, "wasmbus.evt.default", "{\"data\":{\"friendly_name\":\"twilight-haze-8374\",\"labels\":{\"hostcore.arch\":\"x86_64\",\"hostcore.os\":\"linux\",\"hostcore.osfamily\":\"unix\"}},\"datacontenttype\":\"application/json\",\"id\":\"8746a989-14ed-418f-aebe-e02bc5280b98\",\"source\":\"NC7CVRVBJIOUWBWBVSRBTACVNWEZBC4NIJCBFWPVZQ6INAHS3FALJAO6\",\"specversion\":\"1.0\",\"time\":\"2022-10-03T19:13:54.239396Z\",\"type\":\"com.wasmcloud.lattice.host_started\"}", [headers: []]}, 5000)
        ** (EXIT) time out
{"Kernel pid terminated",application_controller,"{application_start_failure,host_core,{{shutdown,{failed_to_start_child,'Elixir.HostCore.Host',{timeout,{'Elixir.GenServer',call,[control_nats,{pub,<<\"wasmbus.evt.default\">>,<<\"{\\"data\\":{\\"friendly_name\\":\\"twilight-haze-8374\\",\\"labels\\":{\\"hostcore.arch\\":\\"x86_64\\",\\"hostcore.os\\":\\"linux\\",\\"hostcore.osfamily\\":\\"unix\\"}},\\"datacontenttype\\":\\"application/json\\",\\"id\\":\\"8746a989-14ed-418f-aebe-e02bc5280b98\\",\\"source\\":\\"NC7CVRVBJIOUWBWBVSRBTACVNWEZBC4NIJCBFWPVZQ6INAHS3FALJAO6\\",\\"specversion\\":\\"1.0\\",\\"time\\":\\"2022-10-03T19:13:54.239396Z\\",\\"type\\":\\"com.wasmcloud.lattice.host_started\\"}\">>,[{headers,[]}]},5000]}}}},{'Elixir.HostCore',start,[normal,[]]}}}"}
Kernel pid terminated (application_controller) ({application_start_failure,host_core,{{shutdown,{failed_to_start_child,'Elixir.HostCore.Host',{timeout,{'Elixir.GenServer',call,[control_nats,{pub,<<"wasmbus.evt.default">>,<<"{\"data\":{\"friendly_name\":\"twilight-haze-8374\",\"labels\":{\"hostcore.arch\":\"x86_64\",\"hostcore.os\":\"linux\",\"hostcore.osfamily\":\"unix\"}},\"datacontenttype\":\"application/json\",\"id\":\"8746a989-14ed-418f-aebe-e02bc5280b98\",\"source\":\"NC7CVRVBJIOUWBWBVSRBTACVNWEZBC4NIJCBFWPVZQ6INAHS3FALJAO6\",\"specversion\":\"1.0\",\"time\":\"2022-10-03T19:13:54.239396Z\",\"type\":\"com.wasmcloud.lattice.host_started\"}">>,[{headers,[]}]},5000]}}}},{'Elixir.HostCore',start,[normal,[]]}}})

Crash dump is being written to: erl_crash.dump...done

Upgrade inmemory-streams provider to 0.15 compliance

  • Support health checks
  • Ensure that binding operation is idempotent
  • Support generated data types in actor-interfaces - do NOT use the wascc codec for anything other than the plugin trait.
  • Support the stop function in the 0.9.0 codec / plugin definition and ensure that this stop function can't panic
  • Use the wasmcloud:eventstreams capability contract ID
  • Update Cargo.toml and README.md to the standard that the other capabilities set, with README badges, license information, descriptions, etc.

Upgrade all examples to 0.15.0 compliance

  • Remove all dependencies on wascc-actor
  • Instead add smaller dependencies on the generated crate wrappers in actor-interfaces
  • Add Go versions for each of the existing Rust examples

Blobby should have a "GET" only mode

One use case for blobby is just to act as a simple httpserver for some static webpage assets. It would be nice to have an optional linkdef value that sets blobby to only allow GET requests, and return method not allowed for the other assets

Missing module specification in codegen.yaml

The ecommerce fakepay interface does not work with wapc version 0.0.4.
The following codegen.yaml seems to work but needs to be checked:

schema: payments.widl
generates:
  src/generated.rs:
    module: '@wapc/widl-codegen/rust'
    visitorClass: ModuleVisitor
  src/lib.rs:
    ifNotExists: true
    module: '@wapc/widl-codegen/rust'
    visitorClass: ScaffoldVisitor
    config:
      use: generated

[PETCLINIC] Provide configuration to run across external infrastructure

"external" is vague here, the general petclinic example is only meant to run on one machine but for a distributed microservice demo that is a bit boring.

Items that we'd need to provide in a README guide for running across different hosts

  1. NATS connection configuration, either:
    1. A nats-leaf.conf file with a connection to NGS
    2. A set of nats configuration files that supports clustering in a central location and leaf nodes for other
  2. Add WASMCLOUD_JS_DOMAIN to the docker compose with the core domain
  3. General guide to running in leaf-node mode

TinyGo XKCD Example

Would be great to have an example with TinyGo that exercised both ends of the HTTP spectrum ๐Ÿ˜„

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.