Skip to content

Commit

Permalink
chore(delpoy_cluster): available tc (340Lab#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
ActivePeter authored Dec 7, 2023
1 parent 8d1bf94 commit 845b3c9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docker/WasmEdge/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions docker/WasmServerless/wasm_serverless_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down
4 changes: 3 additions & 1 deletion scripts/deploy_cluster/_gen_each_node_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}"

Expand All @@ -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}
Expand Down

0 comments on commit 845b3c9

Please sign in to comment.