tinkerbell / smee

DHCP and iPXE Server
https://tinkerbell.org
Apache License 2.0
270 stars 80 forks source link

panic: required envvar is unset (ROLLBAR_TOKEN) #7

Closed vielmetti closed 2 years ago

vielmetti commented 4 years ago

Successful build on Ubuntu 18.04 for aarch64 under WSL, but when I follow the instructions in the README I get this:

ed@iyengar:~/src/github.com/tinkerbell/boots$ ./boots
{"level":"panic","ts":1585923538.9905274,"caller":"rollbar/rollbar.go:20","msg":"required envvar is unset","service":"github.com/tinkerbell/boots","pkg":"log","envvar":"ROLLBAR_TOKEN"}
panic: required envvar is unset

goroutine 1 [running]:
go.uber.org/zap/zapcore.(*CheckedEntry).Write(0x4000204000, 0x400016a300, 0x1, 0x2)
        /home/ed/go/pkg/mod/go.uber.org/zap@v1.10.0/zapcore/entry.go:229 +0x40c
go.uber.org/zap.(*SugaredLogger).log(0x40001b0018, 0x4, 0x641d77, 0x18, 0x0, 0x0, 0x0, 0x40000e9a78, 0x2, 0x2)
        /home/ed/go/pkg/mod/go.uber.org/zap@v1.10.0/sugar.go:234 +0xd4
go.uber.org/zap.(*SugaredLogger).Panicw(...)
        /home/ed/go/pkg/mod/go.uber.org/zap@v1.10.0/sugar.go:204
github.com/packethost/pkg/log/internal/rollbar.Setup(0x40001b0018, 0x64397e, 0x1b, 0x2)
        /home/ed/go/pkg/mod/github.com/packethost/pkg@v0.0.0-20190715213007-7c3a64b4b5e3/log/internal/rollbar/rollbar.go:20 +0x3a8
github.com/packethost/pkg/log.configureLogger(0x40001a0120, 0x64397e, 0x1b, 0x633420, 0x4, 0x632e61, 0x3, 0x633eef, 0x5)
        /home/ed/go/pkg/mod/github.com/packethost/pkg@v0.0.0-20190715213007-7c3a64b4b5e3/log/log.go:69 +0x1c8
github.com/packethost/pkg/log.Init(0x64397e, 0x1b, 0x0, 0x0, 0x0, 0x0, 0x400008b838, 0x0)
        /home/ed/go/pkg/mod/github.com/packethost/pkg@v0.0.0-20190715213007-7c3a64b4b5e3/log/log.go:87 +0xd4
main.main()
        /home/ed/src/github.com/tinkerbell/boots/main.go:41 +0xb8
parauliya commented 4 years ago

@vielmetti , boots runs in a docker container and while starting a container with boots image we take care of all the environment variables which are required to run the boots binary. Please refer docker-compose.yml file in tink repo to know all the envs which are required to run boots docker image.

gauravgahlot commented 4 years ago

@vielmetti @parauliya Considering the scenario where a user may not want to use Docker for the whole provisioned setup, I think it would be nice to have a list of all the environment variables.

We can have a list of environment variables required for each application to be ready, in the README. And, it would be nice if we can briefly mention what each is required for.

alexellis commented 4 years ago

I ran into this too when testing this morning.

Maybe this requirement changed after the README was written? I'd suggest giving a sample that works in the README, even if the context for the env-var choices are written up somewhere else.

alexellis commented 4 years ago

@parauliya the documentation doesn't mention a Docker container, so my understanding from the README is that it should run outside, otherwise the README should prefix the instructions with docker run golang:latest or similar before having us install git-lfs.

@nathangoulding do you see a path for usage inside and outside of the container, or should users only use compose?

alexellis commented 4 years ago

I tried copying the instructions from https://github.com/tinkerbell/boots/blob/9d6cded511d1e7678ec601a29aac4137f25ecb5a/installers/rancher/main_test.go, but got as far as:

ROLLBAR_DISABLE=1 API_AUTH_TOKEN=token API_CONSUMER_TOKEN=test1234 PACKET_VERSION=0 PACKET_VERSION=0 PACKET_ENV=test ROLLBAR_TOKEN=1 ./boots 
{"level":"info","ts":1586167193.6481194,"caller":"boots/main.go:54","msg":"starting","service":"github.com/tinkerbell/boots","pkg":"main","version":"unknown (use make)"}
{"level":"error","ts":1586167193.6482196,"caller":"boots/main.go:58","msg":"FACILITY_CODE env must be set","service":"github.com/tinkerbell/boots","pkg":"main","error":"FACILITY_CODE env must be set","errorVerbose":"FACILITY_CODE env must be set\ngithub.com/tinkerbell/boots/packet.NewClient\n\t/home/alex/go/src/github.com/tinkerbell/boots/packet/client.go:42\nmain.main\n\t/home/alex/go/src/github.com/tinkerbell/boots/main.go:56\nruntime.main\n\t/usr/lib/go/src/runtime/proc.go:203\nruntime.goexit\n\t/usr/lib/go/src/runtime/asm_amd64.s:1373"}
panic: FACILITY_CODE env must be set

goroutine 1 [running]:
github.com/packethost/pkg/log.Logger.Fatal(0xa96141, 0x1b, 0xc000010058, 0xc00011e9e0, 0xb62700, 0xc00000e820, 0x0, 0x0, 0x0)
    /home/alex/go/pkg/mod/github.com/packethost/pkg@v0.0.0-20190715213007-7c3a64b4b5e3/log/log.go:119 +0xe4
main.main()
    /home/alex/go/src/github.com/tinkerbell/boots/main.go:58 +0x954
[alex@nuc boots]$ FACILITY_CODE=test ROLLBAR_DISABLE=1 API_AUTH_TOKEN=token API_CONSUMER_TOKEN=test1234 PACKET_VERSION=0 PACKET_VERSION=0 PACKET_ENV=test ROLLBAR_TOKEN=1 ./boots 
panic: looking up ip of mirror url: lookup install.test.packet.net on 8.8.8.8:53: no such host

goroutine 1 [running]:
github.com/tinkerbell/boots/env.mustFindMirrorIPBase(0xc000150880, 0xc000028380)
    /home/alex/go/src/github.com/tinkerbell/boots/env/mirror.go:85 +0x20a
github.com/tinkerbell/boots/env.init()
    /home/alex/go/src/github.com/tinkerbell/boots/env/mirror.go:23 +0x2b8
vielmetti commented 4 years ago

@alexellis The puzzling thing to me is the information about what should be used as the "facility code" - that appears in the current code to resolve to a hard-coded lookup to a install.$(FACILITY_CODE).packet.net address, but for on-prem or homelab install there would need to be a change to that mirror url.

alexellis commented 4 years ago

Perhaps we are now going outside of the happy path?

nathangoulding commented 4 years ago

We should remove this restriction.

displague commented 2 years ago

Closing this as the original issue is no longer present (ROLLBAR_TOKEN is not required). https://github.com/tinkerbell/boots/blob/65d8c38/cmd/boots/main.go#L67-L78

Please open additional issues and refer back to this issue if other problems expressed in this thread need to be resolved.