1+ #! /usr/bin/env bash
2+
3+ set -e
4+
5+ echo " [LOG] Starting containerd and Wasm setup..."
6+
7+ # Step 1: Install containerd
8+ echo " [LOG] Installing containerd..."
9+
10+ CONTAINERD_VERSION=" 2.0.0"
11+ ARCH=$( uname -m)
12+
13+ case " $ARCH " in
14+ x86_64)
15+ CONTAINERD_ARCH=" amd64"
16+ SHIM_ARCH=" x86_64"
17+ ;;
18+ aarch64|arm64)
19+ CONTAINERD_ARCH=" arm64"
20+ SHIM_ARCH=" aarch64"
21+ ;;
22+ * )
23+ echo " [ERROR] Unsupported architecture: $ARCH "
24+ exit 1
25+ ;;
26+ esac
27+
28+ echo " [LOG] Detected architecture: $ARCH "
29+
30+ # Download and install containerd
31+ echo " [LOG] Downloading containerd ${CONTAINERD_VERSION} ..."
32+ curl -LO " https://github.com/containerd/containerd/releases/download/v${CONTAINERD_VERSION} /containerd-${CONTAINERD_VERSION} -linux-${CONTAINERD_ARCH} .tar.gz"
33+
34+ echo " [LOG] Extracting containerd to /usr/local..."
35+ sudo tar Cxzvf /usr/local " containerd-${CONTAINERD_VERSION} -linux-${CONTAINERD_ARCH} .tar.gz"
36+
37+ # Download and install containerd systemd service
38+ echo " [LOG] Installing containerd systemd service..."
39+ sudo mkdir -p /usr/local/lib/systemd/system
40+ sudo curl -L " https://raw.githubusercontent.com/containerd/containerd/main/containerd.service" \
41+ -o /usr/local/lib/systemd/system/containerd.service
42+
43+ # Reload systemd and enable containerd
44+ echo " [LOG] Enabling and starting containerd service..."
45+ sudo systemctl daemon-reload
46+ sudo systemctl enable containerd
47+ sudo systemctl start containerd
48+
49+ # Step 2: Install Wasmtime shim
50+ echo " [LOG] Installing Wasmtime containerd shim..."
51+
52+ SHIM_VERSION=" v0.5.0"
53+ SHIM_BASE_URL=" https://github.com/containerd/runwasi/releases/download/containerd-shim-wasmtime%2F${SHIM_VERSION} "
54+ SHIM_FILENAME=" containerd-shim-wasmtime-${SHIM_ARCH} -linux-musl.tar.gz"
55+
56+ echo " [LOG] Downloading $SHIM_FILENAME ..."
57+ curl -LO " $SHIM_BASE_URL /$SHIM_FILENAME "
58+
59+ echo " [LOG] Extracting $SHIM_FILENAME ..."
60+ tar -xzf " $SHIM_FILENAME "
61+
62+ echo " [LOG] Installing containerd-shim-wasmtime-v1 to /usr/local/bin..."
63+ chmod +x containerd-shim-wasmtime-v1
64+ sudo install containerd-shim-wasmtime-v1 /usr/local/bin/
65+
66+ # Step 3: Cleanup
67+ echo " [LOG] Cleaning up downloaded files..."
68+ rm -rf containerd-*
69+
70+ # Step 4: Verify installation
71+ echo " [LOG] Verifying installation..."
72+ sudo systemctl status containerd --no-pager
73+ which containerd-shim-wasmtime-v1
74+
75+ echo " [LOG] Setup complete! Containerd and Wasmtime shim are installed and running."
0 commit comments