From 699458cc99c3a01a2394bd770cf0a5a3cbca0fd2 Mon Sep 17 00:00:00 2001 From: "Alex Ellis (OpenFaaS Ltd)" Date: Sat, 21 Dec 2019 20:21:23 +0000 Subject: [PATCH] Update running instructions Signed-off-by: Alex Ellis (OpenFaaS Ltd) --- README.md | 32 ++++++++++++++++++++++++++++++-- cmd/up.go | 24 ++++++++++++------------ pkg/supervisor.go | 3 ++- 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index aa70915..c68771e 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,35 @@ Other operations are pending development in the provider. * Create [faasd.service](https://github.com/rancher/k3s/blob/master/k3s.service) -Hacking: +## Hacking + +First run faas-containerd + +```sh +cd $GOPATH/src/github.com/alexellis/faas-containerd +go build && sudo ./faas-containerd +``` + +Then run faasd, which brings up the gateway and Prometheus as containers + +```sh +cd $GOPATH/src/github.com/alexellis/faasd +go build && sudo ./faasd +``` + +Look in `hosts` in the current working folder to get the IP for the gateway or Prometheus + +```sh +127.0.0.1 localhost +172.19.0.1 faas-containerd +172.19.0.2 prometheus + +172.19.0.3 gateway +``` + +Since faas-containerd uses containerd heavily it is not running as a container, but as a stand-alone process. Its port is available via the bridge interface, i.e. netns0. + +Removing containers: ```sh echo faas-containerd gateway prometheus |xargs sudo ctr task rm -f @@ -44,4 +72,4 @@ echo faas-containerd gateway prometheus |xargs sudo ctr task rm -f echo faas-containerd gateway prometheus |xargs sudo ctr container rm echo faas-containerd gateway prometheus |xargs sudo ctr snapshot rm -``` \ No newline at end of file +``` diff --git a/cmd/up.go b/cmd/up.go index 3a9c5f2..ae237c8 100644 --- a/cmd/up.go +++ b/cmd/up.go @@ -20,18 +20,18 @@ func runUp(_ *cobra.Command, _ []string) error { wd, _ := os.Getwd() svcs := []pkg.Service{ - pkg.Service{ - Name: "faas-containerd", - Env: []string{}, - Image: "docker.io/alexellis2/faas-containerd:0.3.2", - Mounts: []pkg.Mount{ - pkg.Mount{ - Src: "/run/containerd/containerd.sock", - Dest: "/run/containerd/containerd.sock", - }, - }, - Caps: []string{"CAP_SYS_ADMIN", "CAP_NET_RAW"}, - }, + // pkg.Service{ + // Name: "faas-containerd", + // Env: []string{"snapshotter=overlayfs"}, + // Image: "docker.io/alexellis2/faas-containerd:0.3.2", + // Mounts: []pkg.Mount{ + // pkg.Mount{ + // Src: "/run/containerd/containerd.sock", + // Dest: "/run/containerd/containerd.sock", + // }, + // }, + // Caps: []string{"CAP_SYS_ADMIN", "CAP_NET_RAW"}, + // }, pkg.Service{ Name: "prometheus", Env: []string{}, diff --git a/pkg/supervisor.go b/pkg/supervisor.go index 92c19eb..ebb0dd0 100644 --- a/pkg/supervisor.go +++ b/pkg/supervisor.go @@ -49,7 +49,8 @@ func (s *Supervisor) Start(svcs []Service) error { wd, _ := os.Getwd() writeHostsErr := ioutil.WriteFile(path.Join(wd, "hosts"), - []byte(`127.0.0.1 localhost`), 0644) + []byte(`127.0.0.1 localhost +172.19.0.1 faas-containerd`), 0644) if writeHostsErr != nil { return fmt.Errorf("cannot write hosts file: %s", writeHostsErr)