Switch data directory to /var/lib/faasd

Fix: #26

Tested e2e on Ubuntu with `x86_64`

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis (OpenFaaS Ltd) 2020-01-21 16:54:20 +00:00 committed by Alex Ellis
parent f09028e451
commit c133b9c4ab
4 changed files with 18 additions and 18 deletions

View File

@ -37,7 +37,7 @@ prepare-test:
.PHONY: test-e2e .PHONY: test-e2e
test-e2e: test-e2e:
sudo cat /run/faasd/secrets/basic-auth-password | /usr/local/bin/faas-cli login --password-stdin sudo cat /var/lib/faasd/secrets/basic-auth-password | /usr/local/bin/faas-cli login --password-stdin
/usr/local/bin/faas-cli store deploy figlet --env write_timeout=1s --env read_timeout=1s /usr/local/bin/faas-cli store deploy figlet --env write_timeout=1s --env read_timeout=1s
sleep 2 sleep 2
/usr/local/bin/faas-cli list -v /usr/local/bin/faas-cli list -v

View File

@ -75,7 +75,7 @@ Done:
* [x] Clear / remove containers and tasks with SIGTERM / SIGINT * [x] Clear / remove containers and tasks with SIGTERM / SIGINT
* [x] Determine armhf/arm64 containers to run for gateway * [x] Determine armhf/arm64 containers to run for gateway
* [x] Configure `basic_auth` to protect the OpenFaaS gateway and faasd-provider HTTP API * [x] Configure `basic_auth` to protect the OpenFaaS gateway and faasd-provider HTTP API
* [x] Setup custom working directory for faasd `/run/faasd/` * [x] Setup custom working directory for faasd `/var/lib/faasd/`
* [x] Use CNI to create network namespaces and adapters * [x] Use CNI to create network namespaces and adapters
## Tutorial: Get started on armhf / Raspberry Pi ## Tutorial: Get started on armhf / Raspberry Pi
@ -134,7 +134,7 @@ sudo curl -fSLs "https://github.com/alexellis/faasd/releases/download/0.4.4/faas
### At run-time ### At run-time
Look in `hosts` in the current working folder or in `/run/faasd/` to get the IP for the gateway or Prometheus Look in `hosts` in the current working folder or in `/var/lib/faasd/` to get the IP for the gateway or Prometheus
```sh ```sh
127.0.0.1 localhost 127.0.0.1 localhost
@ -158,8 +158,8 @@ Since faasd-provider uses containerd heavily it is not running as a container, b
* basic-auth * basic-auth
You will then need to get the basic-auth password, it is written to `/run/faasd/secrets/basic-auth-password` if you followed the above instructions. You will then need to get the basic-auth password, it is written to `/var/lib/faasd/secrets/basic-auth-password` if you followed the above instructions.
The default Basic Auth username is `admin`, which is written to `/run/faasd/secrets/basic-auth-user`, if you wish to use a non-standard user then create this file and add your username (no newlines or other characters) The default Basic Auth username is `admin`, which is written to `/var/lib/faasd/secrets/basic-auth-user`, if you wish to use a non-standard user then create this file and add your username (no newlines or other characters)
#### Installation with systemd #### Installation with systemd

View File

@ -18,8 +18,8 @@ var installCmd = &cobra.Command{
RunE: runInstall, RunE: runInstall,
} }
const faasdwd = "/run/faasd" const faasdwd = "/var/lib/faasd"
const faasdProviderWd = "/run/faasd-provider" const faasdProviderWd = "/var/lib/faasd-provider"
func runInstall(_ *cobra.Command, _ []string) error { func runInstall(_ *cobra.Command, _ []string) error {
@ -87,7 +87,7 @@ func runInstall(_ *cobra.Command, _ []string) error {
} }
fmt.Println(`Login with: fmt.Println(`Login with:
sudo cat /run/faasd/secrets/basic-auth-password | faas-cli login -s`) sudo cat /var/lib/faasd/secrets/basic-auth-password | faas-cli login -s`)
return nil return nil
} }

View File

