Update running instructions

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (OpenFaaS Ltd)
2019-12-21 20:21:23 +00:00
parent 6cc031d40a
commit 699458cc99
3 changed files with 44 additions and 15 deletions

View File

@ -36,7 +36,35 @@ Other operations are pending development in the provider.
* Create [faasd.service](https://github.com/rancher/k3s/blob/master/k3s.service) * 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 ```sh
echo faas-containerd gateway prometheus |xargs sudo ctr task rm -f echo faas-containerd gateway prometheus |xargs sudo ctr task rm -f

View File

@ -20,18 +20,18 @@ func runUp(_ *cobra.Command, _ []string) error {
wd, _ := os.Getwd() wd, _ := os.Getwd()
svcs := []pkg.Service{ svcs := []pkg.Service{
pkg.Service{ // pkg.Service{
Name: "faas-containerd", // Name: "faas-containerd",
Env: []string{}, // Env: []string{"snapshotter=overlayfs"},
Image: "docker.io/alexellis2/faas-containerd:0.3.2", // Image: "docker.io/alexellis2/faas-containerd:0.3.2",
Mounts: []pkg.Mount{ // Mounts: []pkg.Mount{
pkg.Mount{ // pkg.Mount{
Src: "/run/containerd/containerd.sock", // Src: "/run/containerd/containerd.sock",
Dest: "/run/containerd/containerd.sock", // Dest: "/run/containerd/containerd.sock",
}, // },
}, // },
Caps: []string{"CAP_SYS_ADMIN", "CAP_NET_RAW"}, // Caps: []string{"CAP_SYS_ADMIN", "CAP_NET_RAW"},
}, // },
pkg.Service{ pkg.Service{
Name: "prometheus", Name: "prometheus",
Env: []string{}, Env: []string{},

View File

@ -49,7 +49,8 @@ func (s *Supervisor) Start(svcs []Service) error {
wd, _ := os.Getwd() wd, _ := os.Getwd()
writeHostsErr := ioutil.WriteFile(path.Join(wd, "hosts"), 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 { if writeHostsErr != nil {
return fmt.Errorf("cannot write hosts file: %s", writeHostsErr) return fmt.Errorf("cannot write hosts file: %s", writeHostsErr)