Skip to content
This repository has been archived by the owner on Apr 29, 2022. It is now read-only.

First Actor tutorial #9

Merged
merged 90 commits into from
May 4, 2021
Merged

First Actor tutorial #9

merged 90 commits into from
May 4, 2021

Conversation

jordan-rash
Copy link
Member

@jordan-rash jordan-rash commented Apr 5, 2021

@jordan-rash jordan-rash marked this pull request as draft April 5, 2021 18:12
@jordan-rash
Copy link
Member Author

jordan-rash commented Apr 19, 2021

Goal: Highlight polyglot experience
Subgoal: shame ourselves into adding routes and token extraction to http actor interface

  • Build a calculator actor
    • Provide add and divide, let user write subtract and multiple
  • Create the actor’s logic via handlerequest
  • Test invoke the actor via wash call
  • Build, sign, run, and link actor in host (possibly via manifest as easiest)
    • or makefile?
  • Exercise the actor via curl and HTTP endpoint

@jordan-rash
Copy link
Member Author

Suggested steps:

  1. Describe goal of calculator app
  • Have all three languages so user can pick adventure
  1. explain how add and divide work (with respect to wasmcloud)
  2. guide user though subtract and multiple
  3. invoke multiply in wash
  4. describe different ways to run (allow user to pick)
  • manifest
  • within wash
  1. curl actor from commandline

Copy link
Member

@autodidaddict autodidaddict left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some nitpicks and copy editing

dev_apps/first-actor/buildsign.md Outdated Show resolved Hide resolved
dev_apps/first-actor/buildsign.md Outdated Show resolved Hide resolved
dev_apps/first-actor/buildsign.md Outdated Show resolved Hide resolved
dev_apps/first-actor/buildsign.md Outdated Show resolved Hide resolved
dev_apps/first-actor/buildsign.md Outdated Show resolved Hide resolved
dev_apps/first-actor/intro.md Outdated Show resolved Hide resolved
dev_apps/first-actor/intro.md Outdated Show resolved Hide resolved
dev_apps/first-actor/intro.md Outdated Show resolved Hide resolved
dev_apps/first-actor/intro.md Outdated Show resolved Hide resolved
dev_apps/first-actor/intro.md Outdated Show resolved Hide resolved
@jordan-rash jordan-rash marked this pull request as ready for review May 3, 2021 22:07
@jordan-rash jordan-rash linked an issue May 3, 2021 that may be closed by this pull request
@jordan-rash jordan-rash changed the title WIP: First Actor tutorial First Actor tutorial May 3, 2021
Copy link
Member

@brooksmtownsend brooksmtownsend left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple changes, mostly relating to removing the registry

Comment on lines +27 to +31
Build it
`npm run build`{{execute}}

Sign it
`wash claims sign calculator.wasm --http_server --name "calculator" --ver 0.1.0 --rev 0`{{execute}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for some reason "sign it" shows up on the same line as the build it script, is that due to indents? (not a big deal)

02-dev_apps/first-actor/buildsign.md Show resolved Hide resolved
02-dev_apps/first-actor/buildsign.md Show resolved Hide resolved

- How wasmCloud leverages the polyglot power of WebAssembly
- Signing a wasm module with `wash`
- Pushing a signed wasmCloud module to an OCI compliant registry
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should remove the OCI compliant registry part

Comment on lines +24 to +27
- You can use `wash` to give you the actor ID of your actor
`wash claims inspect localhost:5000/calc:0.1.0 --insecure`{{execute}}
- You can use the environmental variable to override the current ID
`export CLIENT_ACTOR=$(wash claims inspect localhost:5000/calc:0.1.0 --insecure -o json | jq -r '.module')`{{execute}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change this to wash claims inspect with the signed wasm module (you may need to put this in a polyglot section, apologies)


`cargo build --release`{{execute interrupt T1}}

`wash claims sign target/wasm32-unknown-unknown/release/calculator.wasm -c wasmcloud:httpserver --name "calculator" --ver 0.1.0 --rev 0`{{execute T1}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's change -c wasmcloud:httpserver to --http_server


`mkdir -p build && tinygo build -o build/calculator.wasm -target wasm -no-debug main.go`{{execute interrupt T1}}

`wash claims sign build/calculator.wasm -c wasmcloud:httpserver --name "calculator" --ver 0.1.0 --rev 0`{{execute T1}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's change -c wasmcloud:httpserver to --http_server


`npm run build`{{execute interrupt T1}}

`wash claims sign calculator.wasm -q --name "calculator" --ver 0.1.0 --rev 0`{{execute T1}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's change -q to --http_server

> Note: We prefaced the registry push with a `wash drain all` which cleared the OCI cache. We did this since we are reusing the same tag.

And now lets start `wasmcloud` with our `manifest.yaml`!
`wasmcloud --allowed-insecure localhost:5000 -m manifest.yaml`{{execute interrupt T1}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can remove --allowed-insecure localhost:5000

Comment on lines +6 to +11
<pre class="file" data-filename="rust/src/lib.rs" data-target="insert" data-marker="// TODO: add multiplication">

Open the file:

`rust/src/lib.rs`{{open}}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open the file:

`rust/src/lib.rs`{{open}} 

this section is also copied to the editor, I think it should be outside the <pre> tag

@jordan-rash jordan-rash dismissed brooksmtownsend’s stale review May 4, 2021 00:41

Remaining line items to be completed in new PR

@jordan-rash jordan-rash merged commit dd1a25b into master May 4, 2021
@jordan-rash jordan-rash deleted the first_actor branch May 4, 2021 00:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create full suite of Katacoda tutorials
3 participants