From 587615c46568d8f0e2af1178c3ff49fd4193258b Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 2 Mar 2022 12:00:12 -0500 Subject: [PATCH 01/11] chore: Add missing dependencies --- install_deb.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/install_deb.sh b/install_deb.sh index 82abbb7..b9e283a 100755 --- a/install_deb.sh +++ b/install_deb.sh @@ -15,6 +15,7 @@ apt-get update && apt-get install -y --no-install-recommends \ imagemagick \ jq \ libz3-4 \ + make \ netpbm \ pango1.0-tools \ wamerican @@ -29,5 +30,7 @@ wget $SHELLCHECK_URL -O shellcheck && chmod +x shellcheck && sudo mv shellcheck curl -sS -L -O $WASI_SDK_URL && dpkg -i wasi-sdk_12.0_amd64.deb && rm -f wasi-sdk_12.0_amd64.deb + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y + echo "Add WASI_SDK_PATH to your bashrc and resource!" echo "Example: export WASI_SDK_PATH=/opt/wasi-sdk" From bee3df2801639f3b4da8327ac9157b2a089ed38c Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 2 Mar 2022 12:38:42 -0500 Subject: [PATCH 02/11] chore: Update install_deb --- install_deb.sh | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-) diff --git a/install_deb.sh b/install_deb.sh index b9e283a..c2c81ee 100755 --- a/install_deb.sh +++ b/install_deb.sh @@ -6,19 +6,47 @@ SHELLCHECK_URL=https://github.com/koalaman/shellcheck/releases/download/v0.7.1/s SHFMT_URL=https://github.com/mvdan/sh/releases/download/v3.2.4/shfmt_v3.2.4_linux_amd64 WASI_SDK_URL=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk_12.0_amd64.deb -apt-get update && apt-get install -y --no-install-recommends \ +sudo apt-get update && apt-get install -y --no-install-recommends \ + apt-utils \ + man-db \ + && yes | unminimize + +sudo apt-get update && apt-get install -y --no-install-recommends \ + automake \ bc \ + bsdmainutils \ + build-essential \ + binutils-dev \ + ca-certificates \ + cmake \ + curl \ fonts-dejavu \ fonts-cascadia-code \ fonts-roboto \ + gdb \ + git \ + gpg-agent \ gnuplot \ + httpie \ imagemagick \ jq \ + less \ + libssl-dev \ + libtinfo5 \ + libtool \ libz3-4 \ + lsb-release \ make \ netpbm \ + openssh-client \ pango1.0-tools \ - wamerican + pkg-config \ + software-properties-common \ + strace \ + valgrind \ + wabt \ + wamerican \ + wget wget $HEY_URL -O hey && chmod +x hey && sudo mv hey /usr/bin/hey @@ -26,11 +54,12 @@ wget $SHFMT_URL -O shfmt && chmod +x shfmt && sudo mv shfmt /usr/local/bin/shfmt wget $SHELLCHECK_URL -O shellcheck && chmod +x shellcheck && sudo mv shellcheck /usr/local/bin/shellcheck -./install_llvm.sh $LLVM_VERSION +sudo ./install_llvm.sh $LLVM_VERSION + +curl -sS -L -O $WASI_SDK_URL && sudo dpkg -i wasi-sdk_12.0_amd64.deb && rm -f wasi-sdk_12.0_amd64.deb -curl -sS -L -O $WASI_SDK_URL && dpkg -i wasi-sdk_12.0_amd64.deb && rm -f wasi-sdk_12.0_amd64.deb +echo "export WASI_SDK_PATH=/opt/wasi-sdk" >> ~/.bashrc - curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | bash -s -- -y +curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable --component rustfmt --target wasm32-wasi -y -echo "Add WASI_SDK_PATH to your bashrc and resource!" -echo "Example: export WASI_SDK_PATH=/opt/wasi-sdk" +echo "Run 'source ~/.bashrc'" From 0fe40da3e52c5f470055e27acbd76bf7bc0554d9 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 2 Mar 2022 12:57:06 -0500 Subject: [PATCH 03/11] chore: improve install script --- install_deb.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/install_deb.sh b/install_deb.sh index c2c81ee..a290e5f 100755 --- a/install_deb.sh +++ b/install_deb.sh @@ -6,12 +6,12 @@ SHELLCHECK_URL=https://github.com/koalaman/shellcheck/releases/download/v0.7.1/s SHFMT_URL=https://github.com/mvdan/sh/releases/download/v3.2.4/shfmt_v3.2.4_linux_amd64 WASI_SDK_URL=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk_12.0_amd64.deb -sudo apt-get update && apt-get install -y --no-install-recommends \ +sudo apt-get update && sudo apt-get install -y --no-install-recommends \ apt-utils \ man-db \ && yes | unminimize -sudo apt-get update && apt-get install -y --no-install-recommends \ +sudo apt-get update && sudo apt-get install -y --no-install-recommends \ automake \ bc \ bsdmainutils \ @@ -58,7 +58,10 @@ sudo ./install_llvm.sh $LLVM_VERSION curl -sS -L -O $WASI_SDK_URL && sudo dpkg -i wasi-sdk_12.0_amd64.deb && rm -f wasi-sdk_12.0_amd64.deb -echo "export WASI_SDK_PATH=/opt/wasi-sdk" >> ~/.bashrc +if [ -z "${WASI_SDK_PATH}" ]; then + export WASI_SDK_PATH=/opt/wasi-sdk + echo "export WASI_SDK_PATH=/opt/wasi-sdk" >> ~/.bashrc +fi curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable --component rustfmt --target wasm32-wasi -y From f325c361830bef95f13ac28f82c9075c85a9d5d7 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 2 Mar 2022 12:59:47 -0500 Subject: [PATCH 04/11] docs: Cleanup README instructions --- README.md | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 246ff44..e5c8671 100644 --- a/README.md +++ b/README.md @@ -2,25 +2,27 @@ **SLEdge** is a lightweight serverless solution suitable for edge computing. It builds on WebAssembly sandboxing provided by the [aWsm compiler](https://github.com/gwsystems/aWsm). -## Host Dependencies - -- Docker - [Installation Instructions](https://docs.docker.com/install/) - -## Setting up the environment - -You may either build the application natively on your host or in a Docker environment. +## Setting up a development environment ### Native on Debian Host -1. Run `install_deb.sh` to install host dependencies -2. Run `make install` to clone submodules and build all components -3. Run `make applications` to build all sample WebAssembly apps for execution on SLEdge -4. Run `make test` to execute end-to-end tests running WebAssembly apps on SLEdge. +```sh +git clone https://github.com/gwsystems/sledge-serverless-framework.git +cd sledge-serverless-framework +git checkout validate-setup +./install_deb.sh +source ~/.bashrc +make install +make applications +make test +``` ### Docker **Note: These steps require Docker. Make sure you've got it installed!** +[Docker Installation Instructions](https://docs.docker.com/install/) + We provide a Docker build environment configured with the dependencies and toolchain needed to build the SLEdge runtime and serverless functions. To setup this environment, run: From 5f0988df8cf16886dd94c2a9cc0a38982c661487 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 2 Mar 2022 13:35:30 -0500 Subject: [PATCH 05/11] chore: Additional install script changes --- install_deb.sh | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/install_deb.sh b/install_deb.sh index a290e5f..2047334 100755 --- a/install_deb.sh +++ b/install_deb.sh @@ -1,10 +1,20 @@ #!/bin/bash -HEY_URL=https://hey-release.s3.us-east-2.amazonaws.com/hey_linux_amd64 -LLVM_VERSION=12 -SHELLCHECK_URL=https://github.com/koalaman/shellcheck/releases/download/v0.7.1/shellcheck-v0.7.1.linux.x86_64.tar.xz -SHFMT_URL=https://github.com/mvdan/sh/releases/download/v3.2.4/shfmt_v3.2.4_linux_amd64 -WASI_SDK_URL=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk_12.0_amd64.deb +LLVM_VERSION=13 + +ARCH=$(uname -p) + +if [[ $ARCH = "x86_64" ]]; then + SHFMT_URL=https://github.com/mvdan/sh/releases/download/v3.4.3/shfmt_v3.4.3_linux_amd64 + WASI_SDK_URL=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-14/wasi-sdk_14.0_amd64.deb +elif [[ $ARCH = "aarch64" ]]; then + SHFMT_URL=hhttps://github.com/patrickvane/shfmt/releases/download/master/shfmt_linux_arm + echo "ARM64 support is still a work in progress!" + exit 1 +else + echo "This script only supports x86_64 and aarch64" + exit 1 +fi sudo apt-get update && sudo apt-get install -y --no-install-recommends \ apt-utils \ @@ -27,6 +37,7 @@ sudo apt-get update && sudo apt-get install -y --no-install-recommends \ git \ gpg-agent \ gnuplot \ + hey \ httpie \ imagemagick \ jq \ @@ -41,6 +52,7 @@ sudo apt-get update && sudo apt-get install -y --no-install-recommends \ openssh-client \ pango1.0-tools \ pkg-config \ + shellcheck \ software-properties-common \ strace \ valgrind \ @@ -48,12 +60,8 @@ sudo apt-get update && sudo apt-get install -y --no-install-recommends \ wamerican \ wget -wget $HEY_URL -O hey && chmod +x hey && sudo mv hey /usr/bin/hey - wget $SHFMT_URL -O shfmt && chmod +x shfmt && sudo mv shfmt /usr/local/bin/shfmt -wget $SHELLCHECK_URL -O shellcheck && chmod +x shellcheck && sudo mv shellcheck /usr/local/bin/shellcheck - sudo ./install_llvm.sh $LLVM_VERSION curl -sS -L -O $WASI_SDK_URL && sudo dpkg -i wasi-sdk_12.0_amd64.deb && rm -f wasi-sdk_12.0_amd64.deb From 6d3c0298e203b90bb98821e436d5e62ee69cdd50 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 2 Mar 2022 14:32:27 -0500 Subject: [PATCH 06/11] chore: fix wasi_sdk version --- install_deb.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install_deb.sh b/install_deb.sh index 2047334..5f32c9f 100755 --- a/install_deb.sh +++ b/install_deb.sh @@ -8,7 +8,7 @@ if [[ $ARCH = "x86_64" ]]; then SHFMT_URL=https://github.com/mvdan/sh/releases/download/v3.4.3/shfmt_v3.4.3_linux_amd64 WASI_SDK_URL=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-14/wasi-sdk_14.0_amd64.deb elif [[ $ARCH = "aarch64" ]]; then - SHFMT_URL=hhttps://github.com/patrickvane/shfmt/releases/download/master/shfmt_linux_arm + SHFMT_URL=https://github.com/patrickvane/shfmt/releases/download/master/shfmt_linux_arm echo "ARM64 support is still a work in progress!" exit 1 else @@ -64,7 +64,7 @@ wget $SHFMT_URL -O shfmt && chmod +x shfmt && sudo mv shfmt /usr/local/bin/shfmt sudo ./install_llvm.sh $LLVM_VERSION -curl -sS -L -O $WASI_SDK_URL && sudo dpkg -i wasi-sdk_12.0_amd64.deb && rm -f wasi-sdk_12.0_amd64.deb +curl -sS -L -O $WASI_SDK_URL && sudo dpkg -i wasi-sdk_14.0_amd64.deb && rm -f wasi-sdk_14.0_amd64.deb if [ -z "${WASI_SDK_PATH}" ]; then export WASI_SDK_PATH=/opt/wasi-sdk From 3d40b656cbf90fbcf3df6aa19b96906c58f0145b Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 2 Mar 2022 20:59:17 -0500 Subject: [PATCH 07/11] chore: add applications to toplevel all and clean --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0e96515..47c5e8c 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ SHELL:=/bin/bash .PHONY: all -all: awsm libsledge runtime +all: awsm libsledge runtime applications .PHONY: clean -clean: awsm.clean libsledge.clean runtime.clean +clean: awsm.clean libsledge.clean runtime.clean applications.clean .PHONY: submodules submodules: From 173a2c579da140c416663bc2ae2a05fe7ecabb09 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 2 Mar 2022 20:59:46 -0500 Subject: [PATCH 08/11] chore: downlevel to wasi-sdk-12 --- install_deb.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install_deb.sh b/install_deb.sh index 5f32c9f..90eeb4b 100755 --- a/install_deb.sh +++ b/install_deb.sh @@ -1,12 +1,12 @@ #!/bin/bash -LLVM_VERSION=13 +LLVM_VERSION=12 ARCH=$(uname -p) if [[ $ARCH = "x86_64" ]]; then SHFMT_URL=https://github.com/mvdan/sh/releases/download/v3.4.3/shfmt_v3.4.3_linux_amd64 - WASI_SDK_URL=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-14/wasi-sdk_14.0_amd64.deb + WASI_SDK_URL=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-12/wasi-sdk_12.0_amd64.deb elif [[ $ARCH = "aarch64" ]]; then SHFMT_URL=https://github.com/patrickvane/shfmt/releases/download/master/shfmt_linux_arm echo "ARM64 support is still a work in progress!" @@ -64,7 +64,7 @@ wget $SHFMT_URL -O shfmt && chmod +x shfmt && sudo mv shfmt /usr/local/bin/shfmt sudo ./install_llvm.sh $LLVM_VERSION -curl -sS -L -O $WASI_SDK_URL && sudo dpkg -i wasi-sdk_14.0_amd64.deb && rm -f wasi-sdk_14.0_amd64.deb +curl -sS -L -O $WASI_SDK_URL && sudo dpkg -i wasi-sdk_12.0_amd64.deb && rm -f wasi-sdk_12.0_amd64.deb if [ -z "${WASI_SDK_PATH}" ]; then export WASI_SDK_PATH=/opt/wasi-sdk From b551973cef0d9cbec52e80fcd832d3f7c5f29401 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 2 Mar 2022 21:00:03 -0500 Subject: [PATCH 09/11] chore: Update to clang-11 wasm args --- applications/wasm_apps | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/applications/wasm_apps b/applications/wasm_apps index f2090dd..1b5d2bf 160000 --- a/applications/wasm_apps +++ b/applications/wasm_apps @@ -1 +1 @@ -Subproject commit f2090dd25e44c77fdba1b9cc95a3a920aecb122a +Subproject commit 1b5d2bf0cb98ff501bb7d27d02b228e1a459211e From bbe1305bcc8e62fe775155840121dd1af18614a5 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 2 Mar 2022 21:53:42 -0500 Subject: [PATCH 10/11] chore: Add wasm-ld alternatives --- install_llvm.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install_llvm.sh b/install_llvm.sh index ad096f5..635031a 100755 --- a/install_llvm.sh +++ b/install_llvm.sh @@ -32,3 +32,4 @@ update-alternatives --install /usr/bin/clang++ clang++ "/usr/bin/clang++-$LLVM_V update-alternatives --install /usr/bin/llvm-config llvm-config "/usr/bin/llvm-config-$LLVM_VERSION" 100 update-alternatives --install /usr/bin/llvm-objdump llvm-objdump "/usr/bin/llvm-objdump-$LLVM_VERSION" 100 update-alternatives --install /usr/bin/clang-tidy clang-tidy "/usr/bin/clang-tidy-$LLVM_VERSION" 100 +update-alternatives --install /usr/bin/wasm-ld wasm-ld "/usr/bin/wasm-ld-$LLVM_VERSION" 100 From 434baa283f119336def23ed29d2fa2b1d248c3dc Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 2 Mar 2022 21:59:06 -0500 Subject: [PATCH 11/11] docs: prep to merge --- README.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/README.md b/README.md index e5c8671..8c00d1c 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,9 @@ ```sh git clone https://github.com/gwsystems/sledge-serverless-framework.git cd sledge-serverless-framework -git checkout validate-setup ./install_deb.sh source ~/.bashrc make install -make applications make test ```