Skip to content

Commit

Permalink
wasm server being used in the development environment
Browse files Browse the repository at this point in the history
  • Loading branch information
eguzki committed Apr 24, 2024
1 parent f8d9a83 commit 88e4e33
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
10 changes: 1 addition & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ SHELL := /bin/bash
MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
PROJECT_PATH := $(patsubst %/,%,$(dir $(MKFILE_PATH)))

WASM_RELEASE_PATH = $(PROJECT_PATH)/target/wasm32-unknown-unknown/release/wasm_shim.wasm

PROTOC_BIN=$(PROJECT_PATH)/bin/protoc
PROTOC_VERSION=21.1
UNAME_S := $(shell uname -s)
Expand Down Expand Up @@ -54,13 +52,7 @@ update-protobufs:
# cd vendor-protobufs/data-plane-api/envoy/type/ && \
# touch tmp && git merge-file ./matcher/v3/metadata.proto ./tmp ./metadata/v3/metadata.proto --own && rm tmp

RUST_SOURCES := $(shell find $(PROJECT_PATH)/src -name '*.rs')

$(WASM_RELEASE_PATH): export BUILD = release
$(WASM_RELEASE_PATH): $(RUST_SOURCES)
make -C $(PROJECT_PATH) -f $(MKFILE_PATH) build

development: $(WASM_RELEASE_PATH)
development:
docker compose up

stop-development:
Expand Down
7 changes: 6 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
---
version: '2.2'
services:
envoy:
image: envoyproxy/envoy:v1.20-latest
depends_on:
- limitador
- upstream
- wasm-server
command:
- /usr/local/bin/envoy
- --config-path
Expand All @@ -25,6 +25,11 @@ services:
volumes:
- ./utils/docker-compose/envoy.yaml:/etc/envoy.yaml
- ./target/wasm32-unknown-unknown/release/wasm_shim.wasm:/opt/kuadrant/wasm/wasm_shim.wasm
wasm-server:
build:
dockerfile: ./Dockerfile.server
expose:
- "80"
limitador:
image: quay.io/kuadrant/limitador:latest
command: ["limitador-server", "-vvv", "/opt/kuadrant/limits/limits.yaml"]
Expand Down
21 changes: 19 additions & 2 deletions utils/docker-compose/envoy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ static_resources:
vm_id: vm.sentinel.kuadrant_wasm
runtime: envoy.wasm.runtime.v8
code:
local:
filename: /opt/kuadrant/wasm/wasm_shim.wasm
remote:
sha256: d5bd8b7a21e2369e130a9a2bd80345df30102b08d4fe070c1896a75769e7e2c0
http_uri:
uri: http://wasm-server:80/plugin.wasm
cluster: wasm-server
timeout: 10s
allow_precompiled: true
configuration:
"@type": "type.googleapis.com/google.protobuf.StringValue"
Expand Down Expand Up @@ -259,6 +263,19 @@ static_resources:
socket_address:
address: limitador
port_value: 8081
- name: wasm-server
connect_timeout: 1s
type: STRICT_DNS
lb_policy: round_robin
load_assignment:
cluster_name: wasm-server
endpoints:
- lb_endpoints:
- endpoint:
address:
socket_address:
address: wasm-server
port_value: 80
admin:
access_log_path: "/dev/null"
address:
Expand Down

0 comments on commit 88e4e33

Please sign in to comment.