Last active
January 16, 2020 08:44
-
-
Save rbekker87/932249d1bc0281021281fa3ab5d5d98d to your computer and use it in GitHub Desktop.
OpenFaas on Containerd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
export ARCH="amd64" | |
export CNI_ARCH="linux-amd64" | |
export GO_VERSION="1.12.14" | |
export CNI_VERSION="0.8.2" | |
export GOPATH=$HOME/go/ | |
export PATH=$PATH:/usr/local/go/bin/ | |
apt update | |
apt install pkg-config runc bridge-utils tmux git build-essential libblockdev-btrfs-dev libseccomp-dev -y | |
curl -SLsf https://dl.google.com/go/go$GO_VERSION.linux-$ARCH.tar.gz -o /tmp/go.tgz | |
rm -rf /usr/local/go | |
mkdir -p /usr/local/go | |
tar -xf /tmp/go.tgz -C /usr/local/go/ --strip-components=1 | |
go version | |
sleep 2 | |
curl -sLfS https://cli.openfaas.com | sh | |
mkdir -p $GOPATH/src/github.com/containerd | |
cd $GOPATH/src/github.com/containerd | |
git clone https://github.com/containerd/containerd | |
cd containerd | |
git fetch origin --tags | |
git checkout v1.3.2 | |
make | |
make install | |
containerd --version | |
sleep 2 | |
curl -SLfs https://raw.githubusercontent.com/containerd/containerd/v1.3.2/containerd.service | tee /etc/systemd/system/containerd.service | |
systemctl enable containerd | |
systemctl start containerd | |
sleep 5 | |
modprobe br_netfilter | |
sysctl net.bridge.bridge-nf-call-iptables=1 | |
echo "br_netfilter" | tee -a /etc/modules-load.d/modules.conf | |
echo "net.bridge.bridge-nf-call-iptables=1" | tee -a /etc/sysctl.conf | |
curl -fSLs https://github.com/genuinetools/netns/releases/download/v0.5.3/netns-linux-amd64 -o /usr/local/bin/netns | |
chmod a+x /usr/local/bin/netns | |
mkdir -p /opt/cni/bin | |
curl -sSL https://github.com/containernetworking/plugins/releases/download/v$CNI_VERSION/cni-plugins-$CNI_ARCH-v$CNI_VERSION.tgz | tar -xz -C /opt/cni/bin | |
sysctl -w net.ipv4.conf.all.forwarding=1 | |
echo "net.ipv4.conf.all.forwarding=1" | sudo tee -a /etc/sysctl.conf | |
curl -sSLf https://github.com/alexellis/faas-containerd/releases/download/0.4.0/faas-containerd -o /usr/local/bin/faas-containerd | |
curl -sSLf https://github.com/alexellis/faasd/releases/download/0.4.4/faasd -o /usr/local/bin/faasd | |
chmod a+x /usr/local/bin/faas* | |
cd $GOPATH/src/github.com/alexellis | |
git clone https://github.com/alexellis/faasd | |
cd faasd | |
faasd install | |
systemctl status faasd | |
systemctl status faas-containerd | |
sleep 5 | |
export OPENFAAS_URL=http://127.0.0.1:8080 | |
cat /run/faasd/secrets/basic-auth-password | faas-cli login --password-stdin | |
sleep 2 | |
faas-cli store list --platform x86_64 | |
faas-cli store deploy --platform x86_64 figlet | |
faas-cli store describe figlet | |
sleep 10 | |
echo "faasd" | faas-cli invoke figlet |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment