proxy-wasm-rust-sdk icon indicating copy to clipboard operation
proxy-wasm-rust-sdk copied to clipboard

Move examples into seperate folders

Open Swaagie opened this issue 3 years ago • 2 comments

Migrate examples to separate folders.

TODO:

  • [x] migrate hello_world
  • [x] migrate http_auth_random
  • [x] migrate http_headers
  • [x] migrate http_body
  • [x] migrate http_config
  • [x] Build each example as part of CICD ~(and perhaps run?)~
  • [x] cargo audit each cargo.toml for examples
  • [x] Define documentation on how to build and run each example (per example or general?)

Earlier draft PR discussion

  1. Single docker-compose that uses and environment variable to load the matching example. Upside: re-use of docker compose config. Downside: tiny bit of magic to newcomers and newer examples might require more elaborate docker compose config for them to make sense/work.
  2. Do we want a separate Cargo.toml files for each example or go with Rust standard approach? It sounds like co-locating (dev-)dependencies was preferred to "avoid" the rustsec vuln from chrono from the main Crate? It would likely require more extensive changes and transition to a workspace.
  3. To what extend does raze need to be involved? For devs coming from a mostly Rust background that could be tooling they are unfamiliar with.

fixes #140 fixes #35 by showing how dispatch_http_call works

Swaagie avatar Apr 07 '22 08:04 Swaagie

I think this would be fine to land after 0.2, just so we don't block the WASM reactor change going out. Will allow us to iterate a bit and land on a solid implementation we are all happy with. In addition, would enable you to bring in your uncommitted examples.

edit: having an rustsec ignore on a devDependency of an example is not the worst.

Swaagie avatar Apr 07 '22 09:04 Swaagie

I'd prefer a separate Cargo.toml and src/lib.rs (since it has to be a cdylib for now), so that each example is a self-contained crate that users can copy as a base and evolve into their own plugins.

I'll start from this perspective and migrate each example. Having an envoy.yaml with static config is preferred IMHO over something that is generated through some Makefile/script. I agree examples should just be copy paste. This will likely also give clear understanding of docker compose complexity (if any).

Swaagie avatar Apr 07 '22 09:04 Swaagie