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: diff --git a/README.md b/README.md index 246ff44..8c00d1c 100644 --- a/README.md +++ b/README.md @@ -2,25 +2,25 @@ **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 +./install_deb.sh +source ~/.bashrc +make install +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: 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 diff --git a/install_deb.sh b/install_deb.sh index 82abbb7..90eeb4b 100755 --- a/install_deb.sh +++ b/install_deb.sh @@ -1,33 +1,76 @@ #!/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 -apt-get update && apt-get install -y --no-install-recommends \ +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-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!" + 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 \ + man-db \ + && yes | unminimize + +sudo apt-get update && sudo 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 \ + hey \ + httpie \ imagemagick \ jq \ + less \ + libssl-dev \ + libtinfo5 \ + libtool \ libz3-4 \ + lsb-release \ + make \ netpbm \ + openssh-client \ pango1.0-tools \ - wamerican - -wget $HEY_URL -O hey && chmod +x hey && sudo mv hey /usr/bin/hey + pkg-config \ + shellcheck \ + software-properties-common \ + strace \ + valgrind \ + wabt \ + wamerican \ + wget 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 -./install_llvm.sh $LLVM_VERSION +if [ -z "${WASI_SDK_PATH}" ]; then + export WASI_SDK_PATH=/opt/wasi-sdk + echo "export WASI_SDK_PATH=/opt/wasi-sdk" >> ~/.bashrc +fi -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 | 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'" 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