[docs] Add tutorial to execute the first function on Teaclave
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 65749d2..c5df00d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,7 +6,6 @@
include(ExternalProject)
find_package(Git)
find_package(OpenSSL)
-init_submodules()
check_exe_dependencies(rustup pypy)
# ====== VARIABLES FOR CMAKE -D{VAR}=VAL CONFIGURATION BEGIN ======
@@ -22,6 +21,7 @@
option(SGX_SIM_MODE "Turn on/off sgx simulation mode" OFF)
option(DCAP "Turn on/off DCAP attestation" OFF)
option(GIT_SUBMODULE "Check submodules during build" ON)
+init_submodules()
if(DCAP)
set(RUSTFLAGS "${RUSTFLAGS} --cfg dcap")
diff --git a/README.md b/README.md
index 35f7e0d..8536cee 100644
--- a/README.md
+++ b/README.md
@@ -28,6 +28,12 @@
Components in Teaclave are designed in modular, and can be easily embedded in
other projects.
+## Getting Started
+
+### Try Teaclave
+
+- [My First Function](docs/my-first-function.md)
+
## Contributing
Teaclave is open source in [The Apache Way](https://www.apache.org/theapacheway/),
diff --git a/cmake/TeaclaveGenVars.cmake b/cmake/TeaclaveGenVars.cmake
index 726b905..d50c3b2 100644
--- a/cmake/TeaclaveGenVars.cmake
+++ b/cmake/TeaclaveGenVars.cmake
@@ -65,7 +65,10 @@
set(SGX_ENCLAVE_FEATURES -Z package-features --features mesalock_sgx)
string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_LOWER)
-if(CMAKE_BUILD_TYPE_LOWER STREQUAL "debug")
+if(CMAKE_BUILD_TYPE_LOWER STREQUAL "release")
+ set(TARGET release)
+ set(CARGO_BUILD_FLAGS --release)
+else()
set(TARGET debug)
set(CARGO_BUILD_FLAGS "")
@@ -76,9 +79,6 @@
set(RUSTFLAGS "${RUSTFLAGS} -D warnings -Zprofile -Ccodegen-units=1 \
-Cllvm_args=-inline-threshold=0 -Coverflow-checks=off -Zno-landing-pads")
endif()
-else()
- set(TARGET release)
- set(CARGO_BUILD_FLAGS --release)
endif()
if(OFFLINE)
@@ -148,5 +148,5 @@
message("SGX_MODE=${SGX_MODE}")
message("RUSTUP_TOOLCHAIN=${RUSTUP_TOOLCHAIN}")
message("DCAP=${DCAP}")
-message("BUILD TYPE=${TARGET}")
+message("BUILD_TYPE=${TARGET}")
message("TEACLAVE_SYMLINKS=${TEACLAVE_SYMLINKS}")
diff --git a/cmake/scripts/prep.sh b/cmake/scripts/prep.sh
index 47628dd..3d08a2d 100755
--- a/cmake/scripts/prep.sh
+++ b/cmake/scripts/prep.sh
@@ -78,7 +78,7 @@
done
}
-# check
+# check
for edl in ${TEACLAVE_EDL_DIR}/*.edl
do
fname=$(basename "${edl}" .edl)
diff --git a/docker/README.md b/docker/README.md
index 24f279e..37a64be 100644
--- a/docker/README.md
+++ b/docker/README.md
@@ -51,8 +51,8 @@
Here is an example to start all services.
```
-$ export AS_SPID="xxx"
-$ export AS_KEY="xxx"
+$ export AS_SPID="00000000000000000000000000000000"
+$ export AS_KEY="00000000000000000000000000000000"
$ export AS_ALGO="sgx_epid"
$ export AS_URL="https://api.trustedservices.intel.com:443"
diff --git a/docker/runtime.config.toml b/docker/runtime.config.toml
index 1a9cfa7..a678642 100644
--- a/docker/runtime.config.toml
+++ b/docker/runtime.config.toml
@@ -29,3 +29,6 @@
url = "https://api.trustedservices.intel.com:443"
key = "00000000000000000000000000000000"
spid = "00000000000000000000000000000000"
+
+[mount]
+fusion_base_dir = "/tmp/fusion_data"
diff --git a/docs/my-first-function.md b/docs/my-first-function.md
new file mode 100644
index 0000000..94ff01a
--- /dev/null
+++ b/docs/my-first-function.md
@@ -0,0 +1,68 @@
+# My First Function
+
+This documentation will guide you through executing your first function on the
+Teaclave platform.
+
+## Prerequisites
+
+To run Teacalve, a hardware with Intel SGX support is needed. You can
+check with this list of [supported hardware](https://github.com/ayeks/SGX-hardware).
+Note that you need to configure BIOS to enable SGX sometime. Additionally, you
+need to install driver and platform software to run SGX applications. Details
+can found in
+[Intel SGX Installation Guide](https://download.01.org/intel-sgx/sgx-linux/2.9/docs/Intel_SGX_Installation_Guide_Linux_2.9_Open_Source.pdf).
+
+If you don't have an SGX supported hardware at hand, Teaclave can also run in
+simulation mode. However some functions like remote attestation will be disable
+at this mode.
+
+## Clone and Build Teaclave
+
+Clone the Teaclave repository:
+
+```
+$ git clone https://github.com/apache/incubator-teaclave.git
+```
+
+Since the building dependencies is a bit complicated, we suggest to build the
+Teaclave platform with our docker images. You can learn more details about the
+building environment from `Dockerfile` under the [`docker`](../docker)
+directory.
+
+Build the Teaclave platform using docker:
+
+```
+$ cd incubator-teaclave
+$ docker run --rm -v $(pwd):/teaclave -w /teaclave \
+ -it teaclave/teaclave-build-ubuntu-1804-sgx-2.9:latest \
+ bash -c ". /root/.cargo/env && \
+ mkdir -p build && cd build && \
+ cmake -DTEST_MODE=ON .. && \
+ make"
+```
+
+To build in simulation mode, you can add `-DSGX_SIM_MODE=ON` to `cmake`.
+
+### Launch Teaclave
+
+Teaclave contains multiple services. To ease the deployment, you can use
+[docker-compose](https://docs.docker.com/compose/) to manage all services in a
+containerized environment.
+
+Launch all services with `docker-compose`:
+
+```
+$ export AS_SPID="00000000000000000000000000000000"
+$ export AS_KEY="00000000000000000000000000000000"
+$ export AS_ALGO="sgx_epid"
+$ export AS_URL="https://api.trustedservices.intel.com:443"
+
+$ (cd docker && docker-compose -f docker-compose-ubuntu-1804.yml up --build)
+Starting teaclave-authentication-service ... done
+Starting teaclave-access-control-service ... done
+Starting teaclave-scheduler-service ... done
+Starting teaclave-management-service ... done
+Starting teaclave-execution-service ... done
+Starting teaclave-frontend-service ... done
+Attaching to ...
+```