Skip to content

Openfaas Ubuntu Build instructions

Cnaik edited this page Jul 5, 2019 · 3 revisions

Building OpenFaas

The instructions provided below specify the steps to build OpenFaas and OpenFaas Cloud components on Linux on IBM Z for following distributions:

  • Ubuntu (18.04)

General Notes:

  • When following the steps below please use a super user unless otherwise specified.
  • A directory /<source_root>/ will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.

Prerequisites

  • Docker 18.06 - Instructions for building Docker can be found

Step 1: Install dependencies

  export SOURCE_ROOT=/<source_root>/
  apt-get update
  apt install -y make curl
  • Install Go 1.10.4
    wget https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Go/build_go.sh
    bash build_go.sh -v 1.10.4
    mkdir $SOURCE_ROOT/go
    export GOPATH=$SOURCE_ROOT/go
  • Install Helm 2.13.1 - Instructions for building Helm can be found here

Step 2: Build OpenFaas Components

  • Build openfaas/gateway image

    • Download the source code

      go get github.com/openfaas/faas/gateway
      cd $GOPATH/src/github.com/openfaas/faas/gateway
      git checkout tags/0.13.4
    • Create Dockerfile named Dockerfile.gate-s390x with following content

      FROM s390x/golang:1.10.4 as build
      WORKDIR /go/src/github.com/openfaas/faas/gateway
      
      #  RUN curl -sL https://github.com/alexellis/license-check/releases/download/0.1/license-check > /usr/bin/license-check && chmod +x /usr/bin/license-check
      
      COPY vendor         vendor
      
      COPY handlers       handlers
      COPY metrics        metrics
      COPY requests       requests
      COPY tests          tests
      
      COPY types          types
      COPY queue          queue
      COPY plugin         plugin
      COPY version        version
      COPY scaling        scaling
      COPY server.go      .
      
      #Run a gofmt and exclude all vendored code.
      #RUN license-check -path ./ --verbose=false \
      RUN GOARCH=s390x CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o gateway .
      
      FROM s390x/alpine:3.8
      
      RUN addgroup -S app \
        && adduser -S -g app app
      
      WORKDIR /home/app
      
      EXPOSE 8080
      EXPOSE 8082
      ENV http_proxy      ""
      ENV https_proxy     ""
      
      COPY --from=build /go/src/github.com/openfaas/faas/gateway/gateway    .
      COPY assets     assets
      
      RUN chown -R app:app ./
      
      USER app
      
      RUN sed -ie s/store.json/store-s390x.json/g /home/app/assets/script/funcstore.js
      
      CMD ["./gateway"]
    • Build the image

      docker build -f Dockerfile.gate-s390x -t openfaas/gateway:0.13.4-s390x .
  • Build the image openfaas/faas-swarm

    • Download the source code

      go get -d github.com/openfaas/faas-swarm
      cd $GOPATH/src/github.com/openfaas/faas-swarm
      git checkout 0.6.2
    • Modify the Dockerfile

      sed -i 's/RUN license-check/#RUN license-check/g' Dockerfile
      sed -i 's/RUN curl -sL/#RUN curl -sL/g' Dockerfile
      sed -i 's/    && chmod +x/#    && chmod +x/g' Dockerfile
    • Build the image

      docker build -f Dockerfile -t openfaas/faas-swarm:0.6.2-s390x .
  • Build the image prom/prometheus

    • Download the source code
       cd $GOPATH/src/github.com
       mkdir -p Prometheus && cd Prometheus
       wget https://raw.githubusercontent.com/linux-on-ibm-z/dockerfile-examples/master/Prometheus/Dockerfile
    • Modify the Dockerfile as below
      --- Dockerfile  2019-06-07 06:59:06.372589452 +0000
      +++ Dockerfile.prom-s390x       2019-06-03 13:15:24.893720284 +0000
      @@ -54,5 +54,5 @@
       #Export port
       EXPOSE 9090
       VOLUME [ "/prometheus" ]
      -
      +ENTRYPOINT [ "/prometheus/prometheus" ]
       CMD prometheus --config.file=/etc/prometheus/prometheus.yml --web.console.libraries=/etc/prometheus/console_libraries --web.console.templates=/etc/prometheus/consoles
    • Build the image
       docker build -f Dockerfile -t prom/prometheus:v2.7.1-s390x .
  • Build the image openfaas/queue-worker

    • Download the source code
      go get github.com/openfaas/nats-queue-worker 
      cd $GOPATH/src/github.com/openfaas/nats-queue-worker
      git checkout 0.7.2
    • Build the image
      docker build -f Dockerfile -t openfaas/queue-worker:0.7.2-s390x .
  • Build the image prom/alertmanager

    • Download the source code

      go get github.com/prometheus/alertmanager
      cd $GOPATH/src/github.com/prometheus/alertmanager
      git checkout v0.16.2
    • Create Dockerfile named Dockerfile.s390x with following content

      FROM        s390x/golang:1.11.4
      MAINTAINER  The Prometheus Authors <[email protected]>
      
      WORKDIR /go/src/github.com/prometheus/alertmanager
      COPY    . /go/src/github.com/prometheus/alertmanager
      
      RUN apt-get install make \
      	&& make build \
      	&& cp alertmanager /bin/ \
      	&& mkdir -p /etc/alertmanager/template \
      	&& mv ./doc/examples/simple.yml /etc/alertmanager/config.yml \
      	&& rm -rf /go
      
      EXPOSE     9093
      VOLUME     [ "/alertmanager" ]
      WORKDIR    /alertmanager
      ENTRYPOINT [ "/bin/alertmanager" ]
      CMD        [ "-config.file=/etc/alertmanager/config.yml", \
      			 "-storage.path=/alertmanager" ]
    • Build the image

      docker build -f Dockerfile.s390x -t prom/alertmanager:v0.16.2-s390x .
  • Build the image nats-streaming

    • Download the source code
      go get github.com/nats-io/nats-streaming-server
      cd $GOPATH/src/github.com/nats-io/nats-streaming-server
      git checkout v0.11.2
    • Modify the Dockerfile as below
      sed -i '/window/a RUN CGO_ENABLED=0 GOOS=linux   GOARCH=s390x go build -v -a -tags netgo -installsuffix netgo -ldflags "-s -w -X github.com/nats-io/nats-streaming-server/version.GITCOMMIT=`git rev-parse --short HEAD`" -o pkg/linux-s390x/nats-streaming-server && cp pkg/linux-s390x/nats-streaming-server /' Dockerfile
    • Build the image
      docker build -f Dockerfile -t nats-streaming:0.11.2-s390x .
  • Build the faas-CLI binary & openfaas/faas-cli image

    • Download the source code

       cd $GOPATH/src/github.com/openfaas
       go get github.com/openfaas/faas-cli && cd faas-cli/
       git checkout 0.8.14
       go build
       cp faas-cli /usr/bin
    • Modify the Dockerfile as below

      sed -i 's/RUN curl -sLSf/#RUN curl -sLSf/g' Dockerfile
      sed -i 's/RUN \/usr\/bin\/license-check/#RUN \/usr\/bin\/license-check/g' Dockerfile
    • Build the image

      docker build -f Dockerfile -t openfaas/faas-cli:0.8.14-s390x 
  • Build the watchdog binary and openfaas/classic-watchdog image

    • Download the source code
      go get github.com/openfaas/faas/watchdog
      cd $GOPATH/src/github.com/openfaas/faas/watchdog
      git checkout tags/0.13.4
      
      GOARCH=s390x CGO_ENABLED=0 GOOS=linux go build -a -ldflags "-s -w  -X main.GitCommit=$GIT_COMMIT -X main.Version=$VERSION" -installsuffix cgo -o watchdog . && cp watchdog fwatchdog
    • Create Dockerfile named Dockerfile.s390x with following content
      FROM s390x/golang:1.10 as build
      
      ARG VERSION
      ARG GIT_COMMIT
      
      RUN mkdir -p /go/src/github.com/openfaas/faas/watchdog
      WORKDIR /go/src/github.com/openfaas/faas/watchdog
      
      COPY vendor                     vendor
      COPY metrics                    metrics
      COPY types                      types
      COPY main.go                    .
      COPY handler.go                         .
      COPY readconfig.go                  .
      COPY readconfig_test.go             .
      COPY requesthandler_test.go     .
      COPY version.go                 .
      
      # Run a gofmt and exclude all vendored code.
      RUN test -z "$(gofmt -l $(find . -type f -name '*.go' -not -path "./vendor/*"))"
      
      RUN go test -v ./...
      # Stripping via -ldflags "-s -w"
      RUN GOARCH=s390x CGO_ENABLED=0 GOOS=linux go build -a -ldflags "-s -w \
      		-X main.GitCommit=$GIT_COMMIT \
      		-X main.Version=$VERSION" \
      		-installsuffix cgo -o watchdog . \
      		&& cp watchdog /fwatchdog
      
    • Build the image
      docker build -f Dockerfile.s390x -t openfaas/classic-watchdog:0.13.4 .
  • Build the ofc-bootstrap binary

     go get -d github.com/openfaas-incubator/ofc-bootstrap
     cd $GOPATH/src/github.com/openfaas-incubator/ofc-bootstrap/
     git checkout 0.6.4
     go build
  • Build the image openfaas/kafka-connector

    • Download the source code
       go get github.com/openfaas-incubator/kafka-connector
       cd $GOPATH/src/github.com/openfaas-incubator/kafka-connector
       git checkout 0.3.3
    • Build the image
       docker build -f Dockerfile -t openfaas/kafka-connector:0.3.3-s390x .
  • Build the image openfaas/faas-netes

    • Download the source code

       go get github.com/openfaas/faas-netes
       cd $GOPATH/src/github.com/openfaas/faas-netes
       git checkout 0.7.5
    • Modify the Dockerfile as below

      sed -i 's/RUN license-check/#RUN license-check/g' Dockerfile
    • Modify the chart/kafka-connector/values.yaml as below

      sed -i 's/0.3.3/0.3.3-s390x/g' chart/kafka-connector/values.yaml
      sed -i 's/0.7.3/0.7.5-s390x/g' chart/openfaas/values.yaml
      sed -i 's/Always/IfNotPresent/g' chart/openfaas/values.yaml
      sed -i 's/0.13.0/0.13.4-s390x/g' chart/openfaas/values.yaml
      sed -i 's/0.7.1/0.7.2-s390x/g' chart/openfaas/values.yaml
      sed -i 's/0.9.4/0.9.4-s390x/g' chart/openfaas/values.yaml
      sed -i 's/v2.7.1/v2.7.1-s390x/g' chart/openfaas/values.yaml
      sed -i 's/v0.16.1/v0.16.2-s390x/g' chart/openfaas/values.yaml
      sed -i 's/0.11.2/0.11.2-s390x/g' chart/openfaas/values.yaml
      sed -i 's/0.1.9/0.1.9-s390x/g' chart/openfaas/values.yaml
    • Modify the chart/openfaas/templates/alertmanager-dep.yaml as below

      sed -i  '/--spider/d' chart/openfaas/templates/alertmanager-dep.yaml
    • Modify the chart/openfaas/templates/prometheus-dep.yaml as below

      sed -i  '/--spider/d' chart/openfaas/templates/prometheus-dep.yaml
    • Package the openfaas and kafka-connector charts

      cd chart/ 
      helm package openfaas/
      helm package kafka-connector/
      mv openfaas-3.2.3.tgz ../docs && mv kafka-connector-0.2.2.tgz ../docs && cd ../
    • Build the image

      docker build -f Dockerfile -t openfaas/faas-netes:0.7.5-s390x .
  • Build the image openfaas/openfaas-operator

    • Download the source code
       go get github.com/openfaas-incubator/openfaas-operator
       cd $GOPATH/src/github.com/openfaas-incubator/openfaas-operator
       git checkout 0.9.4
    • Build the image
      docker build -f Dockerfile -t openfaas/openfaas-operator:0.9.4-s390x .
  • Build the image openfaas/faas-idler

    • Download the source code

       go get github.com/openfaas-incubator/faas-idler
       cd $GOPATH/src/github.com/openfaas-incubator/faas-idler
       git checkout 0.1.9
    • Create the patch patch_idler

      diff --git a/main.go b/main.go
      index 35a4fc0..c703469 100644
      --- a/main.go
      +++ b/main.go
      @@ -42,15 +42,6 @@ func main() {
      
      		credentials := Credentials{}
      
      -       client := &http.Client{}
      -       version, err := getVersion(client, config.GatewayURL, &credentials)
      -
      -       if err != nil {
      -               panic(err)
      -       }
      -
      -       log.Printf("Gateway version: %s, SHA: %s\n", version.Version.Release, version.Version.SHA)
      -
      		val, err := readFile("/var/secrets/basic-auth-user")
      		if err == nil {
      				credentials.Username = val
      @@ -65,6 +56,15 @@ func main() {
      				log.Printf("Unable to read password: %s", err)
      		}
      
      +        client := &http.Client{}
      +        version, err := getVersion(client, config.GatewayURL, &credentials)
      +
      +        if err != nil {
      +                panic(err)
      +        }
      +
      +        log.Printf("Gateway version: %s, SHA: %s\n", version.Version.Release, version.Version.SHA)
      +
      		fmt.Printf(`dry_run: %t
       gateway_url: %s
       inactivity_duration: %s `, dryRun, config.GatewayURL, config.InactivityDuration)
    • Apply the above patch to main.go

       patch --ignore-whitespace main.go patch_idler
    • Build the image

      docker build -f Dockerfile -t openfaas/faas-idler:0.1.9-s390x .
  • Build the image minio/minio

    • Download the source code
      go get -d github.com/minio/minio
      cd $GOPATH/src/github.com/minio/minio
      git checkout RELEASE.2019-05-14T23-57-45Z
    • Build the image
      docker build -t minio/minio:RELEASE.2019-05-14T23-57-45Z .
      Note: Docker build may hang while fetching/building Go modules. You may want to kill the build process and start over again.
  • Build the image minio/mc for minion client

    • Download the source code
      go get -d github.com/minio/mc
      cd $GOPATH/src/github.com/minio/mc
      git checkout RELEASE.2019-05-01T23-27-44Z
    • Build the image
      docker build -f Dockerfile -t minio/mc:RELEASE.2019-05-01T23-27-44Z .
  • Build the image quay.io/bitnami/sealed-secrets-controller

     mkdir $SOURCE_ROOT/sealed-secrets
     cd $SOURCE_ROOT/sealed-secrets
    • Create Dockerfile with following content.
      FROM golang:1.12-alpine
      RUN apk add --no-cache make git && go get github.com/bitnami-labs/sealed-secrets/cmd/kubeseal \
      	&&  cd src/github.com/bitnami-labs/sealed-secrets/ \
      	&& make && chmod +x controller kubeseal \
      	&& cp controller /usr/local/bin/ && cp kubeseal /usr/local/bin/
      
      EXPOSE 8080
      ENTRYPOINT ["controller"]
    • Build the image
      docker build -t quay.io/bitnami/sealed-secrets-controller:v0.7.0 .
  • Build the image quay.io/kubernetes-ingress-controller/nginx-ingress-controller

    • Build the image
      cd $SOURCE_ROOT 
      mkdir nginx-ingress-controller && cd $SOURCE_ROOT /nginx-ingress-controller
      wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/NGINX-ingress-controller/0.24.1/build_nginx-ingress-controller.sh
      bash build_nginx-ingress-controller.sh -y
      docker tag quay.io/kubernetes-ingress-controller/nginx-ingress-controller-s390x:0.24.1 quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.24.1
  • Build kubeseal

     go get -d github.com/bitnami-labs/sealed-secrets/cmd/kubeseal
     cd $GOPATH/src/github.com/bitnami-labs/sealed-secrets/cmd/kubeseal
     git checkout v0.7.0
     go build

    Note: Warnings related to No GO files should be ignored.

  • Build the image for Tiller

    • Download the source code
      go get -d github.com/helm/helm
      cd $GOPATH/src/github.com/helm/helm
      git checkout v2.13.1
      cd rootfs && wget https://storage.googleapis.com/kubernetes-helm/helm-v2.13.1-linux-s390x.tar.gz
      tar -xzvf helm-v2.13.1-linux-s390x.tar.gz && cp linux-s390x/tiller . && cp linux-s390x/helm .
      rm -rf helm-v2.13.1-linux-s390x.tar.gz linux-s390x/
    • Build the image
      docker build -f Dockerfile -t gcr.io/kubernetes-helm/tiller:v2.13.1 .
  • Build the images openfaas/edge-router and openfaas/of-builder

     go get -d github.com/openfaas/openfaas-cloud
     cd $GOPATH/src/github.com/openfaas/openfaas-cloud
     git checkout 0.9.4
     cd edge-router && docker build -f Dockerfile -t openfaas/edge-router:0.6.1 .
     cd ../of-builder && docker build -f Dockerfile -t openfaas/of-builder:0.6.2 .
  • Build the image k8s.gcr.io/defaultbackend

    • Download the source code
      go get -d github.com/kubernetes/ingress-gce
      cd $GOPATH/src/github.com/kubernetes/ingress-gce
      git checkout v1.5.0
    • Modify the Dockerfile as below:
      sed -i 's/ARG_BIN/404-server/g' Dockerfile.404-server
      sed -i 's/ARG_ARCH/s390x/g' Dockerfile.404-server
    • Modify the Makefile as below:
      sed -i 's/amd64/s390x/g' Makefile
      make && cp .go/bin/404-server bin/s390x/
    • Build the image
      docker build -f Dockerfile.404-server -t k8s.gcr.io/defaultbackend-amd64:1.5 .
      Note: Leave the tag as amd64 otherwise we need to create local helm charts.
  • Build the openfaas-fn images

    Note: These instructions assume that you have a Gitlab instance serving modified Templates compatible with s390x architecture. These modifications to templates include replacing openfaas/classic-watchdog:0.13.4 instances in Dockerfiles with s390x compiled fwatchdog. In the below instructions replace the <git_URL> with your project instance eg. http://my.gitlab/username/s390xtemplates.git.

    • Build image functions/of-git-tar

      cd $GOPATH/src/github.com/openfaas/openfaas-cloud/git-tar
      cd $GOPATH/src/github.com/openfaas/openfaas-cloud/git-tar
      rm -rf template/
      faas-cli template pull  <git_URL>
      OPENFAAS_TEMPLATE_URL=<git_URL> faas-cli build --image  functions/of-git-tar:0.13.0 --lang Dockerfile --handler . --name git-tar
    • Build image functions/of-buildshiprun

      cd $GOPATH/src/github.com/openfaas/openfaas-cloud/buildshiprun
      rm -rf template/
      faas-cli template pull  <git_URL>
      OPENFAAS_TEMPLATE_URL=<git_URL> faas-cli build --image functions/of-buildshiprun:0.11.1 --lang go --handler . --name buildshiprun
    • Build image functions/github-event

      cd $GOPATH/src/github.com/openfaas/openfaas-cloud/github-event
      rm -rf template/
      faas-cli template pull  <git_URL>
      OPENFAAS_TEMPLATE_URL=<git_URL> faas-cli build --image functions/github-event:0.8.0 --lang go --handler . --name github-event
    • Build image functions/import-secrets

      cd $GOPATH/src/github.com/openfaas/openfaas-cloud/import-secrets
      rm -rf template/
      faas-cli template pull <git_URL>
      OPENFAAS_TEMPLATE_URL=<git_URL> faas-cli build --image functions/import-secrets:0.3.3 --lang go --handler . --name import-secrets
    • Build image functions/system-metrics

      cd $GOPATH/src/github.com/openfaas/openfaas-cloud/system-metrics
      rm -rf template/
      faas-cli template pull  <git_URL>
      OPENFAAS_TEMPLATE_URL=<git_URL> faas-cli build --image functions/system-metrics:0.1.1 --lang go --handler . --name system-metrics
    • Build image functions/github-status

      cd $GOPATH/src/github.com/openfaas/openfaas-cloud/github-status
      rm -rf template/
      faas-cli template pull  <git_URL>
      OPENFAAS_TEMPLATE_URL=<git_URL> faas-cli build --image functions/github-status:0.3.6 --lang go --handler . --name github-status
    • Build image functions/garbage-collect

      cd $GOPATH/src/github.com/openfaas/openfaas-cloud/garbage-collect
      rm -rf template/
      faas-cli template pull  <git_URL>
      OPENFAAS_TEMPLATE_URL=<git_URL> faas-cli build --image functions/garbage-collect:0.4.4 --lang go --handler . --name garbage-collect
    • Build image functions/pipeline-log:0.3.3

      cd $GOPATH/src/github.com/openfaas/openfaas-cloud/pipeline-log
      rm -rf template/
      faas-cli template pull  <git_URL>
      OPENFAAS_TEMPLATE_URL=<git_URL> faas-cli build --image  functions/pipeline-log:0.3.3 --lang go --handler . --name pipeline-log
    • Build image functions/github-push

      cd $GOPATH/src/github.com/openfaas/openfaas-cloud/github-push
      rm -rf template/
      faas-cli template pull  <git_URL>
      OPENFAAS_TEMPLATE_URL=<git_URL> faas-cli build --image  functions/github-push:0.7.3 --lang go --handler . --name github-push
    • Build image functions/audit-event

      cd $GOPATH/src/github.com/openfaas/openfaas-cloud/audit-event
      rm -rf template/
      faas-cli template pull  <git_URL>
      OPENFAAS_TEMPLATE_URL=<git_URL> faas-cli build --image functions/audit-event:0.1.2 --lang go --handler . --name audit-event
    • Build image functions/list-functions

      cd $GOPATH/src/github.com/openfaas/openfaas-cloud/list-functions
      rm -rf template/
      faas-cli template pull  <git_URL>
      OPENFAAS_TEMPLATE_URL=<git_URL> faas-cli build --image functions/list-functions:0.4.8 --lang go --handler . --name list-functions
    • Build image functions/of-cloud-dashboard

      cd $GOPATH/src/github.com/openfaas/openfaas-cloud/dashboard
      make
      rm -rf template/
      faas-cli template pull  <git_URL>
      OPENFAAS_TEMPLATE_URL=<git_URL> faas-cli build --image functions/of-cloud-dashboard:0.4.3 --lang node --handler . --name dashboard
    • Build image functions/gitlab-status

      cd $GOPATH/src/github.com/openfaas/openfaas-cloud/gitlab-status
      rm -rf template/
      faas-cli template pull <git_URL>
      OPENFAAS_TEMPLATE_URL=<git_URL> faas-cli build --image functions/gitlab-status:0.1.1 --lang go --handler . --name gitlab-status
    • Build image functions/gitlab-push

      cd $GOPATH/src/github.com/openfaas/openfaas-cloud/gitlab-push
      sed -i 's/System Hook/Push Hook/g' handler.go
      rm -rf template/
      faas-cli template pull <git_URL>
      OPENFAAS_TEMPLATE_URL=<git_URL> faas-cli build --image functions/gitlab-push:0.2.1 --lang go --handler . --name gitlab-push
    • Build image functions/gitlab-event

      cd $GOPATH/src/github.com/openfaas/openfaas-cloud/gitlab-event
      sed -i 's/System Hook/Push Hook/g' handler.go
      rm -rf template/
      faas-cli template pull <git_URL>
      OPENFAAS_TEMPLATE_URL=<git_URL> faas-cli build --image functions/gitlab-event:0.1.2 --lang go --handler . --name gitlab-event
  • Build image functions/alpine

     cd $GOPATH/src/github.com/openfaas/openfaas-cloud
     mkdir alpine && cd alpine && wget -q https://raw.githubusercontent.com/openfaas/faas/master/sample-functions/AlpineFunction/Dockerfile
     sed -i 's/0.14.4/0.13.4/g' Dockerfile
     docker build -f Dockerfile -t functions/alpine:latest .
     cd ../ && rm -rf alpine/
 
*   #### Apply the bootstrap changes during deployment   

 ```bash
     cd $GOPATH/src/github.com/openfaas-incubator/ofc-bootstrap/
     sed -i 's/Always/IfNotPresent/g' templates/edge-auth-dep.yml
  • Update the ofc-bootstrap scripts

    • Modify the scripts/deploy-cloud-components.sh as below
      cd $GOPATH/src/github.com/openfaas-incubator/ofc-bootstrap/
      sed -i 's/faas deploy/faas-cli deploy/g' scripts/deploy-cloud-components.sh
      ``
      
    • Apply the below patch to scripts/clone-cloud-components.sh
      diff --git a/scripts/clone-cloud-components.sh b/scripts/clone-cloud-components.sh
      index 781ed24..ef629a8 100755
      --- a/scripts/clone-cloud-components.sh
      +++ b/scripts/clone-cloud-components.sh
      @@ -7,3 +7,5 @@ git clone https://github.com/openfaas/openfaas-cloud ./tmp/openfaas-cloud
       cd ./tmp/openfaas-cloud
       echo "Checking out openfaas/openfaas-cloud@$TAG"
       git checkout $TAG
      +sed -i 's/Always/IfNotPresent/g' yaml/core/edge-router-dep.yml
      +sed -i 's/Always/IfNotPresent/g' yaml/core/of-builder-dep.yml
    • Apply the below patch to scripts/create-tiller.sh
      cat > patch_create_tiller <<- EOF
      diff --git a/scripts/create-tiller.sh b/scripts/create-tiller.sh
      index 30b9623..077ce87 100755
      --- a/scripts/create-tiller.sh
      +++ b/scripts/create-tiller.sh
      @@ -1,3 +1,4 @@
       #!/bin/bash
       
      -helm init --skip-refresh --upgrade --service-account tiller
      +#helm init --skip-refresh --upgrade --service-account tiller
      +helm init --skip-refresh --service-account tiller
    • Apply the below patch to scripts/export-sealed-secret-pubcert.sh
      cat > patch_export_sealed_secret_pubcert <<- "EOF"
      diff --git a/scripts/export-sealed-secret-pubcert.sh b/scripts/export-sealed-secret-pubcert.sh
      index babee7d..a0793d8 100755
      --- a/scripts/export-sealed-secret-pubcert.sh
      +++ b/scripts/export-sealed-secret-pubcert.sh
      @@ -10,9 +10,13 @@ then
       #    release=$(curl --silent "https://api.github.com/repos/bitnami-labs/sealed-secrets/releases/latest" | sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p')
      	 echo "SealedSecrets release: $release"
       
      -    curl -sLSf https://github.com/bitnami/sealed-secrets/releases/download/$release/kubeseal-$GOOS-$GOARCH > kubeseal && \
      -    chmod +x kubeseal
      +    #curl -sLSf https://github.com/bitnami/sealed-secrets/releases/download/$release/kubeseal-$GOOS-$GOARCH > kubeseal && \
      +    #chmod +x kubeseal
      +    go get -d github.com/bitnami-labs/sealed-secrets/cmd/kubeseal
      +    cd $GOPATH/src/github.com/bitnami-labs/sealed-secrets/cmd/kubeseal
      +    git checkout $release 
      +    go build
       fi
       
      -./kubeseal --fetch-cert --controller-name=ofc-sealedsecrets-sealed-secrets > tmp/pub-cert.pem && \
      -  cat tmp/pub-cert.pem
      +./kubeseal --fetch-cert --controller-name=ofc-sealedsecrets-sealed-secrets > tmp/pubcert.pem && \
      +  cat tmp/pubcert.pem
    • Apply the below patch to scripts/install-openfaas.sh
      cat > patch_install_openfaas <<- EOF
      diff --git a/scripts/install-openfaas.sh b/scripts/install-openfaas.sh
      index a99504e..6b89fdc 100755
      --- a/scripts/install-openfaas.sh
      +++ b/scripts/install-openfaas.sh
      @@ -1,6 +1,6 @@
       #!/bin/bash
       
      -helm repo add openfaas https://openfaas.github.io/faas-netes
      +helm repo add openfaas http://127.0.0.1:8879/charts 
       
       helm repo update && \
       helm upgrade openfaas --install openfaas/openfaas \

Step 3: Deploy OpenFaaS Cloud

  • Serve local helm chart

     cd $GOPATH/src/github.com/openfaas/faas-netes
     helm repo index docs --url https://openfaas.github.io/faas-netes/ --merge ./docs/index.yaml
     helm serve &
  • Deploy OpenFaaS Cloud using ofc-bootstrap tool

    Note: Ensure you have a private Docker registry setup to hold OpenFaas functions deployed by the OpenFaas Cloud pipeline Ensure you have a Gitlab acount to host your OpenFaaS functions and appropriate Hooks to trigget the build Ensure you have an internal server to serve required binaries and Helm charts for the installation A DNS server as required by OpenFaas Cloud installation

    Once all the required images have been built by preceding steps and init.yaml file has been created as per ofc-bootstarp instructions, you can start the deployment as follows:

    cd $GOPATH/src/github.com/openfaas-incubator/ofc-bootstrap/
    ./ofc-bootstrap -yaml=init.yaml
Clone this wiki locally