Skip to content

Commit

Permalink
add steps to readme
Browse files Browse the repository at this point in the history
Signed-off-by: Sven Pfennig <[email protected]>
  • Loading branch information
0xE282B0 committed Mar 13, 2024
1 parent 68bca71 commit d593e2f
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 21 deletions.
51 changes: 35 additions & 16 deletions podtato-head/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,31 @@

## Setup

- Set up cluster
kind create cluster --image kindest/node:v1.29.0
- ~~Set up container registry~~
- Install KWasm
- [ ] Set up a cluster
- [ ] Configure a container registry
- [ ] Install KWasm
```sh
helm install -n kwasm --create-namespace kwasm-operator kwasm/kwasm-operator --set kwasmOperator.autoProvision=true
- Check out repository
- Build podtatohead
docker build podtato-head-microservices/crates/podtato-entry -t 0xe282b0/podtato-head-entry --push
docker build podtato-head-microservices/crates/podtato-parts -t 0xe282b0/podtato-head-parts --push
```
- Check out this repository
```sh
git clone https://github.com/Liquid-Reply/kwasm-demos.git
```
- Deploy podtatohead
```sh
helm upgrade \
--install podtato-head ./delivery/chart
```
- Build podtatohead Wasm
```sh
docker build podtato-head-microservices/crates/podtato-entry -t <REGISTRY> /podtato-head-entry --push
docker build podtato-head-microservices/crates/podtato-parts -t <REGISTRY> /podtato-head-parts --push
```
- Deploy podtatohead Wasm
```sh
helm upgrade \
--install podtato-head ./delivery/chart \
--set images.repositoryDirname=0xe282b0 \
--set images.repositoryDirname=<REGISTRY> \
--set images.pullPolicy=Always \
--set entry.repositoryBasename=podtato-head-entry \
--set entry.runtimeClassName=wasmedge \
Expand All @@ -33,20 +44,28 @@ helm upgrade \

## Exercise 1: Add Logging

## Exercise 2: Add Probes
- Startup Probe
- Readiness Probe
- Liveness Probe
## Exercise 2: Health Checks
- [ ] Startup Probe
- [ ] Readiness Probe
- [ ] Liveness Probe

## Exercise 3: Add Metrics
- Metrics Endpoint

## Exercise 4: Add Tracing
- Host Functions
- Guest Instrumentation
- https://github.com/open-telemetry/opentelemetry-rust/issues/1478
-

## Exercise 5: Load Testing
- K6
```sh
helm repo add grafana https://grafana.github.io/helm-charts
helm install k6-operator grafana/k6-operator
```

## Exercise 6: Chaos Testing
- Chaos Mesh
- Chaos Mesh
```sh
helm repo add chaos-mesh https://charts.chaos-mesh.org
helm install chaos-mesh chaos-mesh/chaos-mesh -n=chaos-mesh --set chaosDaemon.runtime=containerd --set chaosDaemon.socketPath=/run/k3s/containerd/containerd.sock --version 2.6.3 --create-namespace
```

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ async fn serve_req(
Some(&_) => todo!(),
None => todo!(),
};
let res = reqwest::get(url).await.unwrap();
let content_data = res.text().await.unwrap();
let content_data = match fetch_data(&url).await {
Ok(data) => data,
Err(_) => String::new()
};
let mut response = Response::new(Full::new(Bytes::from(content_data)));
if url.ends_with(".svg") {
response
Expand All @@ -45,7 +47,6 @@ async fn serve_req(
let content = Assets::get(&path);
return match content {
Some(content) => {
println!("FOUND: {}", path);
let content_data = content.data.to_vec();
let mut response = Response::new(Full::new(Bytes::from(content_data)));
if path.ends_with(".svg") {
Expand All @@ -71,6 +72,10 @@ async fn serve_req(
}
}

async fn fetch_data(url: &str) -> Result<String, reqwest::Error> {
Ok(reqwest::get(url).await?.text().await?)
}

#[tokio::main(flavor = "current_thread")]
pub async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
let port = env::var("PODTATO_PORT").unwrap_or("9000".to_string());
Expand Down

0 comments on commit d593e2f

Please sign in to comment.