openfaas / ofc-bootstrap

Bootstrap OpenFaaS Cloud for your team
https://docs.openfaas.com/openfaas-cloud/intro/
MIT License
179 stars 61 forks source link

Blog post about setting up for localdev can not be completed #239

Open LucasRoesler opened 3 years ago

LucasRoesler commented 3 years ago

I am working through the steps documented in https://blog.alexellis.io/openfaas-cloud-for-development/ but can not complete the installation

  1. get.sh script is incorrect, this is fixed with https://github.com/openfaas/ofc-bootstrap/pull/238
  2. the blog post references a screenshot during the Github App setup that does not exist anymore, the values are output to stdout
  3. if the ofc-bootstrap is going to print to stdout, it would be nicer to have the option to just output to a file
  4. After the invalid screenshot there is a section about copyingn and editing the example init, this seems to be redundant because ofc-bootstrap will accept multiple files, the user should just create an init.yaml with only the edited values.
  5. there is a very confusing instruction that I don't know how to follow

    Set the value for your registry, use your Docker Hub account

  6. because of the above, i can not finish the installation process because of the following error
    ofc-bootstrap apply -f example.init.yaml -f init.yaml
    2020/12/05 16:23:57 Loading 2 plans
    2020/12/05 16:23:57 example.init.yaml loaded
    2020/12/05 16:23:57 init.yaml loaded
    https://get.helm.sh/helm-v3.0.2-linux-amd64.tar.gz
    /home/lucas/.k3sup/bin/helm3/linux-amd64 linux-amd64/
    /home/lucas/.k3sup/bin/helm3/README.md linux-amd64/README.md
    /home/lucas/.k3sup/bin/helm3/LICENSE linux-amd64/LICENSE
    /home/lucas/.k3sup/bin/helm3/helm linux-amd64/helm
    2020/12/05 16:23:59 extracted tarball into /home/lucas/.k3sup/bin/helm3: 3 files, 0 dirs (429.396628ms)
    2020/12/05 16:23:59 helm3 at: /home/lucas/.k3sup/bin/helm3
    2020/12/05 16:23:59 Validating tools available in PATH: "/home/lucas/.k3sup/bin/helm3:/home/lucas/.oh-my-zsh/custom/plugins/git-open:/home/lucas/go/bin:/home/lucas/.local/go/bin:/home/lucas/.local/bin:/home/lucas/go/bin:/home/lucas/.local/go/bin:/home/lucas/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
    Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.4", GitCommit:"d360454c9bcd1634cf4cc52d1867af5491dc9c5f", GitTreeState:"clean", BuildDate:"2020-11-11T13:17:17Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}
    OpenSSL 1.1.1f  31 Mar 2020
    version.BuildInfo{Version:"v3.0.2", GitCommit:"19e47ee3283ae98139d98460de796c1be1e3975f", GitTreeState:"clean", GoVersion:"go1.13.5"}
    ___                   _____           ____
    / _ \ _ __   ___ _ __ |  ___|_ _  __ _/ ___|
    | | | | '_ \ / _ \ '_ \| |_ / _` |/ _` \___ \
    | |_| | |_) |  __/ | | |  _| (_| | (_| |___) |
    \___/| .__/ \___|_| |_|_|  \__,_|\__,_|____/
        |_|
    CLI:
    commit:  fd0651a9907103d03649ef8ad1e2816576d8863a-dirty
    version: 0.12.19-1-gfd0651a9
    Your faas-cli version (0.12.19-1-gfd0651a9) may be out of date. Version: 0.12.19 is now available on GitHub.
    panic: stat ./credentials/config.json: no such file or directory
    goroutine 1 [running]:
    github.com/openfaas-incubator/ofc-bootstrap/cmd.runApplyCommandE(0xc9f240, 0xc000032600, 0x0, 0x4, 0x0, 0x0)
        /go/src/github.com/openfaas-incubator/ofc-bootstrap/cmd/apply.go:153 +0x13ab
    github.com/spf13/cobra.(*Command).execute(0xc9f240, 0xc0000325c0, 0x4, 0x4, 0xc9f240, 0xc0000325c0)
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:826 +0x460
    github.com/spf13/cobra.(*Command).ExecuteC(0xc9f9c0, 0x43b85a, 0xc635e0, 0xc000054750)
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914 +0x2fb
    github.com/spf13/cobra.(*Command).Execute(...)
        /go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
    github.com/openfaas-incubator/ofc-bootstrap/cmd.Execute(0x9952c8, 0x5, 0x9a91e0, 0x28, 0x84c140, 0xc000026118)
        /go/src/github.com/openfaas-incubator/ofc-bootstrap/cmd/root.go:72 +0x77
    main.main()
        /go/src/github.com/openfaas-incubator/ofc-bootstrap/main.go:13 +0x51

    my best guess is that i can edit the yaml file to point at ~/.docker/config.json

  7. It appears the ofc-bootstrap must be run inside the root of the ofc-bootstrap project, this is not clear or noted in blog post. I was running the command in a sandbox folder and got this error

    ofc-bootstrap apply -f example.init.yaml -f init.yaml
    2020/12/05 16:50:33 Loading 2 plans
    2020/12/05 16:50:33 example.init.yaml loaded
    2020/12/05 16:50:33 init.yaml loaded
    2020/12/05 16:50:33 helm3 at: /home/lucas/.k3sup/bin/helm3
    2020/12/05 16:50:33 Validating tools available in PATH: "/home/lucas/.k3sup/bin/helm3:/home/lucas/.oh-my-zsh/custom/plugins/git-open:/home/lucas/go/bin:/home/lucas/.local/go/bin:/home/lucas/.local/bin:/home/lucas/go/bin:/home/lucas/.local/go/bin:/home/lucas/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"
    Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.4", GitCommit:"d360454c9bcd1634cf4cc52d1867af5491dc9c5f", GitTreeState:"clean", BuildDate:"2020-11-11T13:17:17Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}
    OpenSSL 1.1.1f  31 Mar 2020
    version.BuildInfo{Version:"v3.0.2", GitCommit:"19e47ee3283ae98139d98460de796c1be1e3975f", GitTreeState:"clean", GoVersion:"go1.13.5"}
    ___                   _____           ____
    / _ \ _ __   ___ _ __ |  ___|_ _  __ _/ ___|
    | | | | '_ \ / _ \ '_ \| |_ / _` |/ _` \___ \
    | |_| | |_) |  __/ | | |  _| (_| | (_| |___) |
    \___/| .__/ \___|_| |_|_|  \__,_|\__,_|____/
        |_|
    
    CLI:
    commit:  fd0651a9907103d03649ef8ad1e2816576d8863a-dirty
    version: 0.12.19-1-gfd0651a9
    Your faas-cli version (0.12.19-1-gfd0651a9) may be out of date. Version: 0.12.19 is now available on GitHub.
    Plan loaded from: [example.init.yaml init.yaml]
    Validating registry credentials file2020/12/05 16:50:33 Creating namespaces
    /bin/bash: scripts/create-namespaces.sh: No such file or directory
    2020/12/05 16:50:33 127  /bin/bash: scripts/create-namespaces.sh: No such file or directory
    
    2020/12/05 16:50:33 Adding stable helm repo
    "stable" has been added to your repositories
    2020/12/05 16:50:35 Updating helm repos
    Hang tight while we grab the latest from your chart repositories...
    ...Successfully got an update from the "inlets" chart repository
    ...Successfully got an update from the "contiamo-public" chart repository
    ...Successfully got an update from the "stable" chart repository
    Update Complete. ⎈ Happy Helming!⎈ 
    2020/12/05 16:50:36 Creating Ingress Controller
    /bin/bash: scripts/install-nginx.sh: No such file or directory
    2020/12/05 16:50:36 127  /bin/bash: scripts/install-nginx.sh: No such file or directory
    
    Creating secret: s3-secret-key
    fork/exec scripts/generate-sha.sh: no such file or directory
  8. after moving to the ofc-bootstrap root folder, the command finished without errors, but i don't have any idea what to do based on the blog post image but when i run the svc command, i don't have a public ip
    kubectl get svc
    NAME         TYPE        CLUSTER-IP   EXTERNAL-IP   PORT(S)   AGE
    kubernetes   ClusterIP   10.43.0.1    <none>        443/TCP   122m

    It specifically mentions nginx, but i don't have any nginx SVCs running

    kubectl get svc -A
    NAMESPACE     NAME                  TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                  AGE
    default       kubernetes            ClusterIP   10.43.0.1       <none>        443/TCP                  124m
    kube-system   kube-dns              ClusterIP   10.43.0.10      <none>        53/UDP,53/TCP,9153/TCP   124m
    kube-system   metrics-server        ClusterIP   10.43.96.140    <none>        443/TCP                  124m
    openfaas      gateway               ClusterIP   10.43.157.212   <none>        8080/TCP                 3m18s
    openfaas      basic-auth-plugin     ClusterIP   10.43.235.211   <none>        8080/TCP                 3m18s
    openfaas      alertmanager          ClusterIP   10.43.100.156   <none>        9093/TCP                 3m18s
    openfaas      nats                  ClusterIP   10.43.83.254    <none>        4222/TCP                 3m18s
    openfaas      gateway-external      NodePort    10.43.35.177    <none>        8080:31112/TCP           3m18s
    openfaas      prometheus            ClusterIP   10.43.12.67     <none>        9090/TCP                 3m18s
    openfaas      of-builder            ClusterIP   10.43.3.230     <none>        8080/TCP                 2m29s
    openfaas      edge-router           ClusterIP   10.43.190.51    <none>        8080/TCP                 2m29s
    openfaas      edge-auth             ClusterIP   10.43.70.132    <none>        8080/TCP                 2m29s
    openfaas-fn   github-push           ClusterIP   10.43.151.24    <none>        8080/TCP                 2m25s
    openfaas-fn   git-tar               ClusterIP   10.43.198.103   <none>        8080/TCP                 2m25s
    openfaas-fn   garbage-collect       ClusterIP   10.43.24.54     <none>        8080/TCP                 2m25s
    openfaas-fn   github-status         ClusterIP   10.43.70.157    <none>        8080/TCP                 2m24s
    openfaas-fn   pipeline-log          ClusterIP   10.43.35.117    <none>        8080/TCP                 2m24s
    openfaas-fn   audit-event           ClusterIP   10.43.58.227    <none>        8080/TCP                 2m23s
    openfaas-fn   echo                  ClusterIP   10.43.50.181    <none>        8080/TCP                 2m23s
    openfaas-fn   system-github-event   ClusterIP   10.43.11.97     <none>        8080/TCP                 2m22s
    openfaas-fn   buildshiprun          ClusterIP   10.43.176.28    <none>        8080/TCP                 2m22s
    openfaas-fn   import-secrets        ClusterIP   10.43.117.118   <none>        8080/TCP                 2m21s
    openfaas-fn   list-functions        ClusterIP   10.43.62.18     <none>        8080/TCP                 2m21s
    openfaas-fn   metrics               ClusterIP   10.43.216.17    <none>        8080/TCP                 2m21s
    openfaas-fn   function-logs         ClusterIP   10.43.209.159   <none>        8080/TCP                 2m20s
    openfaas-fn   system-dashboard      ClusterIP   10.43.60.15     <none>        8080/TCP                 2m20s

    was i supposed to do something with inlets? very early in the blog post it is installed, but then I do nothing else with it directly. Additionally, nothing was yet created in digital ocean

LucasRoesler commented 3 years ago

I tried adding this to my init.yaml and it did not work

- name: "registry-secret"
  files:
    - name: "config.json"
      value_from: "~/.docker/config.json"
  filters:
    - "default"
  namespace: "openfaas"
LucasRoesler commented 3 years ago

Adding both of these did make progress

- name: "registry-secret"
  files:
    - name: "config.json"
      value_from: "~/.docker/config.json"
  filters:
    - "default"
  namespace: "openfaas"
- name: "registry-pull-secret"
  files:
    - name: ".dockerconfigjson"
      value_from: "~/.docker/config.json"
  namespace: "openfaas-fn"
  filters:
    - "default"
  type: "kubernetes.io/dockerconfigjson"
LucasRoesler commented 3 years ago

I went back through the ofc-bootstrap logs and found this

2020/12/05 16:55:08 Creating Ingress Controller
helm upgrade --install nginxingress ingress-nginx/ingress-nginx --set rbac.create=true
Error: failed to download "ingress-nginx/ingress-nginx" (hint: running `helm repo update` may help)
2020/12/05 16:55:08 1 helm upgrade --install nginxingress ingress-nginx/ingress-nginx --set rbac.create=true
 Error: failed to download "ingress-nginx/ingress-nginx" (hint: running `helm repo update` may help)

This should probably be a critical error and stop the bootstrap

LucasRoesler commented 3 years ago

Same for minio

2020/12/05 16:55:09 Creating Minio
Error: failed to download "minio/minio" (hint: running `helm repo update` may help)
2020/12/05 16:55:09 Error: failed to download "minio/minio" (hint: running `helm repo update` may help)
alexellis commented 3 years ago

@Waterdrips PTAL

alexellis commented 3 years ago

Thanks for the report

LucasRoesler commented 3 years ago

I thought we fixed this already?

Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
ingress.extensions/openfaas-ingress created
2020/12/05 16:55:12 0 ingress.extensions/openfaas-ingress created
 Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress

Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
ingress.extensions/openfaas-auth-ingress created
2020/12/05 16:55:12 0 ingress.extensions/openfaas-auth-ingress created
 Warning: extensions/v1beta1 Ingress is deprecated in v1.14+, unavailable in v1.22+; use networking.k8s.io/v1 Ingress
LucasRoesler commented 3 years ago

sealed secrets also fails to download

Error: failed to download "stable/sealed-secrets" (hint: running `helm repo update` may help)
2020/12/05 16:55:13 Error: failed to download "stable/sealed-secrets" (hint: running `helm repo update` may help)
Waterdrips commented 3 years ago

ok, so I propose:

1) get.sh (fixed) (thanks) 2) Update the github app generation to save/append/merge the values into the files (either by default, or with a flag). Blog post(s) need updating to use new flag or new default (think theres some use of this command in the openfaas blogs too) 3) Logging options in ofc-bootstrap need re-addressing. We might want to hide everything thats not an "issue" or "error" (use a lobber and set default to info or warn, allow users to specify debug) Its hard to see whats an issue or not 4) Blog posts and user_guide should be updated to be adding config to a new file, then using the merge functionality to use this config. This will reduce the complexity and make it more obvious what a user needs to set. 5) Blog post needs clarification on registry setting in init.yaml and the ofc-bootstrap registry-creds command. 6) Blog post needs updating for the above, to use correct config for registry. 7) Yes, ofc-bootstrap needs to run in root (well it needs files that are in the repo for the github app creation) We could inline those files to make it not required 8) Blog post needs looking at for the k3s config on ingress

(sections in comments not in main section) 9) Some of the helm install commands are not doing helm repo add and helm repo update (minio, sealed secrets ) Looking at the code i cant see it ever doing those, might need amending. I want to move to using arkade to install these apps so we can probably do that sooner rather than later to work round this. Iv never seen an issue with these before, possibly because I have them added from elsewhere and the app does a helm repo update a few times. 10) Look at ingress to see which endpoint is being used, move to networking.k8s.io/v1 where its not been done.