diff --git a/Makefile b/Makefile index fe29f3d..86f8e6c 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,6 @@ Version := $(shell git describe --tags --dirty) GitCommit := $(shell git rev-parse HEAD) LDFLAGS := "-s -w -X main.Version=$(Version) -X main.GitCommit=$(GitCommit)" CONTAINERD_VER := 1.3.2 -FAASC_VER := 0.4.0 CNI_VERSION := v0.8.4 ARCH := amd64 @@ -27,12 +26,11 @@ prepare-test: sudo /sbin/sysctl -w net.ipv4.conf.all.forwarding=1 sudo mkdir -p /opt/cni/bin curl -sSL https://github.com/containernetworking/plugins/releases/download/$(CNI_VERSION)/cni-plugins-linux-$(ARCH)-$(CNI_VERSION).tgz | sudo tar -xz -C /opt/cni/bin - sudo curl -sSLf "https://github.com/alexellis/faas-containerd/releases/download/$(FAASC_VER)/faas-containerd" --output "/usr/local/bin/faas-containerd" && sudo chmod a+x "/usr/local/bin/faas-containerd" || : sudo cp $(GOPATH)/src/github.com/alexellis/faasd/bin/faasd /usr/local/bin/ cd $(GOPATH)/src/github.com/alexellis/faasd/ && sudo /usr/local/bin/faasd install sudo systemctl status -l containerd --no-pager - sudo journalctl -u faas-containerd --no-pager - sudo systemctl status -l faas-containerd --no-pager + sudo journalctl -u faasd-provider --no-pager + sudo systemctl status -l faasd-provider --no-pager sudo systemctl status -l faasd --no-pager curl -sSLf https://cli.openfaas.com | sudo sh sleep 120 && sudo journalctl -u faasd --no-pager diff --git a/README.md b/README.md index e4c1747..a8cea06 100644 --- a/README.md +++ b/README.md @@ -78,10 +78,6 @@ You can run this tutorial on your Raspberry Pi, or adapt the steps for a regular Install the CNI plugins: -```sh -export CNI_VERSION=v0.8.4 -``` - * For PC run `export ARCH=amd64` * For RPi/armhf run `export ARCH=arm` * For arm64 run `export ARCH=arm64` @@ -89,8 +85,9 @@ export CNI_VERSION=v0.8.4 Then run: ```sh -mkdir -p /opt/cni/bin -curl -sSL https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-linux-${ARCH}-${CNI_VERSION}.tgz | tar -xz -C /opt/cni/bin +export CNI_VERSION=v0.8.4 +sudo mkdir -p /opt/cni/bin +curl -sSL https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-linux-${ARCH}-${CNI_VERSION}.tgz | sudo tar -xz -C /opt/cni/bin ``` First run faas-containerd diff --git a/cmd/install.go b/cmd/install.go index ebecbf0..669934c 100644 --- a/cmd/install.go +++ b/cmd/install.go @@ -19,7 +19,7 @@ var installCmd = &cobra.Command{ } const faasdwd = "/run/faasd" -const faasContainerdwd = "/run/faas-containerd" +const faasdProviderWd = "/run/faasd-provider" func runInstall(_ *cobra.Command, _ []string) error { @@ -27,7 +27,7 @@ func runInstall(_ *cobra.Command, _ []string) error { return err } - if err := ensureWorkingDir(faasContainerdwd); err != nil { + if err := ensureWorkingDir(faasdProviderWd); err != nil { return err } @@ -43,18 +43,13 @@ func runInstall(_ *cobra.Command, _ []string) error { return err } - err := binExists("/usr/local/bin/", "faas-containerd") + err := binExists("/usr/local/bin/", "faasd") if err != nil { return err } - err = binExists("/usr/local/bin/", "faasd") - if err != nil { - return err - } - - err = systemd.InstallUnit("faas-containerd", map[string]string{ - "Cwd": faasContainerdwd, + err = systemd.InstallUnit("faasd-provider", map[string]string{ + "Cwd": faasdProviderWd, "SecretMountPath": path.Join(faasdwd, "secrets")}) if err != nil { @@ -71,7 +66,7 @@ func runInstall(_ *cobra.Command, _ []string) error { return err } - err = systemd.Enable("faas-containerd") + err = systemd.Enable("faasd-provider") if err != nil { return err } @@ -81,7 +76,7 @@ func runInstall(_ *cobra.Command, _ []string) error { return err } - err = systemd.Start("faas-containerd") + err = systemd.Start("faasd-provider") if err != nil { return err } @@ -91,6 +86,9 @@ func runInstall(_ *cobra.Command, _ []string) error { return err } + fmt.Println(`Login with: + sudo cat /run/faasd/secrets/basic-auth-password | faas-cli login -s`) + return nil } diff --git a/hack/faas-containerd.service b/hack/faasd-provider.service similarity index 89% rename from hack/faas-containerd.service rename to hack/faasd-provider.service index 61447a5..4c2b053 100644 --- a/hack/faas-containerd.service +++ b/hack/faasd-provider.service @@ -1,5 +1,5 @@ [Unit] -Description=faasd-containerd +Description=faasd-provider [Service] MemoryLimit=500M