mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-20 04:56:37 +00:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
040b426a19 | |||
251cb2d08a |
@ -16,7 +16,7 @@ runcmd:
|
|||||||
- curl -sSL https://github.com/containernetworking/plugins/releases/download/v0.8.5/cni-plugins-linux-amd64-v0.8.5.tgz | tar -xz -C /opt/cni/bin
|
- curl -sSL https://github.com/containernetworking/plugins/releases/download/v0.8.5/cni-plugins-linux-amd64-v0.8.5.tgz | tar -xz -C /opt/cni/bin
|
||||||
- mkdir -p /go/src/github.com/alexellis/
|
- mkdir -p /go/src/github.com/alexellis/
|
||||||
- cd /go/src/github.com/alexellis/ && git clone https://github.com/alexellis/faasd
|
- cd /go/src/github.com/alexellis/ && git clone https://github.com/alexellis/faasd
|
||||||
- curl -fSLs "https://github.com/alexellis/faasd/releases/download/0.6.2/faasd" --output "/usr/local/bin/faasd" && chmod a+x "/usr/local/bin/faasd"
|
- curl -fSLs "https://github.com/alexellis/faasd/releases/download/0.7.0/faasd" --output "/usr/local/bin/faasd" && chmod a+x "/usr/local/bin/faasd"
|
||||||
- cd /go/src/github.com/alexellis/faasd/ && /usr/local/bin/faasd install
|
- cd /go/src/github.com/alexellis/faasd/ && /usr/local/bin/faasd install
|
||||||
- systemctl status -l containerd --no-pager
|
- systemctl status -l containerd --no-pager
|
||||||
- journalctl -u faasd-provider --no-pager
|
- journalctl -u faasd-provider --no-pager
|
||||||
|
@ -18,7 +18,10 @@ var installCmd = &cobra.Command{
|
|||||||
RunE: runInstall,
|
RunE: runInstall,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const workingDirectoryPermission = 0644
|
||||||
|
|
||||||
const faasdwd = "/var/lib/faasd"
|
const faasdwd = "/var/lib/faasd"
|
||||||
|
|
||||||
const faasdProviderWd = "/var/lib/faasd-provider"
|
const faasdProviderWd = "/var/lib/faasd-provider"
|
||||||
|
|
||||||
func runInstall(_ *cobra.Command, _ []string) error {
|
func runInstall(_ *cobra.Command, _ []string) error {
|
||||||
@ -102,7 +105,7 @@ func binExists(folder, name string) error {
|
|||||||
|
|
||||||
func ensureWorkingDir(folder string) error {
|
func ensureWorkingDir(folder string) error {
|
||||||
if _, err := os.Stat(folder); err != nil {
|
if _, err := os.Stat(folder); err != nil {
|
||||||
err = os.MkdirAll(folder, 0600)
|
err = os.MkdirAll(folder, workingDirectoryPermission)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -39,14 +39,14 @@ func runProvider(_ *cobra.Command, _ []string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
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`), workingDirectoryPermission)
|
||||||
|
|
||||||
if writeHostsErr != nil {
|
if writeHostsErr != nil {
|
||||||
return fmt.Errorf("cannot write hosts file: %s", writeHostsErr)
|
return fmt.Errorf("cannot write hosts file: %s", writeHostsErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
writeResolvErr := ioutil.WriteFile(path.Join(wd, "resolv.conf"),
|
writeResolvErr := ioutil.WriteFile(path.Join(wd, "resolv.conf"),
|
||||||
[]byte(`nameserver 8.8.8.8`), 0644)
|
[]byte(`nameserver 8.8.8.8`), workingDirectoryPermission)
|
||||||
|
|
||||||
if writeResolvErr != nil {
|
if writeResolvErr != nil {
|
||||||
return fmt.Errorf("cannot write resolv.conf file: %s", writeResolvErr)
|
return fmt.Errorf("cannot write resolv.conf file: %s", writeResolvErr)
|
||||||
|
@ -193,7 +193,7 @@ func makeFile(filePath, fileContents string) error {
|
|||||||
return nil
|
return nil
|
||||||
} else if os.IsNotExist(err) {
|
} else if os.IsNotExist(err) {
|
||||||
log.Printf("Writing to: %q\n", filePath)
|
log.Printf("Writing to: %q\n", filePath)
|
||||||
return ioutil.WriteFile(filePath, []byte(fileContents), 0644)
|
return ioutil.WriteFile(filePath, []byte(fileContents), workingDirectoryPermission)
|
||||||
} else {
|
} else {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -24,10 +24,11 @@ import (
|
|||||||
"github.com/opencontainers/runtime-spec/specs-go"
|
"github.com/opencontainers/runtime-spec/specs-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const workingDirectoryPermission = 0644
|
||||||
|
|
||||||
const defaultSnapshotter = "overlayfs"
|
const defaultSnapshotter = "overlayfs"
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// TODO: CNIBinDir and CNIConfDir should maybe be globally configurable?
|
|
||||||
// CNIBinDir describes the directory where the CNI binaries are stored
|
// CNIBinDir describes the directory where the CNI binaries are stored
|
||||||
CNIBinDir = "/opt/cni/bin"
|
CNIBinDir = "/opt/cni/bin"
|
||||||
// CNIConfDir describes the directory where the CNI plugin's configuration is stored
|
// CNIConfDir describes the directory where the CNI plugin's configuration is stored
|
||||||
@ -90,7 +91,7 @@ func (s *Supervisor) Start(svcs []Service) error {
|
|||||||
%s faas-containerd`, ip)
|
%s faas-containerd`, ip)
|
||||||
|
|
||||||
writeHostsErr := ioutil.WriteFile(path.Join(wd, "hosts"),
|
writeHostsErr := ioutil.WriteFile(path.Join(wd, "hosts"),
|
||||||
[]byte(hosts), 0644)
|
[]byte(hosts), workingDirectoryPermission)
|
||||||
|
|
||||||
if writeHostsErr != nil {
|
if writeHostsErr != nil {
|
||||||
return fmt.Errorf("cannot write hosts file: %s", writeHostsErr)
|
return fmt.Errorf("cannot write hosts file: %s", writeHostsErr)
|
||||||
@ -206,7 +207,7 @@ func (s *Supervisor) Start(svcs []Service) error {
|
|||||||
hosts = []byte(string(hosts) + fmt.Sprintf(`
|
hosts = []byte(string(hosts) + fmt.Sprintf(`
|
||||||
%s %s
|
%s %s
|
||||||
`, ip, svc.Name))
|
`, ip, svc.Name))
|
||||||
writeErr := ioutil.WriteFile("hosts", hosts, 0644)
|
writeErr := ioutil.WriteFile("hosts", hosts, workingDirectoryPermission)
|
||||||
|
|
||||||
if writeErr != nil {
|
if writeErr != nil {
|
||||||
log.Printf("Error writing file %s %s\n", "hosts", writeErr)
|
log.Printf("Error writing file %s %s\n", "hosts", writeErr)
|
||||||
|
Reference in New Issue
Block a user