diff --git a/docker/WasmEdge/Dockerfile b/docker/WasmEdge/Dockerfile index 1ba7654..18b1223 100644 --- a/docker/WasmEdge/Dockerfile +++ b/docker/WasmEdge/Dockerfile @@ -14,7 +14,7 @@ FROM ubuntu:18.04 as wasm_serverless LABEL maintainers="ActivePeter" LABEL description="Wasm serverless platform" -RUN apt-get update && apt-get install -y python3 python3-pip git && mkdir -p /tmp/install +RUN apt-get update && apt-get install -y python3 python3-pip git iproute2 iputils-ping && mkdir -p /tmp/install # COPY --from=builder /root/.wasmedge /root/.wasmedge COPY wasm_edge.py /tmp/install/wasm_edge.py COPY WasmEdge-0.13.3-manylinux2014_x86_64.tar.gz /tmp/install/WasmEdge-0.13.3-manylinux2014_x86_64.tar.gz diff --git a/docker/WasmServerless/wasm_serverless_entrypoint.sh b/docker/WasmServerless/wasm_serverless_entrypoint.sh index 754818b..3e23d95 100644 --- a/docker/WasmServerless/wasm_serverless_entrypoint.sh +++ b/docker/WasmServerless/wasm_serverless_entrypoint.sh @@ -3,6 +3,12 @@ echo "Node id: ${WASM_SERVERLESS_NODEID}" echo "Who am i: $(whoami)" +# tc qdisc add dev eth0 root netem delay 100ms + +# tc qdisc add dev eth0 root tbf rate 1mbit burst 10kb latency 70ms + +timeout 10 ping baidu.com + cd /usr/local/bin/ ls /etc/wasm_serverless/ diff --git a/scripts/deploy_cluster/_gen_each_node_compose.py b/scripts/deploy_cluster/_gen_each_node_compose.py index b9a9a37..ddd29a3 100644 --- a/scripts/deploy_cluster/_gen_each_node_compose.py +++ b/scripts/deploy_cluster/_gen_each_node_compose.py @@ -14,6 +14,7 @@ def read_yaml(file_path): def generate_docker_compose(ip, nodes): services = {} + for key, node in nodes.items(): service_name = f"node{key}" @@ -35,7 +36,8 @@ def generate_docker_compose(ip, nodes): 'volumes': ['/root/wasm_serverless_deploy:/etc/wasm_serverless/config'], 'environment': { 'WASM_SERVERLESS_NODEID': key - } + }, + 'privileged': True # for tc control } compose_data = {'version': '3', 'services': services}