Skip to content

Conversation

Swaagie
Copy link
Contributor

@Swaagie Swaagie commented Apr 7, 2022

Migrate examples to separate folders.

TODO:

  • migrate hello_world
  • migrate http_auth_random
  • migrate http_headers
  • migrate http_body
  • migrate http_config
  • Build each example as part of CICD (and perhaps run?)
  • cargo audit each cargo.toml for examples
  • 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

Copy link
Member

@PiotrSikora PiotrSikora left a comment

Choose a reason for hiding this comment

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

  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.

See below (both answers). On one hand examples should be self-contained, on the other hand, Docker and Envoy might add unnecessary compexity as well...

  1. 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.

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.

Working cargo build --examples would be great, but that's a secondary concern.

  1. 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.

Agreed, Bazel integration adds a ton of complexity that isn't strictly necessary. Maybe let's ignore it for now in examples.

FWIW, we can probably land this after v0.2.0 (unless you want to clear cargo-audit warnings in dependent crates?).

@Swaagie
Copy link
Contributor Author

Swaagie commented Apr 7, 2022

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 Swaagie removed this from the v0.2.0 milestone Apr 7, 2022
@Swaagie
Copy link
Contributor Author

Swaagie commented Apr 7, 2022

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 Swaagie marked this pull request as ready for review April 9, 2022 09:56
@Swaagie Swaagie force-pushed the examples branch 3 times, most recently from d2d3f2d to c20d1c9 Compare April 9, 2022 10:09
Swaagie added 14 commits April 9, 2022 12:31
Signed-off-by: Martijn Swaagman <[email protected]>
Signed-off-by: Martijn Swaagman <[email protected]>
Signed-off-by: Martijn Swaagman <[email protected]>
Signed-off-by: Martijn Swaagman <[email protected]>
Signed-off-by: Martijn Swaagman <[email protected]>
Signed-off-by: Martijn Swaagman <[email protected]>
Signed-off-by: Martijn Swaagman <[email protected]>
Signed-off-by: Martijn Swaagman <[email protected]>
Signed-off-by: Martijn Swaagman <[email protected]>
Signed-off-by: Piotr Sikora <[email protected]>
Signed-off-by: Piotr Sikora <[email protected]>
Signed-off-by: Piotr Sikora <[email protected]>
Signed-off-by: Piotr Sikora <[email protected]>
Signed-off-by: Piotr Sikora <[email protected]>
@PiotrSikora PiotrSikora changed the title Move examples into seperate folders Move examples into separate folders. Nov 22, 2022
@PiotrSikora PiotrSikora requested a review from mpwarres November 22, 2022 17:19
Copy link
Member

@PiotrSikora PiotrSikora left a comment

Choose a reason for hiding this comment

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

Thanks!

@PiotrSikora PiotrSikora merged commit 8d1f04a into proxy-wasm:master Nov 22, 2022
PiotrSikora added a commit to PiotrSikora/proxy-wasm-rust-sdk that referenced this pull request Feb 13, 2024
PiotrSikora added a commit to PiotrSikora/proxy-wasm-rust-sdk that referenced this pull request Feb 13, 2024
Bazel examples were removed in proxy-wasm#146.

Signed-off-by: Piotr Sikora <[email protected]>
mpwarres pushed a commit that referenced this pull request Feb 14, 2024
* Restore Bazel example to verify working rules_rust.

Bazel examples were removed in #146.

Signed-off-by: Piotr Sikora <[email protected]>

* review: strip debuginfo.

Signed-off-by: Piotr Sikora <[email protected]>

---------

Signed-off-by: Piotr Sikora <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants