kubernetes-up-and-running / kuard

Demo app for Kubernetes Up and Running book
Apache License 2.0
1.56k stars 535 forks source link

Make build fails #21

Closed murphybytes closed 5 years ago

murphybytes commented 5 years ago

When I tried to build kuard as described in the book, the build failed. Details follow, with Go version, OS and Docker information as well as the verbose build output.

jam-xps:kuard jam [master] $ uname -a
Linux jam-xps 4.15.0-32-generic #35-Ubuntu SMP Fri Aug 10 17:58:07 UTC 2018 x86_64 x86_64 x86_64 [GNU/Linux]
jam-xps:kuard jam [master] $ go version
go version go1.10.2 linux/amd64
jam-xps:kuard jam [master] $ docker version
Client:
 Version:           18.06.0-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        0ffa825
 Built:             Wed Jul 18 19:09:54 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.0-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       0ffa825
  Built:            Wed Jul 18 19:07:56 2018
  OS/Arch:          linux/amd64
  Experimental:     falsejam-xps:kuard jam [master] $ go version
go version go1.10.2 linux/amd64
jam-xps:kuard jam [master] $ docker version
Client:
 Version:           18.06.0-ce
 API version:       1.38
 Go version:        go1.10.3
 Git commit:        0ffa825
 Built:             Wed Jul 18 19:09:54 2018
 OS/Arch:           linux/amd64
 Experimental:      false

Server:
 Engine:
  Version:          18.06.0-ce
  API version:      1.38 (minimum version 1.12)
  Go version:       go1.10.3
  Git commit:       0ffa825
  Built:            Wed Jul 18 19:07:56 2018
  OS/Arch:          linux/amd64
  Experimental:     false
jam-xps:kuard jam [master] $ make build
building : bin/1/amd64/kuard
docker run --rm --sig-proxy=true -e VERBOSE=1 -e ARCH=amd64 -e PKG=github.com/kubernetes-up-and-running/kuard -e VERSION=v0.7.2-4-g423174b-dirty-1 -u $(id -u):$(id -g) -v kuard-build-data:/data:delegated -v kuard-build-node:/data/go/src/github.com/kubernetes-up-and-running/kuard/client/node_modules:delegated -v $(pwd):/data/go/src/github.com/kubernetes-up-and-running/kuard:delegated -v $(pwd)/bin/1/amd64:/data/go/bin:delegated -v $(pwd)/bin/1/amd64:/data/go/bin/linux_amd64:delegated -w /data/go/src/github.com/kubernetes-up-and-running/kuard kuard-build ./build/build.sh >&1
Verbose: 1
Building with VERBOSE
+ '[' -z github.com/kubernetes-up-and-running/kuard ']'
+ '[' -z amd64 ']'
+ '[' -z v0.7.2-4-g423174b-dirty-1 ']'
+ export CGO_ENABLED=0
+ CGO_ENABLED=0
+ export GOARCH=amd64
+ GOARCH=amd64
+ cd client
+ npm install --loglevel=error
+ npm run build

> client@1.0.0 build /data/go/src/github.com/kubernetes-up-and-running/kuard/client
> NODE_ENV=production webpack

Hash: 2b872c019015d34514a9
Version: webpack 1.15.0
Time: 6657ms
        Asset     Size  Chunks             Chunk Names
    bundle.js   334 kB       0  [emitted]  main
bundle.js.map  2.84 MB       0  [emitted]  main
    + 266 hidden modules
+ go generate -x ./cmd/... ./pkg/...
go-bindata -pkg sitedata -prefix ../../sitedata/ -o bindata.go ../../sitedata/...
+ go install -x -installsuffix static -ldflags '-X github.com/kubernetes-up-and-running/kuard/pkg/version.VERSION=v0.7.2-4-g423174b-dirty-1' ./cmd/...
WORK=/tmp/go-build776450649
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/sitedata/_obj/
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/sitedata
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/pkg/sitedata.a -trimpath $WORK -p github.com/kubernetes-up-and-running/kuard/pkg/sitedata -complete -installsuffix static -buildid c295c07b6aedeef71729c3e740bc61f45c84bf9a -importmap github.com/elazarl/go-bindata-assetfs=github.com/kubernetes-up-and-running/kuard/vendor/github.com/elazarl/go-bindata-assetfs -importmap github.com/julienschmidt/httprouter=github.com/kubernetes-up-and-running/kuard/vendor/github.com/julienschmidt/httprouter -importmap github.com/pkg/errors=github.com/kubernetes-up-and-running/kuard/vendor/github.com/pkg/errors -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/sitedata -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./bindata.go ./doc.go ./sitedata.go
mkdir -p /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/
cp $WORK/github.com/kubernetes-up-and-running/kuard/pkg/sitedata.a /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/sitedata.a
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils/_obj/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils.a -trimpath $WORK -p github.com/kubernetes-up-and-running/kuard/pkg/htmlutils -complete -installsuffix static -buildid d30682a8c304174943c7e53f213621500e16c880 -importmap github.com/dustin/go-humanize=github.com/kubernetes-up-and-running/kuard/vendor/github.com/dustin/go-humanize -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./filters.go ./hashcolor.go ./template.go
cp $WORK/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils.a /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/htmlutils.a
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe/_obj/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe.a -trimpath $WORK -p github.com/kubernetes-up-and-running/kuard/pkg/debugprobe -complete -installsuffix static -buildid 755c570d28ece81ef1013d684cb1a637a7ba0e45 -importmap github.com/julienschmidt/httprouter=github.com/kubernetes-up-and-running/kuard/vendor/github.com/julienschmidt/httprouter -importmap github.com/spf13/pflag=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/pflag -importmap github.com/spf13/viper=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/viper -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./api.go ./config.go ./probe.go
cp $WORK/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe.a /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/debugprobe.a
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/pkg/app/_obj/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/app
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/pkg/app.a -trimpath $WORK -p github.com/kubernetes-up-and-running/kuard/pkg/app -complete -installsuffix static -buildid 5af8552b39c0bd865cedc2b6af48cb2e2f580eab -importmap github.com/felixge/httpsnoop=github.com/kubernetes-up-and-running/kuard/vendor/github.com/felixge/httpsnoop -importmap github.com/julienschmidt/httprouter=github.com/kubernetes-up-and-running/kuard/vendor/github.com/julienschmidt/httprouter -importmap github.com/prometheus/client_golang/prometheus=github.com/kubernetes-up-and-running/kuard/vendor/github.com/prometheus/client_golang/prometheus -importmap github.com/spf13/pflag=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/pflag -importmap github.com/spf13/viper=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/viper -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/pkg/app -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./app.go ./config.go
cp $WORK/github.com/kubernetes-up-and-running/kuard/pkg/app.a /data/go/pkg/linux_amd64_static/github.com/kubernetes-up-and-running/kuard/pkg/app.a
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard/_obj/
mkdir -p $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard/_obj/exe/
cd /data/go/src/github.com/kubernetes-up-and-running/kuard/cmd/kuard
/usr/local/go/pkg/tool/linux_amd64/compile -o $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard.a -trimpath $WORK -p main -complete -installsuffix static -buildid de7e116e279e7862043ed01c2d0636c476341b96 -importmap github.com/spf13/pflag=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/pflag -importmap github.com/spf13/viper=github.com/kubernetes-up-and-running/kuard/vendor/github.com/spf13/viper -D _/data/go/src/github.com/kubernetes-up-and-running/kuard/cmd/kuard -I $WORK -I /data/go/pkg/linux_amd64_static -pack ./main.go
cd .
/usr/local/go/pkg/tool/linux_amd64/link -o $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard/_obj/exe/a.out -L $WORK -L /data/go/pkg/linux_amd64_static -installsuffix static -extld=gcc -buildmode=exe -buildid=de7e116e279e7862043ed01c2d0636c476341b96 -X github.com/kubernetes-up-and-running/kuard/pkg/version.VERSION=v0.7.2-4-g423174b-dirty-1 $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard.a
mkdir -p /data/go/bin/
cp $WORK/github.com/kubernetes-up-and-running/kuard/cmd/kuard/_obj/exe/a.out /data/go/bin/kuard
go install github.com/kubernetes-up-and-running/kuard/cmd/kuard: open /data/go/bin/kuard: permission denied
rules.mk:134: recipe for target 'bin/1/amd64/kuard' failed
make: *** [bin/1/amd64/kuard] Error 1
m4rk4l commented 5 years ago

also, Idk if this is important, but the files in bin get created with root privileges (which is a bit scary)...

Turns out, if you change permissions to the bin directory and try to build again, it will complete. I had to change permissions 3 times in order for it to complete building. Not sure how to modify the make files (I think you are also calling the build/build.sh).

Also, follow the dockerfile suggested in the repository:

FROM alpine
COPY bin/1/amd64/kuard /kuard
ENTRYPOINT ["/kuard"]
jbeda commented 5 years ago

Not sure what is going on in the original, but the idea here is to run stuff in the docker container as the user UID/GID and have that then be passed on to the binaries that are being created. This is to exactly prevent the issue of the binaries being created with UID/GID as root.

I just pushed a new update with up to date javascript libraries (was getting security warnings from github) and with some reworked makefiles.

If y'all could give it a make clean and try again I'd love to hear if things are working better.

jbeda commented 5 years ago

I've updated the README and the Makefile pretty extensively. I'm going to close this as there is a lot different. Let me know if you are still having issues.