@ -53,7 +53,7 @@ var defaultCNIConf = fmt.Sprintf(`
} }
`, pkg.DefaultNetworkName, pkg.DefaultBridgeName, pkg.DefaultSubnet) `, pkg.DefaultNetworkName, pkg.DefaultBridgeName, pkg.DefaultSubnet)
const secretMountDir = "/run/secrets" const containerSecretMountDir = "/run/secrets"
func runUp(_ *cobra.Command, _ []string) error { func runUp(_ *cobra.Command, _ []string) error {
@ -208,18 +208,18 @@ func makeServiceDefinitions(archSuffix string) []pkg.Service {
Image: "docker.io/openfaas/basic-auth-plugin:0.18.10" + archSuffix, Image: "docker.io/openfaas/basic-auth-plugin:0.18.10" + archSuffix,
Env: []string{ Env: []string{
"port=8080", "port=8080",
"secret_mount_path=" + secretMountDir, "secret_mount_path=" + containerSecretMountDir,
"user_filename=basic-auth-user", "user_filename=basic-auth-user",
"pass_filename=basic-auth-password", "pass_filename=basic-auth-password",
}, },
Mounts: []pkg.Mount{ Mounts: []pkg.Mount{
pkg.Mount{ pkg.Mount{
Src: path.Join(path.Join(wd, "secrets"), "basic-auth-password"), Src: path.Join(path.Join(wd, "secrets"), "basic-auth-password"),
Dest: path.Join(secretMountDir, "basic-auth-password"), Dest: path.Join(containerSecretMountDir, "basic-auth-password"),
}, },
pkg.Mount{ pkg.Mount{
Src: path.Join(path.Join(wd, "secrets"), "basic-auth-user"), Src: path.Join(path.Join(wd, "secrets"), "basic-auth-user"),
Dest: path.Join(secretMountDir, "basic-auth-user"), Dest: path.Join(containerSecretMountDir, "basic-auth-user"),
}, },
}, },
Caps: []string{"CAP_NET_RAW"}, Caps: []string{"CAP_NET_RAW"},
@ -257,18 +257,18 @@ func makeServiceDefinitions(archSuffix string) []pkg.Service {
"faas_nats_port=4222", "faas_nats_port=4222",
"auth_proxy_url=http://basic-auth-plugin:8080/validate", "auth_proxy_url=http://basic-auth-plugin:8080/validate",
"auth_proxy_pass_body=false", "auth_proxy_pass_body=false",
"secret_mount_path=" + secretMountDir, "secret_mount_path=" + containerSecretMountDir,
"scale_from_zero=true", "scale_from_zero=true",
}, },
Image: "docker.io/openfaas/gateway:0.18.8" + archSuffix, Image: "docker.io/openfaas/gateway:0.18.8" + archSuffix,
Mounts: []pkg.Mount{ Mounts: []pkg.Mount{
pkg.Mount{ pkg.Mount{
Src: path.Join(path.Join(wd, "secrets"), "basic-auth-password"), Src: path.Join(path.Join(wd, "secrets"), "basic-auth-password"),
Dest: path.Join(secretMountDir, "basic-auth-password"), Dest: path.Join(containerSecretMountDir, "basic-auth-password"),
}, },
pkg.Mount{ pkg.Mount{
Src: path.Join(path.Join(wd, "secrets"), "basic-auth-user"), Src: path.Join(path.Join(wd, "secrets"), "basic-auth-user"),
Dest: path.Join(secretMountDir, "basic-auth-user"), Dest: path.Join(containerSecretMountDir, "basic-auth-user"),
}, },
}, },
Caps: []string{"CAP_NET_RAW"}, Caps: []string{"CAP_NET_RAW"},
@ -284,17 +284,17 @@ func makeServiceDefinitions(archSuffix string) []pkg.Service {
"max_inflight=1", "max_inflight=1",
"write_debug=false", "write_debug=false",
"basic_auth=true", "basic_auth=true",
"secret_mount_path=" + secretMountDir, "secret_mount_path=" + containerSecretMountDir,
}, },
Image: "docker.io/openfaas/queue-worker:0.9.0", Image: "docker.io/openfaas/queue-worker:0.9.0",
Mounts: []pkg.Mount{ Mounts: []pkg.Mount{
pkg.Mount{ pkg.Mount{
Src: path.Join(path.Join(wd, "secrets"), "basic-auth-password"), Src: path.Join(path.Join(wd, "secrets"), "basic-auth-password"),
Dest: path.Join(secretMountDir, "basic-auth-password"), Dest: path.Join(containerSecretMountDir, "basic-auth-password"),
}, },
pkg.Mount{ pkg.Mount{
Src: path.Join(path.Join(wd, "secrets"), "basic-auth-user"), Src: path.Join(path.Join(wd, "secrets"), "basic-auth-user"),
Dest: path.Join(secretMountDir, "basic-auth-user"), Dest: path.Join(containerSecretMountDir, "basic-auth-user"),
}, },
}, },
Caps: []string{"CAP_NET_RAW"}, Caps: []string{"CAP_NET_RAW"},